From 6d1298142cf3f6317e408817a25c1b0ec82d48ee Mon Sep 17 00:00:00 2001 From: naif-deriv <112558231+naif-deriv@users.noreply.github.com> Date: Tue, 21 Feb 2023 11:14:36 +0400 Subject: [PATCH 01/64] naif/add_dart_new_features_to_code_generator (#244) - add dart new features to the code generator --- api_builder.dart | 41 +++++++++++-------- .../helpers/constructor_helper.dart | 22 +--------- lib/widgets/snack_bar/snack_bar.dart | 2 +- .../top_snack_bar/top_snack_bar.dart | 2 +- .../top_snack_bar/top_snack_bar_widget.dart | 2 +- pubspec.yaml | 14 +++---- 6 files changed, 36 insertions(+), 47 deletions(-) diff --git a/api_builder.dart b/api_builder.dart index 8871a141b5..3c424add6f 100644 --- a/api_builder.dart +++ b/api_builder.dart @@ -122,8 +122,8 @@ class APIBuilder extends Builder { /// Initialize $classFullName. const $classFullName({ ${_getConstructorParameters(methodName, schema, schemaType, properties)} - ${_getSuperClassParameters(schemaType)}, - }): super(${_getSuperClassCallParameters(schemaType, methodName)},); + ${_getSuperClassConstructorParameters(schemaType, methodName)}, + }); ${_getFromJsonMethod(classFullName, schema, schemaType, properties)} @@ -169,6 +169,7 @@ class APIBuilder extends Builder { return '${_isFieldRequired(key, schemaType, property) ? 'required ' : ''} this.${ReCase(key).camelCase}'; }, ).join(', '); + return fields.isEmpty ? result : '$result , '; } @@ -380,6 +381,7 @@ class APIBuilder extends Builder { fields.map( (String key) { final String name = ReCase(key).camelCase; + return '$name: $name ?? this.$name'; }, ).join(', '), @@ -388,40 +390,45 @@ class APIBuilder extends Builder { ..write('${_getSupperClassAssignments(schemaType)},);'); } - static String _getSuperClassParameters(String? schemaType) { + static String _getSuperClassParameters(String schemaType) { final Map superClassFields = _getSuperClassFields(schemaType); - return superClassFields.keys - .map((String key) => - '${typeMap[superClassFields[key]!]} ${ReCase(key).camelCase}') - .join(', '); + final Iterable parameters = superClassFields.keys.map((String key) { + final String type = typeMap[superClassFields[key]!] ?? 'dynamic'; + final String parameterName = ReCase(key).camelCase; + + return '$type $parameterName'; + }); + + return parameters.join(', '); } - static String _getSuperClassCallParameters( + static String _getSuperClassConstructorParameters( String schemaType, String methodName, ) { - final StringBuffer superCallParameters = StringBuffer(); + final Map superClassFields = + _getSuperClassFields(schemaType); + final StringBuffer superClassParameters = StringBuffer(); if (schemaType == 'send') { - superCallParameters.write('msgType: \'$methodName\','); + superClassParameters.write('super.msgType = \'$methodName\', '); } - superCallParameters.write(_getSuperClassFields(schemaType).keys.map( - (String key) { - final String parameterName = ReCase(key).camelCase; - return '$parameterName: $parameterName'; - }, - ).join(', ')); + final Iterable parameters = superClassFields.keys + .map((String key) => 'super.${ReCase(key).camelCase}'); - return superCallParameters.toString(); + superClassParameters.write(parameters.join(', ')); + + return superClassParameters.toString(); } static String _getSupperClassAssignments(String schemaType) => _getSuperClassFields(schemaType).keys.map( (String key) { final String propertyName = ReCase(key).camelCase; + return '$propertyName: $propertyName ?? this.$propertyName'; }, ).join(', '); diff --git a/lib/tools/schema_parser/helpers/constructor_helper.dart b/lib/tools/schema_parser/helpers/constructor_helper.dart index 38842d76de..1346bab9a9 100644 --- a/lib/tools/schema_parser/helpers/constructor_helper.dart +++ b/lib/tools/schema_parser/helpers/constructor_helper.dart @@ -23,32 +23,14 @@ StringBuffer _generateConstructor( } for (final SchemaModel model in children) { - final String typePostfix = model.classType == 'dynamic' - ? '' - : model.isRequired - ? '' - : '?'; - result ..write('${model.isRequired ? 'required' : ''} ') ..write( - isSubclass - ? '${model.classType}$typePostfix ${model.fieldName},' - : 'this.${model.fieldName},', + isSubclass ? 'super.${model.fieldName},' : 'this.${model.fieldName},', ); } - if (isSubclass) { - result.write('}) : super('); - - for (final SchemaModel model in children) { - result.write('${model.fieldName}: ${model.fieldName},'); - } - - result.write(');'); - } else { - result.write('});'); - } + result.write('});'); return result; } diff --git a/lib/widgets/snack_bar/snack_bar.dart b/lib/widgets/snack_bar/snack_bar.dart index 04b1ea6fb8..2e110c84eb 100644 --- a/lib/widgets/snack_bar/snack_bar.dart +++ b/lib/widgets/snack_bar/snack_bar.dart @@ -51,7 +51,7 @@ class SnackBarNotification { /// shows appropriate snack bar based on the [position] specified void show() { - WidgetsBinding.instance!.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) { if (position == SnackBarPosition.bottom) { ScaffoldMessenger.of(context).showSnackBar( _buildSnackBar(), diff --git a/lib/widgets/snack_bar/top_snack_bar/top_snack_bar.dart b/lib/widgets/snack_bar/top_snack_bar/top_snack_bar.dart index 3bbff9f37e..0b9a1e0657 100644 --- a/lib/widgets/snack_bar/top_snack_bar/top_snack_bar.dart +++ b/lib/widgets/snack_bar/top_snack_bar/top_snack_bar.dart @@ -55,7 +55,7 @@ class TopSnackBar { /// Adds [_overlayEntry] to the Overlay void addToOverlay() { - WidgetsBinding.instance!.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) { Overlay.of(context)!.insert(_overlayEntry); snackController.addStatusListener((AnimationStatus status) { if (status == AnimationStatus.dismissed) { diff --git a/lib/widgets/snack_bar/top_snack_bar/top_snack_bar_widget.dart b/lib/widgets/snack_bar/top_snack_bar/top_snack_bar_widget.dart index bef3b82396..7da4440a67 100644 --- a/lib/widgets/snack_bar/top_snack_bar/top_snack_bar_widget.dart +++ b/lib/widgets/snack_bar/top_snack_bar/top_snack_bar_widget.dart @@ -57,7 +57,7 @@ class _TopSnackBarWidgetState extends State { _dismissible = widget.dismissible ?? true; _duration = widget.duration ?? const Duration(seconds: 2); - WidgetsBinding.instance!.addPostFrameCallback((_) => _calculateSizes()); + WidgetsBinding.instance.addPostFrameCallback((_) => _calculateSizes()); widget.snackAnimationController.addListener(() { setState(() {}); diff --git a/pubspec.yaml b/pubspec.yaml index 0babfac96b..4564a17227 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,26 +7,26 @@ homepage: https://developers.binary.com publish_to: "none" environment: - sdk: ">=2.12.0 <3.0.0" + sdk: ">=2.17.0 <3.0.0" dependencies: flutter: sdk: flutter - build: ^2.3.0 + build: ^2.3.1 dart_style: ^2.2.1 equatable: ^2.0.3 flutter_bloc: ^7.0.0 http: ^0.13.4 - intl: ^0.17.0 - meta: ^1.7.0 + intl: ^0.18.0 + meta: ^1.8.0 recase: ^4.0.0 rxdart: ^0.27.4 web_socket_channel: ^2.2.0 - collection: ^1.15.0 + collection: ^1.16.0 device_info: ^2.0.3 package_info: ^2.0.2 - connectivity_plus: 2.3.9 + connectivity_plus: ^3.0.3 dev_dependencies: flutter_test: @@ -35,7 +35,7 @@ dev_dependencies: bloc_test: ^8.0.0 code_builder: ^4.1.0 build_config: ^1.0.0 - build_runner: ^2.1.11 + build_runner: ^2.3.0 build_test: ^2.1.5 json_schema2: ^2.0.2 path: ^1.8.0 From 9d6e5707b0d5792a1cf73a1bfac4669f4f753294 Mon Sep 17 00:00:00 2001 From: sahani-deriv <125638269+sahani-deriv@users.noreply.github.com> Date: Wed, 19 Apr 2023 10:10:27 +0800 Subject: [PATCH 02/64] sahani/upgrade_deriv_api_to_flutter_version_3 (#251) - upgrade deriv api to flutter version 3 --- .../active_symbols/active_symbols_bloc.dart | 59 ++++++++++-------- .../available_contracts_bloc.dart | 61 +++++++++++-------- .../price_proposal/price_proposal_bloc.dart | 41 +++++++------ example/lib/blocs/ticks/ticks_bloc.dart | 39 ++++++------ example/pubspec.yaml | 4 +- lib/api/exceptions/exceptions.dart | 1 - lib/helpers/miscellaneous_helper.dart | 4 +- .../top_snack_bar/top_snack_bar.dart | 2 +- pubspec.yaml | 20 +++--- 9 files changed, 128 insertions(+), 103 deletions(-) diff --git a/example/lib/blocs/active_symbols/active_symbols_bloc.dart b/example/lib/blocs/active_symbols/active_symbols_bloc.dart index 10201adfb5..0375e7f75d 100644 --- a/example/lib/blocs/active_symbols/active_symbols_bloc.dart +++ b/example/lib/blocs/active_symbols/active_symbols_bloc.dart @@ -11,31 +11,40 @@ part 'active_symbols_state.dart'; /// ActiveSymbolsBloc class ActiveSymbolsBloc extends Bloc { /// ActiveSymbolsBloc initializer - ActiveSymbolsBloc() : super(ActiveSymbolsLoading()); - - @override - Stream mapEventToState(ActiveSymbolsEvent event) async* { - if (event is FetchActiveSymbols) { - yield ActiveSymbolsLoading(); - - try { - final ActiveSymbolsResponse symbols = await _fetchActiveSymbols(); - yield ActiveSymbolsLoaded(activeSymbols: symbols.activeSymbols!); - } on ActiveSymbolsException catch (error) { - yield ActiveSymbolsError(error.message); - } - } else if (event is SelectActiveSymbol) { - if (state is ActiveSymbolsLoaded) { - final ActiveSymbolsLoaded loadedState = state as ActiveSymbolsLoaded; - - yield ActiveSymbolsLoaded( - activeSymbols: loadedState.activeSymbols, - selectedSymbol: loadedState.activeSymbols[event.index], - ); - } else { - yield ActiveSymbolsLoading(); - add(FetchActiveSymbols()); - } + ActiveSymbolsBloc() : super(ActiveSymbolsLoading()) { + on( + (FetchActiveSymbols event, Emitter emit) => + _handleFetchActiveSymbols(event, emit)); + + on( + (SelectActiveSymbol event, Emitter emit) => + _handleSelectActiveSymbol(event, emit)); + } + + Future _handleFetchActiveSymbols( + FetchActiveSymbols event, Emitter emit) async { + emit(ActiveSymbolsLoading()); + + try { + final ActiveSymbolsResponse symbols = await _fetchActiveSymbols(); + emit(ActiveSymbolsLoaded(activeSymbols: symbols.activeSymbols!)); + } on ActiveSymbolsException catch (error) { + emit(ActiveSymbolsError(error.message)); + } + } + + Future _handleSelectActiveSymbol( + SelectActiveSymbol event, Emitter emit) async { + if (state is ActiveSymbolsLoaded) { + final ActiveSymbolsLoaded loadedState = state as ActiveSymbolsLoaded; + + emit(ActiveSymbolsLoaded( + activeSymbols: loadedState.activeSymbols, + selectedSymbol: loadedState.activeSymbols[event.index], + )); + } else { + emit(ActiveSymbolsLoading()); + add(FetchActiveSymbols()); } } diff --git a/example/lib/blocs/available_contracts/available_contracts_bloc.dart b/example/lib/blocs/available_contracts/available_contracts_bloc.dart index a9a4dfc211..f9cb225f65 100644 --- a/example/lib/blocs/available_contracts/available_contracts_bloc.dart +++ b/example/lib/blocs/available_contracts/available_contracts_bloc.dart @@ -26,36 +26,47 @@ class AvailableContractsBloc ); } }); + + on((FetchAvailableContracts event, + Emitter emit) => + _handleFetchAvailableContracts(event, emit)); + + on( + (SelectContract event, Emitter emit) => + _handleSelectContract(event, emit)); } - @override - Stream mapEventToState( - AvailableContractsEvent event, - ) async* { - if (event is FetchAvailableContracts) { - yield AvailableContractsLoading(); + Future _handleFetchAvailableContracts( + FetchAvailableContracts event, + Emitter emit, + ) async { + emit(AvailableContractsLoading()); - try { - final ContractsForResponse contracts = - await _fetchAvailableContracts(event.activeSymbol); + try { + final ContractsForResponse contracts = + await _fetchAvailableContracts(event.activeSymbol); - yield AvailableContractsLoaded(contracts: contracts.contractsFor!); - } on ContractsForSymbolException catch (error) { - yield AvailableContractsError(error.message); - } - } else if (event is SelectContract) { - if (state is AvailableContractsLoaded) { - final AvailableContractsLoaded loadedState = - state as AvailableContractsLoaded; + emit(AvailableContractsLoaded(contracts: contracts.contractsFor!)); + } on ContractsForSymbolException catch (error) { + emit(AvailableContractsError(error.message)); + } + } - yield AvailableContractsLoaded( - contracts: loadedState.contracts, - selectedContract: loadedState.contracts.available[event.index], - ); - } else { - yield AvailableContractsLoading(); - add(FetchAvailableContracts()); - } + void _handleSelectContract( + SelectContract event, + Emitter emit, + ) { + if (state is AvailableContractsLoaded) { + final AvailableContractsLoaded loadedState = + state as AvailableContractsLoaded; + + emit(AvailableContractsLoaded( + contracts: loadedState.contracts, + selectedContract: loadedState.contracts.available[event.index], + )); + } else { + emit(AvailableContractsLoading()); + add(FetchAvailableContracts()); } } diff --git a/example/lib/blocs/price_proposal/price_proposal_bloc.dart b/example/lib/blocs/price_proposal/price_proposal_bloc.dart index 60320abc7e..9b57971e76 100644 --- a/example/lib/blocs/price_proposal/price_proposal_bloc.dart +++ b/example/lib/blocs/price_proposal/price_proposal_bloc.dart @@ -22,28 +22,33 @@ class PriceProposalBloc extends Bloc { add(SubscribeProposal(state.selectedContract)); } }); + + on( + (SubscribeProposal event, Emitter emit) => + _handleSubscribeProposal(event, emit)); + + on( + (YieldProposalLoaded event, Emitter emit) => + emit(PriceProposalLoaded(event.proposal.proposal))); + + on((YieldError event, Emitter emit) => + emit(PriceProposalError(event.message))); } - @override - Stream mapEventToState( - PriceProposalEvent event, - ) async* { - if (event is SubscribeProposal) { - yield PriceProposalLoading(); + Future _handleSubscribeProposal( + SubscribeProposal event, + Emitter emit, + ) async { + emit(PriceProposalLoading()); - await _unsubscribeProposal(); + await _unsubscribeProposal(); - _subscribeProposal(event) - .handleError((dynamic error) => error is ContractOperationException - ? add(YieldError(error.message)) - : add(YieldError(error.toString()))) - .listen((ProposalResponse? proposal) => - add(YieldProposalLoaded(proposal!))); - } else if (event is YieldProposalLoaded) { - yield PriceProposalLoaded(event.proposal.proposal); - } else if (event is YieldError) { - yield PriceProposalError(event.message); - } + _subscribeProposal(event) + .handleError((dynamic error) => error is ContractOperationException + ? add(YieldError(error.message)) + : add(YieldError(error.toString()))) + .listen((ProposalResponse? proposal) => + add(YieldProposalLoaded(proposal!))); } Stream _subscribeProposal(SubscribeProposal event) => diff --git a/example/lib/blocs/ticks/ticks_bloc.dart b/example/lib/blocs/ticks/ticks_bloc.dart index 14b4b067da..02a3329701 100644 --- a/example/lib/blocs/ticks/ticks_bloc.dart +++ b/example/lib/blocs/ticks/ticks_bloc.dart @@ -22,27 +22,28 @@ class TicksBloc extends Bloc { add(SubscribeTicks(activeSymbolsState.selectedSymbol)); } }); + + on((SubscribeTicks event, Emitter emit) => + _handleSubscribeTicks(event, emit)); + + on((YieldTick event, Emitter emit) => + emit(TicksLoaded(event.tick?.tick))); + + on((YieldError event, Emitter emit) => + emit(TicksError(event.message))); } - @override - Stream mapEventToState( - TicksEvent event, - ) async* { - if (event is SubscribeTicks) { - yield TicksLoading(); - - await _unsubscribeTick(); - - _subscribeTick(event.selectedSymbol!) - .handleError((dynamic error) => error is TickException - ? add(YieldError(error.message)) - : add(YieldError(error.toString()))) - .listen((TicksResponse? tick) => add(YieldTick(tick))); - } else if (event is YieldTick) { - yield TicksLoaded(event.tick?.tick); - } else if (event is YieldError) { - yield TicksError(event.message); - } + Future _handleSubscribeTicks( + SubscribeTicks event, Emitter emit) async { + emit(TicksLoading()); + + await _unsubscribeTick(); + + _subscribeTick(event.selectedSymbol!) + .handleError((dynamic error) => error is TickException + ? add(YieldError(error.message)) + : add(YieldError(error.toString()))) + .listen((TicksResponse? tick) => add(YieldTick(tick))); } Stream _subscribeTick(ActiveSymbolsItem selectedSymbol) => diff --git a/example/pubspec.yaml b/example/pubspec.yaml index e3f31c3d38..86a830ab48 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -9,8 +9,8 @@ dependencies: flutter: sdk: flutter - rxdart: ^0.27.4 - flutter_bloc: ^7.0.0 + rxdart: ^0.27.7 + flutter_bloc: ^8.1.2 dev_dependencies: flutter_test: diff --git a/lib/api/exceptions/exceptions.dart b/lib/api/exceptions/exceptions.dart index 82d3e82e47..8e452fb9f9 100644 --- a/lib/api/exceptions/exceptions.dart +++ b/lib/api/exceptions/exceptions.dart @@ -24,7 +24,6 @@ export 'landing_company_exception.dart'; export 'mt5_exception.dart'; export 'new_account_exception.dart'; export 'p2p_advert_exception.dart'; -export 'p2p_advert_exception.dart'; export 'p2p_advertiser_exception.dart'; export 'p2p_advertiser_stats_exception.dart'; export 'p2p_chat_exception.dart'; diff --git a/lib/helpers/miscellaneous_helper.dart b/lib/helpers/miscellaneous_helper.dart index ebf571ab18..6d75cf53df 100644 --- a/lib/helpers/miscellaneous_helper.dart +++ b/lib/helpers/miscellaneous_helper.dart @@ -1,12 +1,12 @@ import 'dart:io'; -import 'package:device_info/device_info.dart'; +import 'package:device_info_plus/device_info_plus.dart'; import 'package:flutter_deriv_api/api/exceptions/api_base_exception.dart'; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/basic_api/response.dart'; -import 'package:package_info/package_info.dart'; +import 'package:package_info_plus/package_info_plus.dart'; /// Parses the [url] and gets the endpoint out of it String? parseWebSocketUrl(String? url, {bool isAuthUrl = false}) { diff --git a/lib/widgets/snack_bar/top_snack_bar/top_snack_bar.dart b/lib/widgets/snack_bar/top_snack_bar/top_snack_bar.dart index 0b9a1e0657..cb7baf06a5 100644 --- a/lib/widgets/snack_bar/top_snack_bar/top_snack_bar.dart +++ b/lib/widgets/snack_bar/top_snack_bar/top_snack_bar.dart @@ -56,7 +56,7 @@ class TopSnackBar { /// Adds [_overlayEntry] to the Overlay void addToOverlay() { WidgetsBinding.instance.addPostFrameCallback((_) { - Overlay.of(context)!.insert(_overlayEntry); + Overlay.of(context).insert(_overlayEntry); snackController.addStatusListener((AnimationStatus status) { if (status == AnimationStatus.dismissed) { _overlayEntry.remove(); diff --git a/pubspec.yaml b/pubspec.yaml index 67aed53900..46b2d01023 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,7 +7,8 @@ homepage: https://developers.binary.com publish_to: "none" environment: - sdk: ">=2.17.0 <3.0.0" + sdk: ">=2.19.5 <3.0.0" + flutter: "3.7.8" dependencies: flutter: @@ -20,25 +21,24 @@ dependencies: ref: dev build: ^2.3.1 - dart_style: ^2.2.1 + dart_style: ^2.3.0 equatable: ^2.0.3 - flutter_bloc: ^7.0.0 + flutter_bloc: ^8.1.2 http: ^0.13.4 - intl: ^0.18.0 + intl: ^0.17.0 meta: ^1.8.0 recase: ^4.0.0 - rxdart: ^0.27.4 - web_socket_channel: ^2.2.0 - collection: ^1.16.0 - device_info: ^2.0.3 - package_info: ^2.0.2 + rxdart: ^0.27.7 + web_socket_channel: ^2.3.0 + device_info_plus: ^8.1.0 + package_info_plus: ^3.0.3 connectivity_plus: ^3.0.3 dev_dependencies: flutter_test: sdk: flutter - bloc_test: ^8.0.0 + bloc_test: ^9.1.1 code_builder: ^4.1.0 build_config: ^1.0.0 build_runner: ^2.3.0 From 8ba69023aa5f14eee136078a9d5a66ffb4ad5bf7 Mon Sep 17 00:00:00 2001 From: Bassam El Obeid <127500305+bassam-deriv@users.noreply.github.com> Date: Thu, 25 May 2023 06:30:40 +0400 Subject: [PATCH 03/64] bassam/upgrade_to_flutter_3.10.0 (#254) - upgrade to flutter 3.10.0 --- analysis_options.yaml | 7 +++---- api_builder.dart | 2 +- pubspec.yaml | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index b949a79255..b8565f8cb7 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -2,9 +2,9 @@ analyzer: exclude: - lib/basic_api/generated/api.dart - strong-mode: - implicit-dynamic: false - + language: + strict-raw-types: true + errors: todo: ignore missing_required_param: warning @@ -92,7 +92,6 @@ linter: - prefer_const_literals_to_create_immutables - prefer_constructors_over_static_methods - prefer_contains - - prefer_equal_for_default_values - prefer_expression_function_bodies # https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods - prefer_final_fields - prefer_final_in_for_each diff --git a/api_builder.dart b/api_builder.dart index 3c424add6f..d6fe0154b4 100644 --- a/api_builder.dart +++ b/api_builder.dart @@ -465,7 +465,7 @@ class APIBuilder extends Builder { } } -class GeneratedResponseJson extends Comparable { +class GeneratedResponseJson implements Comparable { GeneratedResponseJson({ this.msgType, this.fileName, diff --git a/pubspec.yaml b/pubspec.yaml index 46b2d01023..0c9949dc29 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,8 +7,8 @@ homepage: https://developers.binary.com publish_to: "none" environment: - sdk: ">=2.19.5 <3.0.0" - flutter: "3.7.8" + sdk: ">=3.0.0" + flutter: ">=3.10.0" dependencies: flutter: @@ -25,7 +25,7 @@ dependencies: equatable: ^2.0.3 flutter_bloc: ^8.1.2 http: ^0.13.4 - intl: ^0.17.0 + intl: ^0.18.0 meta: ^1.8.0 recase: ^4.0.0 rxdart: ^0.27.7 From d0facdf0ad50cdc0255e576ecebbcce29151199b Mon Sep 17 00:00:00 2001 From: Bassam El Obeid <127500305+bassam-deriv@users.noreply.github.com> Date: Thu, 1 Jun 2023 10:44:32 +0400 Subject: [PATCH 04/64] bassam/migrate_flutter_version_to_3_10 (#261) - migrate flutter version to 3.10.0 From 3db0b4adecf2308bf0c60aa4630634f1fc5d1df1 Mon Sep 17 00:00:00 2001 From: Hamed Rezaee <57184669+hamed-deriv@users.noreply.github.com> Date: Thu, 1 Jun 2023 15:03:25 +0800 Subject: [PATCH 05/64] hamed/update_dependencies (#264) - update dependencies --- example/pubspec.yaml | 3 ++- pubspec.yaml | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 86a830ab48..7839397ea0 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -3,7 +3,8 @@ description: Demonstrates how to use the flutter_deriv_api plugin. publish_to: "none" environment: - sdk: ">=2.12.0 <3.0.0" + sdk: ">=3.0.0" + flutter: "3.10.2" dependencies: flutter: diff --git a/pubspec.yaml b/pubspec.yaml index 0c9949dc29..9612ac8ed5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -8,7 +8,7 @@ publish_to: "none" environment: sdk: ">=3.0.0" - flutter: ">=3.10.0" + flutter: "3.10.2" dependencies: flutter: @@ -18,7 +18,7 @@ dependencies: git: url: git@github.com:regentmarkets/flutter-deriv-packages.git path: packages/deriv_dependency_injector - ref: dev + ref: flutter-version-3 build: ^2.3.1 dart_style: ^2.3.0 From 198ac7c9dfa3114eae647efa5347d0d3403368c9 Mon Sep 17 00:00:00 2001 From: sahani-deriv <125638269+sahani-deriv@users.noreply.github.com> Date: Mon, 12 Jun 2023 09:50:21 +0800 Subject: [PATCH 06/64] sahani/ upgrade_kotlin_version (#266) - upgrade kotlin version --- android/build.gradle | 4 ++-- android/gradle/wrapper/gradle-wrapper.properties | 2 +- example/android/app/build.gradle | 2 +- example/android/build.gradle | 6 +++--- example/android/gradle/wrapper/gradle-wrapper.properties | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index a1d9341b0f..aa8bae7a4b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -2,14 +2,14 @@ group 'com.deriv.flutter_deriv_api' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.7.10' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:7.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 019065d1d6..ceccc3a854 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index fad92a4f20..94759d7825 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 28 + compileSdkVersion 33 sourceSets { main.java.srcDirs += 'src/main/kotlin' diff --git a/example/android/build.gradle b/example/android/build.gradle index 3100ad2d55..e0e4f0a765 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.7.10' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:7.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 296b146b73..cfe88f6904 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip From 11a07acc9cda14617fce6cd6a1ff20f963cdd846 Mon Sep 17 00:00:00 2001 From: Hamed Rezaee <57184669+hamed-deriv@users.noreply.github.com> Date: Thu, 15 Jun 2023 11:35:08 +0800 Subject: [PATCH 07/64] hamed/improve_test_coverage (#265) - improve test coverage --- .../active_symbols/active_symbols_bloc.dart | 2 +- .../available_contracts_bloc.dart | 2 +- .../price_proposal/price_proposal_bloc.dart | 2 +- example/lib/blocs/ticks/ticks_bloc.dart | 2 +- .../account_currency_exception.dart | 11 - lib/api/exceptions/account_exception.dart | 10 - .../exceptions/account_limits_exception.dart | 11 - .../account_settings_exception.dart | 11 - .../exceptions/account_status_exception.dart | 11 - .../exceptions/active_symbols_exception.dart | 11 - lib/api/exceptions/api_token_exception.dart | 11 - lib/api/exceptions/app_exception.dart | 10 - lib/api/exceptions/asset_index_exception.dart | 11 - lib/api/exceptions/authorize_exception.dart | 11 - lib/api/exceptions/balance_exception.dart | 11 - ...exception.dart => base_api_exception.dart} | 12 +- lib/api/exceptions/cashier_exception.dart | 10 - lib/api/exceptions/common_exception.dart | 10 - lib/api/exceptions/contract_exception.dart | 10 - .../contract_for_symbol_exception.dart | 10 - .../contract_operations_exception.dart | 10 - .../exceptions/copy_trading_exception.dart | 11 - lib/api/exceptions/exceptions.dart | 51 +---- lib/api/exceptions/exchange_exception.dart | 11 - .../financial_assessment_exception.dart | 11 - lib/api/exceptions/forget_exception.dart | 11 - .../exceptions/landing_company_exception.dart | 11 - lib/api/exceptions/mt5_exception.dart | 10 - lib/api/exceptions/new_account_exception.dart | 11 - lib/api/exceptions/p2p_advert_exception.dart | 11 - .../exceptions/p2p_advertiser_exception.dart | 11 - .../p2p_advertiser_stats_exception.dart | 11 - lib/api/exceptions/p2p_chat_exception.dart | 11 - lib/api/exceptions/p2p_exception.dart | 10 - lib/api/exceptions/p2p_order_exception.dart | 11 - .../exceptions/payment_agent_exception.dart | 11 - lib/api/exceptions/payment_exception.dart | 11 - .../exceptions/payout_currency_exception.dart | 12 - lib/api/exceptions/ping_exception.dart | 11 - lib/api/exceptions/portfolio_exception.dart | 11 - .../exceptions/profit_table_exception.dart | 11 - .../exceptions/reality_check_exception.dart | 11 - lib/api/exceptions/residence_exception.dart | 11 - .../exceptions/self_exclusion_exception.dart | 11 - lib/api/exceptions/server_time_exception.dart | 11 - lib/api/exceptions/state_exception.dart | 11 - lib/api/exceptions/statement_exception.dart | 11 - lib/api/exceptions/tick_exception.dart | 11 - .../exceptions/top_up_virtual_exception.dart | 11 - lib/api/exceptions/trading_exception.dart | 11 - .../trading_platform_exception.dart | 11 - .../exceptions/transactions_exception.dart | 10 - lib/api/exceptions/transfer_exception.dart | 11 - lib/api/exceptions/user_exception.dart | 10 - .../exceptions/website_status_exception.dart | 11 - lib/api/manually/ohlc_response_result.dart | 4 +- lib/api/manually/tick.dart | 8 +- lib/api/manually/tick_base.dart | 4 +- .../manually/tick_history_subscription.dart | 4 +- .../active_symbols_response_result.dart | 4 +- .../response/api_token_response_result.dart | 8 +- .../response/app_delete_response_result.dart | 4 +- lib/api/response/app_get_response_result.dart | 8 +- .../response/app_list_response_result.dart | 4 +- .../app_markup_details_response_result.dart | 4 +- .../app_register_response_result.dart | 4 +- .../response/app_update_response_result.dart | 4 +- .../response/asset_index_response_result.dart | 4 +- .../response/authorize_response_result.dart | 17 +- lib/api/response/balance_response_result.dart | 16 +- lib/api/response/buy_response_result.dart | 15 +- lib/api/response/cancel_response_result.dart | 4 +- lib/api/response/cashier_response_result.dart | 2 +- ...ntract_update_history_response_result.dart | 4 +- .../contract_update_response_result.dart | 4 +- .../contracts_for_response_result.dart | 4 +- .../response/copy_start_response_result.dart | 4 +- .../response/copy_stop_response_result.dart | 4 +- .../copytrading_list_response_result.dart | 4 +- ...opytrading_statistics_response_result.dart | 4 +- .../exchange_rates_response_result.dart | 6 +- .../response/forget_all_response_result.dart | 4 +- lib/api/response/forget_response_result.dart | 4 +- .../get_account_status_response_result.dart | 6 +- ..._financial_assessment_response_result.dart | 4 +- .../response/get_limits_response_result.dart | 4 +- .../get_self_exclusion_response_result.dart | 12 +- .../get_settings_response_result.dart | 12 +- .../landing_company_response_result.dart | 8 +- .../login_history_response_result.dart | 4 +- lib/api/response/logout_response_result.dart | 6 +- .../response/mt5_deposit_response_result.dart | 4 +- .../mt5_get_settings_response_result.dart | 4 +- .../mt5_login_list_response_result.dart | 4 +- .../mt5_new_account_response_result.dart | 16 +- .../mt5_password_change_response_result.dart | 4 +- .../mt5_password_check_response_result.dart | 4 +- .../mt5_password_reset_response_result.dart | 4 +- .../mt5_withdrawal_response_result.dart | 4 +- .../new_account_real_response_result.dart | 4 +- .../new_account_virtual_response_result.dart | 4 +- .../response/oauth_apps_response_result.dart | 4 +- .../p2p_advert_create_response_result.dart | 8 +- .../p2p_advert_info_response_result.dart | 26 +-- .../p2p_advert_list_response_result.dart | 8 +- .../p2p_advert_update_response_result.dart | 6 +- ...2p_advertiser_adverts_response_result.dart | 2 +- ...p2p_advertiser_create_response_result.dart | 4 +- .../p2p_advertiser_info_response_result.dart | 14 +- .../p2p_advertiser_list_response_result.dart | 2 +- ...tiser_payment_methods_response_result.dart | 6 +- ..._advertiser_relations_response_result.dart | 6 +- ...p2p_advertiser_update_response_result.dart | 2 +- .../p2p_chat_create_response_result.dart | 2 +- .../p2p_order_cancel_response_result.dart | 6 +- .../p2p_order_confirm_response_result.dart | 6 +- .../p2p_order_create_response_result.dart | 8 +- .../p2p_order_dispute_response_result.dart | 6 +- .../p2p_order_info_response_result.dart | 32 +-- .../p2p_order_list_response_result.dart | 10 +- .../p2p_order_review_response_result.dart | 6 +- .../p2p_payment_methods_response_result.dart | 2 +- .../payment_methods_response_result.dart | 4 +- .../paymentagent_list_response_result.dart | 4 +- ...paymentagent_transfer_response_result.dart | 4 +- ...paymentagent_withdraw_response_result.dart | 4 +- .../payout_currencies_response_result.dart | 4 +- lib/api/response/ping_response_result.dart | 6 +- .../response/portfolio_response_result.dart | 4 +- .../profit_table_response_result.dart | 4 +- ...roposal_open_contract_response_result.dart | 21 +- .../response/proposal_response_result.dart | 24 +- .../reality_check_response_result.dart | 4 +- .../reset_password_response_result.dart | 2 +- .../residence_list_response_result.dart | 4 +- .../revoke_oauth_app_response_result.dart | 4 +- lib/api/response/sell_response_result.dart | 8 +- .../service_token_response_result.dart | 6 +- .../set_account_currency_response_result.dart | 4 +- ..._financial_assessment_response_result.dart | 4 +- .../set_self_exclusion_response_result.dart | 4 +- .../set_settings_response_result.dart | 4 +- .../response/statement_response_result.dart | 4 +- .../response/states_list_response_result.dart | 4 +- .../ticks_history_response_result.dart | 10 +- lib/api/response/ticks_response_result.dart | 8 +- lib/api/response/time_response_result.dart | 2 +- .../tnc_approval_response_result.dart | 4 +- .../topup_virtual_response_result.dart | 4 +- .../trading_durations_response_result.dart | 4 +- ...ing_platform_accounts_response_result.dart | 4 +- ...ding_platform_deposit_response_result.dart | 4 +- ..._platform_new_account_response_result.dart | 4 +- .../trading_servers_response_result.dart | 4 +- .../trading_times_response_result.dart | 4 +- .../response/transaction_response_result.dart | 12 +- ...sfer_between_accounts_response_result.dart | 4 +- .../verify_email_response_result.dart | 4 +- .../website_status_response_result.dart | 22 +- .../active_symbols_receive_methods.json | 2 +- .../methods/api_token_receive_methods.json | 2 +- .../methods/app_delete_receive_methods.json | 2 +- .../methods/app_get_receive_methods.json | 2 +- .../methods/app_list_receive_methods.json | 2 +- .../app_markup_details_receive_methods.json | 2 +- .../methods/app_register_receive_methods.json | 2 +- .../methods/app_update_receive_methods.json | 2 +- .../methods/asset_index_receive_methods.json | 2 +- .../methods/authorize_receive_methods.json | 2 +- .../methods/balance_receive_methods.json | 2 +- .../methods/buy_receive_methods.json | 2 +- .../methods/cancel_receive_methods.json | 2 +- .../methods/cashier_receive_methods.json | 2 +- ...ntract_update_history_receive_methods.json | 2 +- .../contract_update_receive_methods.json | 2 +- .../contracts_for_receive_methods.json | 2 +- .../methods/copy_start_receive_methods.json | 2 +- .../methods/copy_stop_receive_methods.json | 2 +- .../copytrading_list_receive_methods.json | 2 +- ...opytrading_statistics_receive_methods.json | 2 +- .../exchange_rates_receive_methods.json | 2 +- .../methods/forget_all_receive_methods.json | 2 +- .../methods/forget_receive_methods.json | 2 +- .../get_account_status_receive_methods.json | 2 +- ..._financial_assessment_receive_methods.json | 2 +- .../methods/get_limits_receive_methods.json | 2 +- .../get_self_exclusion_receive_methods.json | 2 +- .../methods/get_settings_receive_methods.json | 2 +- .../landing_company_receive_methods.json | 2 +- .../login_history_receive_methods.json | 2 +- .../methods/logout_receive_methods.json | 2 +- .../methods/mt5_deposit_receive_methods.json | 2 +- .../mt5_get_settings_receive_methods.json | 2 +- .../mt5_login_list_receive_methods.json | 2 +- .../mt5_new_account_receive_methods.json | 2 +- .../mt5_password_change_receive_methods.json | 2 +- .../mt5_password_check_receive_methods.json | 2 +- .../mt5_password_reset_receive_methods.json | 2 +- .../mt5_withdrawal_receive_methods.json | 2 +- .../new_account_real_receive_methods.json | 2 +- .../new_account_virtual_receive_methods.json | 2 +- .../methods/oauth_apps_receive_methods.json | 2 +- .../p2p_advert_create_receive_methods.json | 2 +- .../p2p_advert_info_receive_methods.json | 2 +- .../p2p_advert_list_receive_methods.json | 2 +- .../p2p_advert_update_receive_methods.json | 2 +- ...2p_advertiser_adverts_receive_methods.json | 2 +- ...p2p_advertiser_create_receive_methods.json | 2 +- .../p2p_advertiser_info_receive_methods.json | 2 +- .../p2p_advertiser_list_receive_methods.json | 2 +- ...tiser_payment_methods_receive_methods.json | 2 +- ..._advertiser_relations_receive_methods.json | 2 +- ...p2p_advertiser_update_receive_methods.json | 2 +- .../p2p_chat_create_receive_methods.json | 2 +- .../p2p_order_cancel_receive_methods.json | 2 +- .../p2p_order_confirm_receive_methods.json | 2 +- .../p2p_order_create_receive_methods.json | 2 +- .../p2p_order_dispute_receive_methods.json | 2 +- .../p2p_order_info_receive_methods.json | 2 +- .../p2p_order_list_receive_methods.json | 2 +- .../p2p_order_review_receive_methods.json | 2 +- .../p2p_payment_methods_receive_methods.json | 2 +- .../payment_methods_receive_methods.json | 2 +- .../paymentagent_list_receive_methods.json | 2 +- ...paymentagent_transfer_receive_methods.json | 2 +- ...paymentagent_withdraw_receive_methods.json | 2 +- .../payout_currencies_receive_methods.json | 2 +- .../methods/ping_receive_methods.json | 2 +- .../methods/portfolio_receive_methods.json | 2 +- .../methods/profit_table_receive_methods.json | 2 +- ...roposal_open_contract_receive_methods.json | 2 +- .../methods/proposal_receive_methods.json | 2 +- .../reality_check_receive_methods.json | 2 +- .../reset_password_receive_methods.json | 2 +- .../residence_list_receive_methods.json | 2 +- .../revoke_oauth_app_receive_methods.json | 2 +- .../methods/sell_receive_methods.json | 2 +- .../service_token_receive_methods.json | 2 +- .../set_account_currency_receive_methods.json | 2 +- ..._financial_assessment_receive_methods.json | 2 +- .../set_self_exclusion_receive_methods.json | 2 +- .../methods/set_settings_receive_methods.json | 2 +- .../methods/statement_receive_methods.json | 2 +- .../methods/states_list_receive_methods.json | 2 +- .../ticks_history_receive_methods.json | 2 +- .../methods/ticks_receive_methods.json | 2 +- .../methods/tnc_approval_receive_methods.json | 2 +- .../topup_virtual_receive_methods.json | 2 +- .../trading_durations_receive_methods.json | 2 +- ...ing_platform_accounts_receive_methods.json | 2 +- ...ding_platform_deposit_receive_methods.json | 2 +- ..._platform_new_account_receive_methods.json | 2 +- .../trading_servers_receive_methods.json | 2 +- .../trading_times_receive_methods.json | 2 +- .../methods/transaction_receive_methods.json | 2 +- ...sfer_between_accounts_receive_methods.json | 2 +- .../methods/verify_email_receive_methods.json | 2 +- .../website_status_receive_methods.json | 2 +- lib/helpers/miscellaneous_helper.dart | 4 +- .../exceptions/api_base_exception_test.dart | 46 ++++ test/helpers/boolean_helper_test.dart | 49 ++++ test/helpers/date_time_helper_test.dart | 120 ++++++++++ test/helpers/enum_helper_test.dart | 208 +++++++++++++++++ test/helpers/map_helper_test.dart | 104 +++++++++ test/helpers/number_helper_test.dart | 212 ++++++++++++++++++ .../api_manager_exception_test.dart | 26 +++ 266 files changed, 1208 insertions(+), 1018 deletions(-) delete mode 100644 lib/api/exceptions/account_currency_exception.dart delete mode 100644 lib/api/exceptions/account_exception.dart delete mode 100644 lib/api/exceptions/account_limits_exception.dart delete mode 100644 lib/api/exceptions/account_settings_exception.dart delete mode 100644 lib/api/exceptions/account_status_exception.dart delete mode 100644 lib/api/exceptions/active_symbols_exception.dart delete mode 100644 lib/api/exceptions/api_token_exception.dart delete mode 100644 lib/api/exceptions/app_exception.dart delete mode 100644 lib/api/exceptions/asset_index_exception.dart delete mode 100644 lib/api/exceptions/authorize_exception.dart delete mode 100644 lib/api/exceptions/balance_exception.dart rename lib/api/exceptions/{api_base_exception.dart => base_api_exception.dart} (73%) delete mode 100644 lib/api/exceptions/cashier_exception.dart delete mode 100644 lib/api/exceptions/common_exception.dart delete mode 100644 lib/api/exceptions/contract_exception.dart delete mode 100644 lib/api/exceptions/contract_for_symbol_exception.dart delete mode 100644 lib/api/exceptions/contract_operations_exception.dart delete mode 100644 lib/api/exceptions/copy_trading_exception.dart delete mode 100644 lib/api/exceptions/exchange_exception.dart delete mode 100644 lib/api/exceptions/financial_assessment_exception.dart delete mode 100644 lib/api/exceptions/forget_exception.dart delete mode 100644 lib/api/exceptions/landing_company_exception.dart delete mode 100644 lib/api/exceptions/mt5_exception.dart delete mode 100644 lib/api/exceptions/new_account_exception.dart delete mode 100644 lib/api/exceptions/p2p_advert_exception.dart delete mode 100644 lib/api/exceptions/p2p_advertiser_exception.dart delete mode 100644 lib/api/exceptions/p2p_advertiser_stats_exception.dart delete mode 100644 lib/api/exceptions/p2p_chat_exception.dart delete mode 100644 lib/api/exceptions/p2p_exception.dart delete mode 100644 lib/api/exceptions/p2p_order_exception.dart delete mode 100644 lib/api/exceptions/payment_agent_exception.dart delete mode 100644 lib/api/exceptions/payment_exception.dart delete mode 100644 lib/api/exceptions/payout_currency_exception.dart delete mode 100644 lib/api/exceptions/ping_exception.dart delete mode 100644 lib/api/exceptions/portfolio_exception.dart delete mode 100644 lib/api/exceptions/profit_table_exception.dart delete mode 100644 lib/api/exceptions/reality_check_exception.dart delete mode 100644 lib/api/exceptions/residence_exception.dart delete mode 100644 lib/api/exceptions/self_exclusion_exception.dart delete mode 100644 lib/api/exceptions/server_time_exception.dart delete mode 100644 lib/api/exceptions/state_exception.dart delete mode 100644 lib/api/exceptions/statement_exception.dart delete mode 100644 lib/api/exceptions/tick_exception.dart delete mode 100644 lib/api/exceptions/top_up_virtual_exception.dart delete mode 100644 lib/api/exceptions/trading_exception.dart delete mode 100644 lib/api/exceptions/trading_platform_exception.dart delete mode 100644 lib/api/exceptions/transactions_exception.dart delete mode 100644 lib/api/exceptions/transfer_exception.dart delete mode 100644 lib/api/exceptions/user_exception.dart delete mode 100644 lib/api/exceptions/website_status_exception.dart create mode 100644 test/api/exceptions/api_base_exception_test.dart create mode 100644 test/helpers/boolean_helper_test.dart create mode 100644 test/helpers/date_time_helper_test.dart create mode 100644 test/helpers/enum_helper_test.dart create mode 100644 test/helpers/map_helper_test.dart create mode 100644 test/helpers/number_helper_test.dart create mode 100644 test/services/connection/api_manager/exceptions/api_manager_exception_test.dart diff --git a/example/lib/blocs/active_symbols/active_symbols_bloc.dart b/example/lib/blocs/active_symbols/active_symbols_bloc.dart index 0375e7f75d..0d28ae0db2 100644 --- a/example/lib/blocs/active_symbols/active_symbols_bloc.dart +++ b/example/lib/blocs/active_symbols/active_symbols_bloc.dart @@ -28,7 +28,7 @@ class ActiveSymbolsBloc extends Bloc { try { final ActiveSymbolsResponse symbols = await _fetchActiveSymbols(); emit(ActiveSymbolsLoaded(activeSymbols: symbols.activeSymbols!)); - } on ActiveSymbolsException catch (error) { + } on BaseAPIException catch (error) { emit(ActiveSymbolsError(error.message)); } } diff --git a/example/lib/blocs/available_contracts/available_contracts_bloc.dart b/example/lib/blocs/available_contracts/available_contracts_bloc.dart index f9cb225f65..47e631784a 100644 --- a/example/lib/blocs/available_contracts/available_contracts_bloc.dart +++ b/example/lib/blocs/available_contracts/available_contracts_bloc.dart @@ -47,7 +47,7 @@ class AvailableContractsBloc await _fetchAvailableContracts(event.activeSymbol); emit(AvailableContractsLoaded(contracts: contracts.contractsFor!)); - } on ContractsForSymbolException catch (error) { + } on BaseAPIException catch (error) { emit(AvailableContractsError(error.message)); } } diff --git a/example/lib/blocs/price_proposal/price_proposal_bloc.dart b/example/lib/blocs/price_proposal/price_proposal_bloc.dart index 9b57971e76..485478b58c 100644 --- a/example/lib/blocs/price_proposal/price_proposal_bloc.dart +++ b/example/lib/blocs/price_proposal/price_proposal_bloc.dart @@ -44,7 +44,7 @@ class PriceProposalBloc extends Bloc { await _unsubscribeProposal(); _subscribeProposal(event) - .handleError((dynamic error) => error is ContractOperationException + .handleError((dynamic error) => error is BaseAPIException ? add(YieldError(error.message)) : add(YieldError(error.toString()))) .listen((ProposalResponse? proposal) => diff --git a/example/lib/blocs/ticks/ticks_bloc.dart b/example/lib/blocs/ticks/ticks_bloc.dart index 02a3329701..742dcdbc06 100644 --- a/example/lib/blocs/ticks/ticks_bloc.dart +++ b/example/lib/blocs/ticks/ticks_bloc.dart @@ -40,7 +40,7 @@ class TicksBloc extends Bloc { await _unsubscribeTick(); _subscribeTick(event.selectedSymbol!) - .handleError((dynamic error) => error is TickException + .handleError((dynamic error) => error is BaseAPIException ? add(YieldError(error.message)) : add(YieldError(error.toString()))) .listen((TicksResponse? tick) => add(YieldTick(tick))); diff --git a/lib/api/exceptions/account_currency_exception.dart b/lib/api/exceptions/account_currency_exception.dart deleted file mode 100644 index db459fb8ee..0000000000 --- a/lib/api/exceptions/account_currency_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Account currency exception class -class AccountCurrencyException extends AccountException { - /// Initializes - AccountCurrencyException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/account_exception.dart b/lib/api/exceptions/account_exception.dart deleted file mode 100644 index 3086fc8bd8..0000000000 --- a/lib/api/exceptions/account_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/api_base_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// Account exception -class AccountException extends APIBaseException { - /// Initializes - AccountException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/account_limits_exception.dart b/lib/api/exceptions/account_limits_exception.dart deleted file mode 100644 index 57d2b5d937..0000000000 --- a/lib/api/exceptions/account_limits_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Account limits exception class -class AccountLimitsException extends AccountException { - /// Initializes - AccountLimitsException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/account_settings_exception.dart b/lib/api/exceptions/account_settings_exception.dart deleted file mode 100644 index 1c889a4d16..0000000000 --- a/lib/api/exceptions/account_settings_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Account settings exception class -class AccountSettingsException extends AccountException { - /// Initializes - AccountSettingsException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/account_status_exception.dart b/lib/api/exceptions/account_status_exception.dart deleted file mode 100644 index 9ef720b435..0000000000 --- a/lib/api/exceptions/account_status_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Exception class for account status calls -class AccountStatusException extends AccountException { - /// Initializes - AccountStatusException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/active_symbols_exception.dart b/lib/api/exceptions/active_symbols_exception.dart deleted file mode 100644 index f2477da035..0000000000 --- a/lib/api/exceptions/active_symbols_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Exception for active symbols request call -class ActiveSymbolsException extends CommonException { - /// Initializes - ActiveSymbolsException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/api_token_exception.dart b/lib/api/exceptions/api_token_exception.dart deleted file mode 100644 index 8798f6c162..0000000000 --- a/lib/api/exceptions/api_token_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Api token exception class -class APITokenException extends AccountException { - /// Initializes - APITokenException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/app_exception.dart b/lib/api/exceptions/app_exception.dart deleted file mode 100644 index 8544e702e4..0000000000 --- a/lib/api/exceptions/app_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/api_base_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// App exception -class AppException extends APIBaseException { - /// Initializes - AppException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/asset_index_exception.dart b/lib/api/exceptions/asset_index_exception.dart deleted file mode 100644 index b274275b31..0000000000 --- a/lib/api/exceptions/asset_index_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Exception class for asset index -class AssetIndexException extends CommonException { - /// Initializes - AssetIndexException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/authorize_exception.dart b/lib/api/exceptions/authorize_exception.dart deleted file mode 100644 index a2f05241f4..0000000000 --- a/lib/api/exceptions/authorize_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Authorize exception class -class AuthorizeException extends AccountException { - /// Initializes - AuthorizeException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/balance_exception.dart b/lib/api/exceptions/balance_exception.dart deleted file mode 100644 index e53535ed79..0000000000 --- a/lib/api/exceptions/balance_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Balance exception class -class BalanceException extends AccountException { - /// Initializes - BalanceException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/api_base_exception.dart b/lib/api/exceptions/base_api_exception.dart similarity index 73% rename from lib/api/exceptions/api_base_exception.dart rename to lib/api/exceptions/base_api_exception.dart index 36f6508ddf..3883ef6e44 100644 --- a/lib/api/exceptions/api_base_exception.dart +++ b/lib/api/exceptions/base_api_exception.dart @@ -3,11 +3,9 @@ import 'dart:developer' as dev; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; /// Base exception class for all API exceptions. -class APIBaseException implements Exception { - /// Initializes - APIBaseException({ - required this.baseExceptionModel, - }); +class BaseAPIException implements Exception { + /// Initializes an exception with the given [baseExceptionModel]. + BaseAPIException({required this.baseExceptionModel}); /// Exception code and message model from API response. final BaseExceptionModel? baseExceptionModel; @@ -23,9 +21,7 @@ class APIBaseException implements Exception { @override String toString() { - dev.log( - '$runtimeType(code: $code, message: $message)', - ); + dev.log('$runtimeType(code: $code, message: $message)'); return message ?? '$runtimeType: API unknown error.'; } diff --git a/lib/api/exceptions/cashier_exception.dart b/lib/api/exceptions/cashier_exception.dart deleted file mode 100644 index 8391a2c276..0000000000 --- a/lib/api/exceptions/cashier_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/api_base_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// Cashier exception -class CashierException extends APIBaseException { - /// Initializes - CashierException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/common_exception.dart b/lib/api/exceptions/common_exception.dart deleted file mode 100644 index 8d73514a82..0000000000 --- a/lib/api/exceptions/common_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/api_base_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// Common exception -class CommonException extends APIBaseException { - /// Initializes - CommonException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/contract_exception.dart b/lib/api/exceptions/contract_exception.dart deleted file mode 100644 index 9e25eb8559..0000000000 --- a/lib/api/exceptions/contract_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/api_base_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// Contract exception class -class ContractException extends APIBaseException { - /// Initializes - ContractException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/contract_for_symbol_exception.dart b/lib/api/exceptions/contract_for_symbol_exception.dart deleted file mode 100644 index d193b58930..0000000000 --- a/lib/api/exceptions/contract_for_symbol_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/contract_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// Exception for contract for symbol request call -class ContractsForSymbolException extends ContractException { - /// Initializes - ContractsForSymbolException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/contract_operations_exception.dart b/lib/api/exceptions/contract_operations_exception.dart deleted file mode 100644 index bdcd3a3285..0000000000 --- a/lib/api/exceptions/contract_operations_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/contract_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// Exception for price proposal request calls -class ContractOperationException extends ContractException { - /// Initializes - ContractOperationException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/copy_trading_exception.dart b/lib/api/exceptions/copy_trading_exception.dart deleted file mode 100644 index 970e2dbb2d..0000000000 --- a/lib/api/exceptions/copy_trading_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Exception for CopyTrading -class CopyTradingException extends AccountException { - /// Initializes - CopyTradingException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/exceptions.dart b/lib/api/exceptions/exceptions.dart index 8e452fb9f9..805351f3c9 100644 --- a/lib/api/exceptions/exceptions.dart +++ b/lib/api/exceptions/exceptions.dart @@ -1,51 +1,2 @@ export '../models/base_exception_model.dart'; -export 'account_currency_exception.dart'; -export 'account_exception.dart'; -export 'account_limits_exception.dart'; -export 'account_settings_exception.dart'; -export 'account_status_exception.dart'; -export 'active_symbols_exception.dart'; -export 'api_base_exception.dart'; -export 'api_token_exception.dart'; -export 'app_exception.dart'; -export 'asset_index_exception.dart'; -export 'authorize_exception.dart'; -export 'balance_exception.dart'; -export 'cashier_exception.dart'; -export 'common_exception.dart'; -export 'contract_exception.dart'; -export 'contract_for_symbol_exception.dart'; -export 'contract_operations_exception.dart'; -export 'copy_trading_exception.dart'; -export 'exchange_exception.dart'; -export 'financial_assessment_exception.dart'; -export 'forget_exception.dart'; -export 'landing_company_exception.dart'; -export 'mt5_exception.dart'; -export 'new_account_exception.dart'; -export 'p2p_advert_exception.dart'; -export 'p2p_advertiser_exception.dart'; -export 'p2p_advertiser_stats_exception.dart'; -export 'p2p_chat_exception.dart'; -export 'p2p_exception.dart'; -export 'p2p_order_exception.dart'; -export 'payment_agent_exception.dart'; -export 'payment_exception.dart'; -export 'payout_currency_exception.dart'; -export 'ping_exception.dart'; -export 'portfolio_exception.dart'; -export 'profit_table_exception.dart'; -export 'reality_check_exception.dart'; -export 'residence_exception.dart'; -export 'self_exclusion_exception.dart'; -export 'server_time_exception.dart'; -export 'state_exception.dart'; -export 'statement_exception.dart'; -export 'tick_exception.dart'; -export 'top_up_virtual_exception.dart'; -export 'trading_exception.dart'; -export 'trading_platform_exception.dart'; -export 'transactions_exception.dart'; -export 'transfer_exception.dart'; -export 'user_exception.dart'; -export 'website_status_exception.dart'; +export 'base_api_exception.dart'; diff --git a/lib/api/exceptions/exchange_exception.dart b/lib/api/exceptions/exchange_exception.dart deleted file mode 100644 index 975800095c..0000000000 --- a/lib/api/exceptions/exchange_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Exchange exception class -class ExchangeException extends CommonException { - /// Initializes - ExchangeException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/financial_assessment_exception.dart b/lib/api/exceptions/financial_assessment_exception.dart deleted file mode 100644 index 256b0fa4e7..0000000000 --- a/lib/api/exceptions/financial_assessment_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'user_exception.dart'; - -/// Financial assessment exception class -class FinancialAssessmentException extends UserException { - /// Initializes - FinancialAssessmentException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/forget_exception.dart b/lib/api/exceptions/forget_exception.dart deleted file mode 100644 index 4f0ee63bb7..0000000000 --- a/lib/api/exceptions/forget_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Forget exception class -class ForgetException extends CommonException { - /// Initializes - ForgetException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/landing_company_exception.dart b/lib/api/exceptions/landing_company_exception.dart deleted file mode 100644 index 3afb5e6b12..0000000000 --- a/lib/api/exceptions/landing_company_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Exception class for Landing company -class LandingCompanyException extends CommonException { - /// Initializes - LandingCompanyException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/mt5_exception.dart b/lib/api/exceptions/mt5_exception.dart deleted file mode 100644 index 0885e8abfd..0000000000 --- a/lib/api/exceptions/mt5_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/api_base_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// MT5 exception class -class MT5Exception extends APIBaseException { - /// Initializes - MT5Exception({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/new_account_exception.dart b/lib/api/exceptions/new_account_exception.dart deleted file mode 100644 index 4fc47a5760..0000000000 --- a/lib/api/exceptions/new_account_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'app_exception.dart'; - -/// New account exception -class NewAccountException extends AppException { - /// Initializes - NewAccountException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/p2p_advert_exception.dart b/lib/api/exceptions/p2p_advert_exception.dart deleted file mode 100644 index 9333868d67..0000000000 --- a/lib/api/exceptions/p2p_advert_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'p2p_exception.dart'; - -/// P2P advert exception class -class P2PAdvertException extends P2PException { - /// Initializes - P2PAdvertException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/p2p_advertiser_exception.dart b/lib/api/exceptions/p2p_advertiser_exception.dart deleted file mode 100644 index 4be8f458dc..0000000000 --- a/lib/api/exceptions/p2p_advertiser_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'p2p_exception.dart'; - -/// P2P advertiser exception class -class P2PAdvertiserException extends P2PException { - /// Initializes - P2PAdvertiserException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/p2p_advertiser_stats_exception.dart b/lib/api/exceptions/p2p_advertiser_stats_exception.dart deleted file mode 100644 index 421d8a8be2..0000000000 --- a/lib/api/exceptions/p2p_advertiser_stats_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'p2p_exception.dart'; - -/// P2P advertiser stats exception class -class P2PAdvertiserStatsException extends P2PException { - /// Initializes - P2PAdvertiserStatsException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/p2p_chat_exception.dart b/lib/api/exceptions/p2p_chat_exception.dart deleted file mode 100644 index 193acebf5e..0000000000 --- a/lib/api/exceptions/p2p_chat_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'p2p_exception.dart'; - -/// P2P chat exception -class P2PChatException extends P2PException { - /// Initializes - P2PChatException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/p2p_exception.dart b/lib/api/exceptions/p2p_exception.dart deleted file mode 100644 index 3f10f0dff0..0000000000 --- a/lib/api/exceptions/p2p_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/api_base_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// P2P exception -class P2PException extends APIBaseException { - /// Initializes - P2PException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/p2p_order_exception.dart b/lib/api/exceptions/p2p_order_exception.dart deleted file mode 100644 index 925a14427d..0000000000 --- a/lib/api/exceptions/p2p_order_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'p2p_exception.dart'; - -/// P2P Order exception class -class P2POrderException extends P2PException { - /// Initializes - P2POrderException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/payment_agent_exception.dart b/lib/api/exceptions/payment_agent_exception.dart deleted file mode 100644 index 7a2bb7ddc0..0000000000 --- a/lib/api/exceptions/payment_agent_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Payment agent exception -class PaymentAgentException extends CommonException { - /// Initializes - PaymentAgentException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/payment_exception.dart b/lib/api/exceptions/payment_exception.dart deleted file mode 100644 index 26e83ba931..0000000000 --- a/lib/api/exceptions/payment_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Payment exception -class PaymentException extends CommonException { - /// Initializes - PaymentException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/payout_currency_exception.dart b/lib/api/exceptions/payout_currency_exception.dart deleted file mode 100644 index ca3c675ba8..0000000000 --- a/lib/api/exceptions/payout_currency_exception.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - - -/// Payout currency exception class -class PayoutCurrencyException extends CommonException { - /// Initializes - PayoutCurrencyException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/ping_exception.dart b/lib/api/exceptions/ping_exception.dart deleted file mode 100644 index 6bdeb9abee..0000000000 --- a/lib/api/exceptions/ping_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Ping exception class -class PingException extends CommonException { - /// Initializes - PingException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/portfolio_exception.dart b/lib/api/exceptions/portfolio_exception.dart deleted file mode 100644 index 08438c5526..0000000000 --- a/lib/api/exceptions/portfolio_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Exception for portfolio -class PortfolioException extends AccountException { - /// Initializes - PortfolioException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/profit_table_exception.dart b/lib/api/exceptions/profit_table_exception.dart deleted file mode 100644 index 9a2053d792..0000000000 --- a/lib/api/exceptions/profit_table_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Profit table exception -class ProfitTableException extends AccountException { - /// Initializes - ProfitTableException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/reality_check_exception.dart b/lib/api/exceptions/reality_check_exception.dart deleted file mode 100644 index e7deb56020..0000000000 --- a/lib/api/exceptions/reality_check_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Reality check exception -class RealityCheckException extends AccountException { - /// Initializes - RealityCheckException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/residence_exception.dart b/lib/api/exceptions/residence_exception.dart deleted file mode 100644 index bc7fabffc0..0000000000 --- a/lib/api/exceptions/residence_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Exception for residence calls -class ResidenceException extends CommonException { - /// Initializes - ResidenceException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/self_exclusion_exception.dart b/lib/api/exceptions/self_exclusion_exception.dart deleted file mode 100644 index 5746024f20..0000000000 --- a/lib/api/exceptions/self_exclusion_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Self exclusion exception -class SelfExclusionException extends AccountException { - /// Initializes - SelfExclusionException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/server_time_exception.dart b/lib/api/exceptions/server_time_exception.dart deleted file mode 100644 index 9ed0d057b0..0000000000 --- a/lib/api/exceptions/server_time_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Server time exception -class ServerTimeException extends CommonException { - /// Initializes - ServerTimeException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/state_exception.dart b/lib/api/exceptions/state_exception.dart deleted file mode 100644 index bd9e767ec8..0000000000 --- a/lib/api/exceptions/state_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Exception for state call -class StateException extends CommonException { - /// Initializes - StateException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/statement_exception.dart b/lib/api/exceptions/statement_exception.dart deleted file mode 100644 index 931df56509..0000000000 --- a/lib/api/exceptions/statement_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Statement exception -class StatementException extends AccountException { - /// Initializes - StatementException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/tick_exception.dart b/lib/api/exceptions/tick_exception.dart deleted file mode 100644 index 6bcfa8a20e..0000000000 --- a/lib/api/exceptions/tick_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Exception class for Tick calls -class TickException extends CommonException { - /// Initializes - TickException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/top_up_virtual_exception.dart b/lib/api/exceptions/top_up_virtual_exception.dart deleted file mode 100644 index 1ae8288bb2..0000000000 --- a/lib/api/exceptions/top_up_virtual_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Top-Up virtual exception class -class TopUpVirtualException extends AccountException { - /// Initializes - TopUpVirtualException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/trading_exception.dart b/lib/api/exceptions/trading_exception.dart deleted file mode 100644 index 4539acb232..0000000000 --- a/lib/api/exceptions/trading_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Trading exception -class TradingException extends CommonException { - /// Initializes - TradingException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/trading_platform_exception.dart b/lib/api/exceptions/trading_platform_exception.dart deleted file mode 100644 index b90f5ef84a..0000000000 --- a/lib/api/exceptions/trading_platform_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Trading platform exception class. -class TradingPlatformException extends AccountException { - /// Initializes [TradingPlatformException]. - TradingPlatformException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/transactions_exception.dart b/lib/api/exceptions/transactions_exception.dart deleted file mode 100644 index 0d56f7a8ea..0000000000 --- a/lib/api/exceptions/transactions_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/contract_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// Exceptions for transaction call -class TransactionsException extends ContractException { - /// Initializes - TransactionsException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/transfer_exception.dart b/lib/api/exceptions/transfer_exception.dart deleted file mode 100644 index 5b5ede3fad..0000000000 --- a/lib/api/exceptions/transfer_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'user_exception.dart'; - -/// Transfer exception -class TransferException extends UserException { - /// Initializes - TransferException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/user_exception.dart b/lib/api/exceptions/user_exception.dart deleted file mode 100644 index a097571e89..0000000000 --- a/lib/api/exceptions/user_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/api_base_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// User exception -class UserException extends APIBaseException { - /// Initializes - UserException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/website_status_exception.dart b/lib/api/exceptions/website_status_exception.dart deleted file mode 100644 index 7d27dac6b4..0000000000 --- a/lib/api/exceptions/website_status_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Exception class for website status -class WebsiteStatusException extends CommonException { - /// Initializes - WebsiteStatusException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/manually/ohlc_response_result.dart b/lib/api/manually/ohlc_response_result.dart index 0d83ea8e19..a1bac6734a 100644 --- a/lib/api/manually/ohlc_response_result.dart +++ b/lib/api/manually/ohlc_response_result.dart @@ -81,7 +81,7 @@ class OHLC extends TickBase { /// Unsubscribes all OHLC. /// - /// Throws a [TickException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future unsubscribeAllOHLC() async { final ForgetAllReceive response = await _api.unsubscribeAll(method: ForgetStreamType.candles); @@ -89,7 +89,7 @@ class OHLC extends TickBase { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TickException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetAllResponse.fromJson(response.forgetAll); diff --git a/lib/api/manually/tick.dart b/lib/api/manually/tick.dart index db92b083ed..f6aa7d3c29 100644 --- a/lib/api/manually/tick.dart +++ b/lib/api/manually/tick.dart @@ -60,7 +60,7 @@ class Tick extends TickBase { /// Subscribes to a tick for given [TickRequest] /// - /// Throws [TickException] if API response contains an error + /// Throws [BaseAPIException] if API response contains an error static Stream subscribeTick( TicksRequest tickRequest, { RequestCompareFunction? comparePredicate, @@ -72,7 +72,7 @@ class Tick extends TickBase { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TickException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is TicksReceive @@ -86,7 +86,7 @@ class Tick extends TickBase { /// Unsubscribes all ticks. /// - /// Throws a [TickException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future unsubscribeAllTicks() async { final ForgetAllReceive response = await _api.unsubscribeAll(method: ForgetStreamType.ticks); @@ -94,7 +94,7 @@ class Tick extends TickBase { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TickException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetAllResponse.fromJson(response); diff --git a/lib/api/manually/tick_base.dart b/lib/api/manually/tick_base.dart index 930e1a540a..3e30f9a367 100644 --- a/lib/api/manually/tick_base.dart +++ b/lib/api/manually/tick_base.dart @@ -68,7 +68,7 @@ class TickBase extends TickBaseModel { /// Unsubscribes from tick stream /// - /// Throws a [TickException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future unsubscribe() async { if (subscriptionInformation?.id == null) { return null; @@ -80,7 +80,7 @@ class TickBase extends TickBaseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TickException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetResponse.fromJson(response.forget); diff --git a/lib/api/manually/tick_history_subscription.dart b/lib/api/manually/tick_history_subscription.dart index 84476bc2d7..4ca904928c 100644 --- a/lib/api/manually/tick_history_subscription.dart +++ b/lib/api/manually/tick_history_subscription.dart @@ -23,7 +23,7 @@ class TickHistorySubscription { /// Unsubscribes from tick history stream /// - /// Throws a [TickException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future unsubscribe() async { if (tickHistory?.subscription == null) { return null; @@ -36,7 +36,7 @@ class TickHistorySubscription { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TickException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetResponse.fromJson(response.forget); diff --git a/lib/api/response/active_symbols_response_result.dart b/lib/api/response/active_symbols_response_result.dart index 08fd25d55f..d646bdf460 100644 --- a/lib/api/response/active_symbols_response_result.dart +++ b/lib/api/response/active_symbols_response_result.dart @@ -63,7 +63,7 @@ class ActiveSymbolsResponse extends ActiveSymbolsResponseModel { /// Gets the list of active symbols. /// /// For parameters information refer to [ActiveSymbolsRequest]. - /// Throws an [ActiveSymbolsException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future fetchActiveSymbols( ActiveSymbolsRequest request, ) async { @@ -74,7 +74,7 @@ class ActiveSymbolsResponse extends ActiveSymbolsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ActiveSymbolsException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ActiveSymbolsResponse.fromJson(response.activeSymbols); diff --git a/lib/api/response/api_token_response_result.dart b/lib/api/response/api_token_response_result.dart index 58ed812c6d..9a665700e3 100644 --- a/lib/api/response/api_token_response_result.dart +++ b/lib/api/response/api_token_response_result.dart @@ -56,7 +56,7 @@ class ApiTokenResponse extends ApiTokenResponseModel { /// [scopes] is a list of permission scopes to provide with the token. /// [validForCurrentIPOnly] is optional and if you set this parameter during token creation, /// then the token created will only work for the IP address that was used to create the token - /// Throws an [APITokenException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future create({ required String name, required List scopes, @@ -73,7 +73,7 @@ class ApiTokenResponse extends ApiTokenResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - APITokenException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ApiTokenResponse.fromJson(response.apiToken); @@ -81,7 +81,7 @@ class ApiTokenResponse extends ApiTokenResponseModel { /// Deletes the [token] /// - /// Throws an [APITokenException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future delete({ required String token, }) async { @@ -92,7 +92,7 @@ class ApiTokenResponse extends ApiTokenResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - APITokenException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ApiTokenResponse.fromJson(response.apiToken); diff --git a/lib/api/response/app_delete_response_result.dart b/lib/api/response/app_delete_response_result.dart index 3ddbcf61b7..c5945ec156 100644 --- a/lib/api/response/app_delete_response_result.dart +++ b/lib/api/response/app_delete_response_result.dart @@ -51,7 +51,7 @@ class AppDeleteResponse extends AppDeleteResponseModel { /// Deletes the application by appId specified in [AppDeleteRequest.appDelete]. /// /// For parameters information refer to [AppDeleteRequest]. - /// Throws an [AppException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future deleteApplication( AppDeleteRequest request) async { final AppDeleteReceive response = await _api.call(request: request); @@ -59,7 +59,7 @@ class AppDeleteResponse extends AppDeleteResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AppException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return AppDeleteResponse.fromJson(response.appDelete); diff --git a/lib/api/response/app_get_response_result.dart b/lib/api/response/app_get_response_result.dart index a54dd01b45..a914b47eb2 100644 --- a/lib/api/response/app_get_response_result.dart +++ b/lib/api/response/app_get_response_result.dart @@ -66,7 +66,7 @@ class AppGetResponse extends AppGetResponseModel { /// Gets the information of the OAuth application specified by [appId] in [request] /// /// For parameters information refer to [AppGetRequest]. - /// Throws an [AppException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future fetchApplicationDetails( AppGetRequest request, ) async { @@ -75,7 +75,7 @@ class AppGetResponse extends AppGetResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AppException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return AppGetResponse.fromJson(response.appGet); @@ -84,7 +84,7 @@ class AppGetResponse extends AppGetResponseModel { /// Gets all of the account's OAuth applications. /// /// For parameters information refer to [AppListRequest]. - /// Throws an [AppException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future?> fetchApplicationList( AppListRequest request, ) async { @@ -93,7 +93,7 @@ class AppGetResponse extends AppGetResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AppException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return getListFromMap( diff --git a/lib/api/response/app_list_response_result.dart b/lib/api/response/app_list_response_result.dart index c2b93a1b6b..7cb8fbe1b5 100644 --- a/lib/api/response/app_list_response_result.dart +++ b/lib/api/response/app_list_response_result.dart @@ -64,7 +64,7 @@ class AppListResponse extends AppListResponseModel { /// Gets all of the account's OAuth applications. /// /// For parameters information refer to [AppListRequest]. - /// Throws an [AppException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future fetchApplicationList( AppListRequest request, ) async { @@ -73,7 +73,7 @@ class AppListResponse extends AppListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AppException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return AppListResponse.fromJson(response.appList); diff --git a/lib/api/response/app_markup_details_response_result.dart b/lib/api/response/app_markup_details_response_result.dart index bfb45c2864..3e7075aa59 100644 --- a/lib/api/response/app_markup_details_response_result.dart +++ b/lib/api/response/app_markup_details_response_result.dart @@ -55,7 +55,7 @@ class AppMarkupDetailsResponse extends AppMarkupDetailsResponseModel { /// Retrieve details of app markup according to criteria specified. /// /// For parameters information refer to [AppMarkupDetailsRequest]. - /// Throws an [AppException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future fetchApplicationMarkupDetails( AppMarkupDetailsRequest request, ) async { @@ -64,7 +64,7 @@ class AppMarkupDetailsResponse extends AppMarkupDetailsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AppException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return AppMarkupDetailsResponse.fromJson(response.appMarkupDetails); diff --git a/lib/api/response/app_register_response_result.dart b/lib/api/response/app_register_response_result.dart index d1d5b2f837..082f4616cb 100644 --- a/lib/api/response/app_register_response_result.dart +++ b/lib/api/response/app_register_response_result.dart @@ -56,7 +56,7 @@ class AppRegisterResponse extends AppRegisterResponseModel { /// Registers a new OAuth application. /// /// For parameters information refer to [AppRegisterRequest]. - /// Throws an [AppException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future registerApplication( AppRegisterRequest request, ) async { @@ -65,7 +65,7 @@ class AppRegisterResponse extends AppRegisterResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AppException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return AppRegisterResponse.fromJson(response.appRegister); diff --git a/lib/api/response/app_update_response_result.dart b/lib/api/response/app_update_response_result.dart index 439871bffa..158ca4dcd9 100644 --- a/lib/api/response/app_update_response_result.dart +++ b/lib/api/response/app_update_response_result.dart @@ -55,7 +55,7 @@ class AppUpdateResponse extends AppUpdateResponseModel { /// Updates the application specified in [request]. /// /// For parameters information refer to [AppUpdateRequest]. - /// Throws an [AppException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future updateApplication( AppUpdateRequest request) async { final AppUpdateReceive response = await _api.call(request: request); @@ -63,7 +63,7 @@ class AppUpdateResponse extends AppUpdateResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AppException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return AppUpdateResponse.fromJson(response.appUpdate); diff --git a/lib/api/response/asset_index_response_result.dart b/lib/api/response/asset_index_response_result.dart index 31c8c16276..3747bd71b2 100644 --- a/lib/api/response/asset_index_response_result.dart +++ b/lib/api/response/asset_index_response_result.dart @@ -64,7 +64,7 @@ class AssetIndexResponse extends AssetIndexResponseModel { /// Retrieves a list of all available underlyings and the corresponding contract types and duration boundaries. /// /// If the user is logged in, only the assets available for that user's landing company will be returned. - /// Throws an [AssetIndexException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future fetchAssetIndices( AssetIndexRequest request, ) async { @@ -75,7 +75,7 @@ class AssetIndexResponse extends AssetIndexResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AssetIndexException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return AssetIndexResponse.fromJson(response.assetIndex); diff --git a/lib/api/response/authorize_response_result.dart b/lib/api/response/authorize_response_result.dart index d73633e0b0..9e844223e2 100644 --- a/lib/api/response/authorize_response_result.dart +++ b/lib/api/response/authorize_response_result.dart @@ -55,7 +55,7 @@ class AuthorizeResponse extends AuthorizeResponseModel { /// Authorizes current WebSocket session to act on behalf of the owner of a given token. /// /// For parameters information refer to [AuthorizeRequest]. - /// Throws an [AuthorizeException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future authorizeMethodRaw( AuthorizeRequest request, ) async { @@ -66,7 +66,7 @@ class AuthorizeResponse extends AuthorizeResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AuthorizeException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -75,7 +75,7 @@ class AuthorizeResponse extends AuthorizeResponseModel { /// Authorizes current WebSocket session to act on behalf of the owner of a given token. /// /// For parameters information refer to [AuthorizeRequest]. - /// Throws an [AuthorizeException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future authorizeMethod( AuthorizeRequest request, ) async { @@ -111,6 +111,7 @@ enum PlatformEnum { /// mt5. mt5, } + /// Authorize model class. abstract class AuthorizeModel { /// Initializes Authorize model class . @@ -368,6 +369,7 @@ class Authorize extends AuthorizeModel { wallet: wallet ?? this.wallet, ); } + /// Account list item model class. abstract class AccountListItemModel { /// Initializes Account list item model class . @@ -506,6 +508,7 @@ class AccountListItem extends AccountListItemModel { wallet: wallet ?? this.wallet, ); } + /// Trading model class. abstract class TradingModel { /// Initializes Trading model class . @@ -560,6 +563,7 @@ class Trading extends TradingModel { linkedTo: linkedTo ?? this.linkedTo, ); } + /// Linked to item model class. abstract class LinkedToItemModel { /// Initializes Linked to item model class . @@ -632,6 +636,7 @@ class LinkedToItem extends LinkedToItemModel { paymentMethod: paymentMethod ?? this.paymentMethod, ); } + /// Wallet model class. abstract class WalletModel { /// Initializes Wallet model class . @@ -726,6 +731,7 @@ class Wallet extends WalletModel { paymentMethod: paymentMethod ?? this.paymentMethod, ); } + /// Wallet linked to item model class. abstract class WalletLinkedToItemModel { /// Initializes Wallet linked to item model class . @@ -804,6 +810,7 @@ class WalletLinkedToItem extends WalletLinkedToItemModel { platform: platform ?? this.platform, ); } + /// Local currencies property model class. abstract class LocalCurrenciesPropertyModel { /// Initializes Local currencies property model class . @@ -847,6 +854,7 @@ class LocalCurrenciesProperty extends LocalCurrenciesPropertyModel { fractionalDigits: fractionalDigits ?? this.fractionalDigits, ); } + /// Authorize trading model class. abstract class AuthorizeTradingModel { /// Initializes Authorize trading model class . @@ -902,6 +910,7 @@ class AuthorizeTrading extends AuthorizeTradingModel { linkedTo: linkedTo ?? this.linkedTo, ); } + /// Trading linked to item model class. abstract class TradingLinkedToItemModel { /// Initializes Trading linked to item model class . @@ -975,6 +984,7 @@ class TradingLinkedToItem extends TradingLinkedToItemModel { paymentMethod: paymentMethod ?? this.paymentMethod, ); } + /// Authorize wallet model class. abstract class AuthorizeWalletModel { /// Initializes Authorize wallet model class . @@ -1070,6 +1080,7 @@ class AuthorizeWallet extends AuthorizeWalletModel { paymentMethod: paymentMethod ?? this.paymentMethod, ); } + /// Wallet linked to item8 model class. abstract class WalletLinkedToItem8Model { /// Initializes Wallet linked to item8 model class . diff --git a/lib/api/response/balance_response_result.dart b/lib/api/response/balance_response_result.dart index 383ea43793..1ad7a4bf56 100644 --- a/lib/api/response/balance_response_result.dart +++ b/lib/api/response/balance_response_result.dart @@ -74,14 +74,14 @@ class BalanceResponse extends BalanceResponseModel { /// Gets the balance of account /// /// For parameters info refer to [BalanceRequest] - /// Throws a [BalanceException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchBalance(BalanceRequest request) async { final BalanceReceive response = await _api.call(request: request); checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - BalanceException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return BalanceResponse.fromJson(response.balance, response.subscription); @@ -89,7 +89,7 @@ class BalanceResponse extends BalanceResponseModel { /// Instead of one call [Balance.fetchBalance] gets stream of [Balance] /// - /// Throws a [BalanceException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Stream subscribeBalance( BalanceRequest request, { RequestCompareFunction? comparePredicate, @@ -100,7 +100,7 @@ class BalanceResponse extends BalanceResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - BalanceException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is BalanceReceive @@ -113,7 +113,7 @@ class BalanceResponse extends BalanceResponseModel { /// Unsubscribes from balance subscription. /// - /// Throws a [BalanceException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future unsubscribeBalance() async { if (subscription == null) { return null; @@ -125,7 +125,7 @@ class BalanceResponse extends BalanceResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - BalanceException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetResponse.fromJson(response.forget); @@ -133,7 +133,7 @@ class BalanceResponse extends BalanceResponseModel { /// Unsubscribes all balance subscriptions. /// - /// Throws a [BalanceException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future unsubscribeAllBalance() async { final ForgetAllReceive response = await _api.unsubscribeAll(method: ForgetStreamType.balance); @@ -141,7 +141,7 @@ class BalanceResponse extends BalanceResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - BalanceException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetAllResponse.fromJson(response.forgetAll); diff --git a/lib/api/response/buy_response_result.dart b/lib/api/response/buy_response_result.dart index 6045a80247..77d11d7a7e 100644 --- a/lib/api/response/buy_response_result.dart +++ b/lib/api/response/buy_response_result.dart @@ -73,7 +73,7 @@ class BuyResponse extends BuyResponseModel { /// Buys a contract with parameters specified in given [BuyRequest] /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future buyMethod(BuyRequest request) async { final BuyReceive response = await _api.call( request: request, @@ -82,7 +82,7 @@ class BuyResponse extends BuyResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return BuyResponse.fromJson(response.buy, response.subscription); @@ -90,7 +90,7 @@ class BuyResponse extends BuyResponseModel { /// Buys contract with parameters specified in request and subscribes to it. /// - /// Throws a [ContractOperationException] is API response contains an error + /// Throws a [BaseAPIException] is API response contains an error static Stream buyAndSubscribe( BuyRequest request, { RequestCompareFunction? comparePredicate, @@ -102,8 +102,7 @@ class BuyResponse extends BuyResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException( - baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is ProposalOpenContractReceive ? ProposalOpenContractResponse.fromJson( @@ -116,7 +115,7 @@ class BuyResponse extends BuyResponseModel { /// Gets the current spot of the this bought contract as [Contract]. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future fetchState() => ProposalOpenContractResponse.fetchContractState( ProposalOpenContractRequest( @@ -126,7 +125,7 @@ class BuyResponse extends BuyResponseModel { /// Subscribes to this bought contract spot and returns its spot update as [ContractBaseModel]. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Stream subscribeState({ RequestCompareFunction? comparePredicate, }) => @@ -139,7 +138,7 @@ class BuyResponse extends BuyResponseModel { /// /// New [stopLoss] value for a contract. To cancel, pass null. /// New [takeProfit] value for a contract. To cancel, pass null. - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future update({ double? stopLoss, double? takeProfit, diff --git a/lib/api/response/cancel_response_result.dart b/lib/api/response/cancel_response_result.dart index dadf3f58b4..5ebcdc8da8 100644 --- a/lib/api/response/cancel_response_result.dart +++ b/lib/api/response/cancel_response_result.dart @@ -53,14 +53,14 @@ class CancelResponse extends CancelResponseModel { /// Cancels a contract with parameters specified in [CancelRequest]. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future cancelContract(CancelRequest request) async { final CancelReceive response = await _api.call(request: request); checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return CancelResponse.fromJson(response.cancel); diff --git a/lib/api/response/cashier_response_result.dart b/lib/api/response/cashier_response_result.dart index 373335c940..a15605f57b 100644 --- a/lib/api/response/cashier_response_result.dart +++ b/lib/api/response/cashier_response_result.dart @@ -73,7 +73,7 @@ class CashierResponse extends CashierResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - CashierException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return CashierResponse.fromJson(response.cashier, response.cashier); diff --git a/lib/api/response/contract_update_history_response_result.dart b/lib/api/response/contract_update_history_response_result.dart index c1d9538bed..45bcc33ae2 100644 --- a/lib/api/response/contract_update_history_response_result.dart +++ b/lib/api/response/contract_update_history_response_result.dart @@ -63,7 +63,7 @@ class ContractUpdateHistoryResponse extends ContractUpdateHistoryResponseModel { /// Gets update history for contract as List of [HistorySpotPriceModel] /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchContractUpdateHistory( ContractUpdateHistoryRequest request, ) async { @@ -73,7 +73,7 @@ class ContractUpdateHistoryResponse extends ContractUpdateHistoryResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ContractUpdateHistoryResponse.fromJson( diff --git a/lib/api/response/contract_update_response_result.dart b/lib/api/response/contract_update_response_result.dart index ea7be773a1..4eb247d49f 100644 --- a/lib/api/response/contract_update_response_result.dart +++ b/lib/api/response/contract_update_response_result.dart @@ -55,7 +55,7 @@ class ContractUpdateResponse extends ContractUpdateResponseModel { /// updates a contract with parameters specified in [ContractUpdateRequest]. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future updateContract( ContractUpdateRequest request, ) async { @@ -64,7 +64,7 @@ class ContractUpdateResponse extends ContractUpdateResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ContractUpdateResponse.fromJson(response.contractUpdate); diff --git a/lib/api/response/contracts_for_response_result.dart b/lib/api/response/contracts_for_response_result.dart index 5bafb5871d..c8f9b535de 100644 --- a/lib/api/response/contracts_for_response_result.dart +++ b/lib/api/response/contracts_for_response_result.dart @@ -55,7 +55,7 @@ class ContractsForResponse extends ContractsForResponseModel { /// Gets available contracts for given symbol in [ContractsForRequest] /// - /// Throws a [ContractsForSymbolException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchContractsForSymbol( ContractsForRequest request, ) async { @@ -66,7 +66,7 @@ class ContractsForResponse extends ContractsForResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractsForSymbolException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ContractsForResponse.fromJson(response.contractsFor); diff --git a/lib/api/response/copy_start_response_result.dart b/lib/api/response/copy_start_response_result.dart index 827c5cff2e..9fceb8a8f7 100644 --- a/lib/api/response/copy_start_response_result.dart +++ b/lib/api/response/copy_start_response_result.dart @@ -52,14 +52,14 @@ class CopyStartResponse extends CopyStartResponseModel { /// Starts copy trader bets. /// /// For parameters information refer to [CopyStartRequest]. - /// Throws a [CopyTradingException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future start(CopyStartRequest request) async { final CopyStartReceive response = await _api.call(request: request); checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - CopyTradingException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return CopyStartResponse.fromJson(response.copyStart); diff --git a/lib/api/response/copy_stop_response_result.dart b/lib/api/response/copy_stop_response_result.dart index 6e523659ab..d53a3fa34b 100644 --- a/lib/api/response/copy_stop_response_result.dart +++ b/lib/api/response/copy_stop_response_result.dart @@ -52,14 +52,14 @@ class CopyStopResponse extends CopyStopResponseModel { /// Stops copy trader bets. /// /// For parameters information refer to [CopyStopRequest]. - /// Throws a [CopyTradingException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future stop(CopyStopRequest request) async { final CopyStopReceive response = await _api.call(request: request); checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - CopyTradingException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return CopyStopResponse.fromJson(response.copyStop); diff --git a/lib/api/response/copytrading_list_response_result.dart b/lib/api/response/copytrading_list_response_result.dart index 9be55a7766..158d91def9 100644 --- a/lib/api/response/copytrading_list_response_result.dart +++ b/lib/api/response/copytrading_list_response_result.dart @@ -55,7 +55,7 @@ class CopytradingListResponse extends CopytradingListResponseModel { /// Gets the list of active copiers and/or traders for Copy Trading /// - /// Throws a [CopyTradingException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchList([ CopytradingListRequest? request, ]) async { @@ -66,7 +66,7 @@ class CopytradingListResponse extends CopytradingListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - CopyTradingException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return CopytradingListResponse.fromJson(response.copytradingList); diff --git a/lib/api/response/copytrading_statistics_response_result.dart b/lib/api/response/copytrading_statistics_response_result.dart index 16451446f9..55c3cb30ec 100644 --- a/lib/api/response/copytrading_statistics_response_result.dart +++ b/lib/api/response/copytrading_statistics_response_result.dart @@ -55,7 +55,7 @@ class CopytradingStatisticsResponse extends CopytradingStatisticsResponseModel { /// Gets the copy trading statistics for given `traderId` in [request] /// - /// Throws a [CopyTradingException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchStatistics( CopytradingStatisticsRequest request, ) async { @@ -66,7 +66,7 @@ class CopytradingStatisticsResponse extends CopytradingStatisticsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - CopyTradingException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return CopytradingStatisticsResponse.fromJson( diff --git a/lib/api/response/exchange_rates_response_result.dart b/lib/api/response/exchange_rates_response_result.dart index a62f0171c9..62c1a9194b 100644 --- a/lib/api/response/exchange_rates_response_result.dart +++ b/lib/api/response/exchange_rates_response_result.dart @@ -69,7 +69,7 @@ class ExchangeRatesResponse extends ExchangeRatesResponseModel { /// Retrieves the exchange rates from a base currency to all currencies supported by the system. /// /// For parameters information refer to [ExchangeRatesRequest]. - /// Throws an [ExchangeException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future fetchExchangeRatesRaw( ExchangeRatesRequest request, ) async { @@ -78,7 +78,7 @@ class ExchangeRatesResponse extends ExchangeRatesResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ExchangeException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -87,7 +87,7 @@ class ExchangeRatesResponse extends ExchangeRatesResponseModel { /// Retrieves the exchange rates from a base currency to all currencies supported by the system. /// /// For parameters information refer to [ExchangeRatesRequest]. - /// Throws an [ExchangeException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future fetchExchangeRates( ExchangeRatesRequest request, ) async { diff --git a/lib/api/response/forget_all_response_result.dart b/lib/api/response/forget_all_response_result.dart index 3a6fd8e4d6..849c6ac321 100644 --- a/lib/api/response/forget_all_response_result.dart +++ b/lib/api/response/forget_all_response_result.dart @@ -64,7 +64,7 @@ class ForgetAllResponse extends ForgetAllResponseModel { /// Immediately cancels the real-time streams of messages of given type. /// /// For parameters information refer to [ForgetAllRequest]. - /// Throws a [ForgetException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future forgetAllMethod( ForgetAllRequest request, ) async { @@ -73,7 +73,7 @@ class ForgetAllResponse extends ForgetAllResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ForgetException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetAllResponse.fromJson(response.forgetAll); diff --git a/lib/api/response/forget_response_result.dart b/lib/api/response/forget_response_result.dart index 95312f3ff7..96087b4812 100644 --- a/lib/api/response/forget_response_result.dart +++ b/lib/api/response/forget_response_result.dart @@ -52,7 +52,7 @@ class ForgetResponse extends ForgetResponseModel { /// Immediately cancels the real-time stream of messages with a specific id. /// /// For parameters information refer to [ForgetRequest]. - /// Throws a [ForgetException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future forgetMethod( ForgetRequest request, ) async { @@ -61,7 +61,7 @@ class ForgetResponse extends ForgetResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ForgetException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetResponse.fromJson(response.forget); diff --git a/lib/api/response/get_account_status_response_result.dart b/lib/api/response/get_account_status_response_result.dart index 37887a3c83..8b1e4185fd 100644 --- a/lib/api/response/get_account_status_response_result.dart +++ b/lib/api/response/get_account_status_response_result.dart @@ -56,7 +56,7 @@ class GetAccountStatusResponse extends GetAccountStatusResponseModel { /// Gets the account's status. /// /// For parameters information refer to [GetAccountStatusRequest]. - /// Throws an [AccountStatusException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future fetchAccountStatusRaw() async { final GetAccountStatusReceive response = await _api.call( request: const GetAccountStatusRequest(), @@ -65,7 +65,7 @@ class GetAccountStatusResponse extends GetAccountStatusResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AccountStatusException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -74,7 +74,7 @@ class GetAccountStatusResponse extends GetAccountStatusResponseModel { /// Gets the account's status. /// /// For parameters information refer to [GetAccountStatusRequest]. - /// Throws an [AccountStatusException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future fetchAccountStatus() async { final GetAccountStatusReceive response = await fetchAccountStatusRaw(); diff --git a/lib/api/response/get_financial_assessment_response_result.dart b/lib/api/response/get_financial_assessment_response_result.dart index 7d45ce830b..e19869c19e 100644 --- a/lib/api/response/get_financial_assessment_response_result.dart +++ b/lib/api/response/get_financial_assessment_response_result.dart @@ -58,7 +58,7 @@ class GetFinancialAssessmentResponse /// /// The 'financial assessment' is a questionnaire that clients of certain Landing Companies need to complete, /// due to regulatory and KYC (know your client) requirements. - /// Throws a [FinancialAssessmentException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchAssessment( GetFinancialAssessmentRequest request, ) async { @@ -68,7 +68,7 @@ class GetFinancialAssessmentResponse checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - FinancialAssessmentException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return GetFinancialAssessmentResponse.fromJson( diff --git a/lib/api/response/get_limits_response_result.dart b/lib/api/response/get_limits_response_result.dart index 830e26f867..b1c4217b4d 100644 --- a/lib/api/response/get_limits_response_result.dart +++ b/lib/api/response/get_limits_response_result.dart @@ -54,7 +54,7 @@ class GetLimitsResponse extends GetLimitsResponseModel { /// Gets the trading and withdrawal limits for logged in account /// - /// Throws an [AccountLimitsException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future fetchAccountLimits([ GetLimitsRequest? request, ]) async { @@ -65,7 +65,7 @@ class GetLimitsResponse extends GetLimitsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AccountLimitsException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return GetLimitsResponse.fromJson(response.getLimits); diff --git a/lib/api/response/get_self_exclusion_response_result.dart b/lib/api/response/get_self_exclusion_response_result.dart index a1efd5829c..6a963c40dc 100644 --- a/lib/api/response/get_self_exclusion_response_result.dart +++ b/lib/api/response/get_self_exclusion_response_result.dart @@ -60,7 +60,7 @@ class GetSelfExclusionResponse extends GetSelfExclusionResponseModel { /// /// This facility is a regulatory requirement for certain Landing Companies. /// For parameters information refer to [GetSelfExclusionRequest]. - /// Throws a [SelfExclusionException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchSelfExclusion([ GetSelfExclusionRequest? request, ]) async { @@ -71,7 +71,7 @@ class GetSelfExclusionResponse extends GetSelfExclusionResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - SelfExclusionException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return GetSelfExclusionResponse.fromJson(response.getSelfExclusion); @@ -80,14 +80,14 @@ class GetSelfExclusionResponse extends GetSelfExclusionResponseModel { /// Sets Self-Exclusion (this call should be used in conjunction with [fetchSelfExclusion]) /// /// For parameters information refer to [SetSelfExclusionRequest]. - /// Throws a [SelfExclusionException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future setSelfExclusion(SetSelfExclusionRequest request) async { final SetSelfExclusionReceive response = await _api.call(request: request); checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - SelfExclusionException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return getBool(response.setSelfExclusion); @@ -96,7 +96,7 @@ class GetSelfExclusionResponse extends GetSelfExclusionResponseModel { /// Excludes user from the website based this parameters /// /// (this call should be used in conjunction with [fetchSelfExclusion]) - /// Throws a [SelfExclusionException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future exclude() async { final SetSelfExclusionReceive response = await _api.call( request: SetSelfExclusionRequest( @@ -121,7 +121,7 @@ class GetSelfExclusionResponse extends GetSelfExclusionResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - SelfExclusionException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return getBool(response.setSelfExclusion); diff --git a/lib/api/response/get_settings_response_result.dart b/lib/api/response/get_settings_response_result.dart index 349c1b1203..4d9fde44a8 100644 --- a/lib/api/response/get_settings_response_result.dart +++ b/lib/api/response/get_settings_response_result.dart @@ -59,7 +59,7 @@ class GetSettingsResponse extends GetSettingsResponseModel { /// Gets user's settings (email, date of birth, address etc). /// /// For parameters information refer to [GetSettingsRequest]. - /// Throws an [AccountSettingsException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future fetchAccountSettingRaw([ GetSettingsRequest? request, ]) async { @@ -70,7 +70,7 @@ class GetSettingsResponse extends GetSettingsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AccountSettingsException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -79,7 +79,7 @@ class GetSettingsResponse extends GetSettingsResponseModel { /// Gets user's settings (email, date of birth, address etc). /// /// For parameters information refer to [GetSettingsRequest]. - /// Throws an [AccountSettingsException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future changeAccountSettingRaw( SetSettingsRequest request, ) async { @@ -88,7 +88,7 @@ class GetSettingsResponse extends GetSettingsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AccountSettingsException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -96,7 +96,7 @@ class GetSettingsResponse extends GetSettingsResponseModel { /// Gets user's settings (email, date of birth, address etc). /// - /// Throws an [AccountSettingsException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future fetchAccountSetting([ GetSettingsRequest? request, ]) async { @@ -107,7 +107,7 @@ class GetSettingsResponse extends GetSettingsResponseModel { /// Changes the user's settings with parameters specified as [SetSettingsRequest]. /// - /// Throws an [AccountSettingsException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future changeAccountSetting( SetSettingsRequest request, ) async { diff --git a/lib/api/response/landing_company_response_result.dart b/lib/api/response/landing_company_response_result.dart index 65f777c437..2c5434b3b5 100644 --- a/lib/api/response/landing_company_response_result.dart +++ b/lib/api/response/landing_company_response_result.dart @@ -58,7 +58,7 @@ class LandingCompanyResponse extends LandingCompanyResponseModel { /// Gets landing companies for given [LandingCompanyRequest] /// - /// Throws a [LandingCompanyException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchLandingCompanies( LandingCompanyRequest request, ) async { @@ -67,7 +67,7 @@ class LandingCompanyResponse extends LandingCompanyResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - LandingCompanyException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return LandingCompanyResponse.fromJson(response.landingCompany); @@ -75,7 +75,7 @@ class LandingCompanyResponse extends LandingCompanyResponseModel { /// Gets details of a landing company specified in [LandingCompanyDetailsRequest] /// - /// Throws a [LandingCompanyException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchLandingCompanyDetails( LandingCompanyDetailsRequest request, ) async { @@ -86,7 +86,7 @@ class LandingCompanyResponse extends LandingCompanyResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - LandingCompanyException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return LandingCompanyDetailsResponse.fromJson( diff --git a/lib/api/response/login_history_response_result.dart b/lib/api/response/login_history_response_result.dart index 0e65ea6168..90f67743d8 100644 --- a/lib/api/response/login_history_response_result.dart +++ b/lib/api/response/login_history_response_result.dart @@ -64,7 +64,7 @@ class LoginHistoryResponse extends LoginHistoryResponseModel { /// Retrieves a summary of login history for user. /// /// For parameters information refer to [LoginHistory]. - /// Throws an [AuthorizeException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future fetchHistory([ LoginHistoryRequest? request, ]) async { @@ -75,7 +75,7 @@ class LoginHistoryResponse extends LoginHistoryResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AuthorizeException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return LoginHistoryResponse.fromJson(response.loginHistory); diff --git a/lib/api/response/logout_response_result.dart b/lib/api/response/logout_response_result.dart index 48a9e15500..c72f0a1235 100644 --- a/lib/api/response/logout_response_result.dart +++ b/lib/api/response/logout_response_result.dart @@ -52,7 +52,7 @@ class LogoutResponse extends LogoutResponseModel { /// Logs out from the web-socket's session. /// /// For parameters information refer to [LogoutRequest]. - /// Throws an [AuthorizeException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future logoutMethodRaw([LogoutRequest? request]) async { final LogoutReceive response = await _api.call(request: request ?? const LogoutRequest()); @@ -60,7 +60,7 @@ class LogoutResponse extends LogoutResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AuthorizeException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -69,7 +69,7 @@ class LogoutResponse extends LogoutResponseModel { /// Logs out from the web-socket's session. /// /// For parameters information refer to [LogoutRequest]. - /// Throws an [AuthorizeException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future logoutMethod([LogoutRequest? request]) async { final LogoutReceive response = await logoutMethodRaw(request); diff --git a/lib/api/response/mt5_deposit_response_result.dart b/lib/api/response/mt5_deposit_response_result.dart index 3944d1b990..594ba1936d 100644 --- a/lib/api/response/mt5_deposit_response_result.dart +++ b/lib/api/response/mt5_deposit_response_result.dart @@ -61,14 +61,14 @@ class Mt5DepositResponse extends Mt5DepositResponseModel { /// Allows deposit into MT5 account from binary account. /// /// For parameters information refer to [Mt5DepositRequest]. - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future deposit(Mt5DepositRequest request) async { final Mt5DepositReceive response = await _api.call(request: request); checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - MT5Exception(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return Mt5DepositResponse.fromJson( diff --git a/lib/api/response/mt5_get_settings_response_result.dart b/lib/api/response/mt5_get_settings_response_result.dart index 8430eaa0e0..0f4c73534d 100644 --- a/lib/api/response/mt5_get_settings_response_result.dart +++ b/lib/api/response/mt5_get_settings_response_result.dart @@ -56,7 +56,7 @@ class Mt5GetSettingsResponse extends Mt5GetSettingsResponseModel { /// Gets MT5 user account settings. /// /// For parameters information refer to [Mt5GetSettingsRequest]. - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchSettings( Mt5GetSettingsRequest request, ) async { @@ -65,7 +65,7 @@ class Mt5GetSettingsResponse extends Mt5GetSettingsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - MT5Exception(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return Mt5GetSettingsResponse.fromJson(response.mt5GetSettings); diff --git a/lib/api/response/mt5_login_list_response_result.dart b/lib/api/response/mt5_login_list_response_result.dart index 40dbd21955..2591f6af1b 100644 --- a/lib/api/response/mt5_login_list_response_result.dart +++ b/lib/api/response/mt5_login_list_response_result.dart @@ -64,7 +64,7 @@ class Mt5LoginListResponse extends Mt5LoginListResponseModel { /// Gets the list of MT5 accounts for client. /// /// For parameters information refer to [Mt5LoginListRequest]. - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchLoginList( Mt5LoginListRequest request, ) async { @@ -73,7 +73,7 @@ class Mt5LoginListResponse extends Mt5LoginListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - MT5Exception(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return Mt5LoginListResponse.fromJson(response.mt5LoginList); diff --git a/lib/api/response/mt5_new_account_response_result.dart b/lib/api/response/mt5_new_account_response_result.dart index bf6126eff7..3e3d158412 100644 --- a/lib/api/response/mt5_new_account_response_result.dart +++ b/lib/api/response/mt5_new_account_response_result.dart @@ -69,7 +69,7 @@ class Mt5NewAccountResponse extends Mt5NewAccountResponseModel { /// Creates new MT5 user, either demo or real money user. /// /// For parameters information refer to [Mt5NewAccountRequest]. - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future createNewAccount( Mt5NewAccountRequest request, ) async { @@ -78,7 +78,7 @@ class Mt5NewAccountResponse extends Mt5NewAccountResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - MT5Exception(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return Mt5NewAccountResponse.fromJson(response.mt5NewAccount); @@ -86,7 +86,7 @@ class Mt5NewAccountResponse extends Mt5NewAccountResponseModel { /// Allows deposit into MT5 account from binary account. /// - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future deposit({ required double amount, required String fromBinary, @@ -101,7 +101,7 @@ class Mt5NewAccountResponse extends Mt5NewAccountResponseModel { /// Changes password of the MT5 account. /// - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future changePassword({ required String newPassword, required String oldPassword, @@ -118,7 +118,7 @@ class Mt5NewAccountResponse extends Mt5NewAccountResponseModel { /// Validates the main password for the MT5 user. /// - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future checkPassword({ required String password, required PasswordType passwordType, @@ -133,7 +133,7 @@ class Mt5NewAccountResponse extends Mt5NewAccountResponseModel { /// Resets the password of MT5 account. /// - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future resetPassword({ required String newPassword, required PasswordType passwordType, @@ -150,14 +150,14 @@ class Mt5NewAccountResponse extends Mt5NewAccountResponseModel { /// Gets the MT5 user account settings. /// - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future fetchSettings() => Mt5GetSettingsResponse.fetchSettings( Mt5GetSettingsRequest(login: mt5NewAccount?.login)); /// Allows withdrawal from MT5 account to Binary account. /// - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future withdraw({ required double amount, required String toBinary, diff --git a/lib/api/response/mt5_password_change_response_result.dart b/lib/api/response/mt5_password_change_response_result.dart index 8f496ea504..a6ac7e462e 100644 --- a/lib/api/response/mt5_password_change_response_result.dart +++ b/lib/api/response/mt5_password_change_response_result.dart @@ -52,7 +52,7 @@ class Mt5PasswordChangeResponse extends Mt5PasswordChangeResponseModel { /// Changes the password of the MT5 account. /// /// For parameters information refer to [Mt5PasswordChangeRequest]. - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future changePassword( Mt5PasswordChangeRequest request, ) async { @@ -61,7 +61,7 @@ class Mt5PasswordChangeResponse extends Mt5PasswordChangeResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - MT5Exception(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return Mt5PasswordChangeResponse.fromJson(response.mt5PasswordChange); diff --git a/lib/api/response/mt5_password_check_response_result.dart b/lib/api/response/mt5_password_check_response_result.dart index 80884b7269..b534d8f80a 100644 --- a/lib/api/response/mt5_password_check_response_result.dart +++ b/lib/api/response/mt5_password_check_response_result.dart @@ -52,7 +52,7 @@ class Mt5PasswordCheckResponse extends Mt5PasswordCheckResponseModel { /// Validates the main password for the MT5 user. /// /// For parameters information refer to [Mt5PasswordCheckRequest]. - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future checkPassword( Mt5PasswordCheckRequest request) async { final Mt5PasswordCheckReceive response = await _api.call(request: request); @@ -60,7 +60,7 @@ class Mt5PasswordCheckResponse extends Mt5PasswordCheckResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - MT5Exception(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return Mt5PasswordCheckResponse.fromJson(response.mt5PasswordCheck); diff --git a/lib/api/response/mt5_password_reset_response_result.dart b/lib/api/response/mt5_password_reset_response_result.dart index b1c832805d..f83a757c16 100644 --- a/lib/api/response/mt5_password_reset_response_result.dart +++ b/lib/api/response/mt5_password_reset_response_result.dart @@ -52,7 +52,7 @@ class Mt5PasswordResetResponse extends Mt5PasswordResetResponseModel { /// Resets the password of MT5 account. /// /// For parameters information refer to [Mt5PasswordResetRequest]. - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future resetPassword( Mt5PasswordResetRequest request, ) async { @@ -61,7 +61,7 @@ class Mt5PasswordResetResponse extends Mt5PasswordResetResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - MT5Exception(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return Mt5PasswordResetResponse.fromJson(response.mt5PasswordReset); diff --git a/lib/api/response/mt5_withdrawal_response_result.dart b/lib/api/response/mt5_withdrawal_response_result.dart index e8c046f4bc..c123ca54b2 100644 --- a/lib/api/response/mt5_withdrawal_response_result.dart +++ b/lib/api/response/mt5_withdrawal_response_result.dart @@ -61,7 +61,7 @@ class Mt5WithdrawalResponse extends Mt5WithdrawalResponseModel { /// Allows withdrawal from MT5 account to Binary account. /// /// For parameters information refer to [Mt5WithdrawalRequest]. - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future withdraw( Mt5WithdrawalRequest request, ) async { @@ -70,7 +70,7 @@ class Mt5WithdrawalResponse extends Mt5WithdrawalResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - MT5Exception(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return Mt5WithdrawalResponse.fromJson( diff --git a/lib/api/response/new_account_real_response_result.dart b/lib/api/response/new_account_real_response_result.dart index a303547210..aa47f00328 100644 --- a/lib/api/response/new_account_real_response_result.dart +++ b/lib/api/response/new_account_real_response_result.dart @@ -56,7 +56,7 @@ class NewAccountRealResponse extends NewAccountRealResponseModel { /// Opens a new real account. /// /// For parameters information refer to [NewAccountRealRequest]. - /// Throws a [NewAccountException] ifAP + /// Throws a [BaseAPIException] ifAP static Future openNewRealAccount( NewAccountRealRequest request, ) async { @@ -65,7 +65,7 @@ class NewAccountRealResponse extends NewAccountRealResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - NewAccountException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return NewAccountRealResponse.fromJson(response.newAccountReal); diff --git a/lib/api/response/new_account_virtual_response_result.dart b/lib/api/response/new_account_virtual_response_result.dart index c4f22f7792..2b87d4a37b 100644 --- a/lib/api/response/new_account_virtual_response_result.dart +++ b/lib/api/response/new_account_virtual_response_result.dart @@ -56,7 +56,7 @@ class NewAccountVirtualResponse extends NewAccountVirtualResponseModel { /// Opens a new virtual account. /// /// For parameters information refer to [NewAccountVirtualRequest]. - /// Throws a [NewAccountException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future openNewVirtualAccount( NewAccountVirtualRequest request, ) async { @@ -65,7 +65,7 @@ class NewAccountVirtualResponse extends NewAccountVirtualResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - NewAccountException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return NewAccountVirtualResponse.fromJson(response.newAccountVirtual); diff --git a/lib/api/response/oauth_apps_response_result.dart b/lib/api/response/oauth_apps_response_result.dart index 2d0f2aafcc..3da3325f49 100644 --- a/lib/api/response/oauth_apps_response_result.dart +++ b/lib/api/response/oauth_apps_response_result.dart @@ -63,7 +63,7 @@ class OauthAppsResponse extends OauthAppsResponseModel { /// Gets oauth application that used for the authorized account. /// - /// Throws an [AppException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future fetchOauthApps([ OauthAppsRequest? request, ]) async { @@ -74,7 +74,7 @@ class OauthAppsResponse extends OauthAppsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AppException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return OauthAppsResponse.fromJson(response.oauthApps); diff --git a/lib/api/response/p2p_advert_create_response_result.dart b/lib/api/response/p2p_advert_create_response_result.dart index 9a99fecef5..2c41b1b0b9 100644 --- a/lib/api/response/p2p_advert_create_response_result.dart +++ b/lib/api/response/p2p_advert_create_response_result.dart @@ -1,8 +1,8 @@ // ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import import 'package:equatable/equatable.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; -import 'package:flutter_deriv_api/api/exceptions/p2p_advert_exception.dart'; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_receive.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_send.dart'; @@ -56,7 +56,7 @@ class P2pAdvertCreateResponse extends P2pAdvertCreateResponseModel { /// Creates a P2P (peer to peer) advert. Can only be used by an approved P2P advertiser. /// /// For parameters information refer to [P2pAdvertCreateRequest]. - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future createAdvert( P2pAdvertCreateRequest request, ) async { @@ -68,7 +68,7 @@ class P2pAdvertCreateResponse extends P2pAdvertCreateResponseModel { /// Creates a P2P (peer to peer) advert. Can only be used by an approved P2P advertiser. /// /// For parameters information refer to [P2pAdvertCreateRequest]. - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future createAdvertRaw( P2pAdvertCreateRequest request, ) async { @@ -77,7 +77,7 @@ class P2pAdvertCreateResponse extends P2pAdvertCreateResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/p2p_advert_info_response_result.dart b/lib/api/response/p2p_advert_info_response_result.dart index f2186228d3..561bc9bb6e 100644 --- a/lib/api/response/p2p_advert_info_response_result.dart +++ b/lib/api/response/p2p_advert_info_response_result.dart @@ -77,7 +77,7 @@ class P2pAdvertInfoResponse extends P2pAdvertInfoResponseModel { /// Retrieves information about a P2P (peer to peer) advert. /// /// For parameters information refer to [P2pAdvertInfoRequest]. - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchAdvert( P2pAdvertInfoRequest request, ) async { @@ -90,7 +90,7 @@ class P2pAdvertInfoResponse extends P2pAdvertInfoResponseModel { /// Retrieves information about a P2P (peer to peer) advert. /// /// For parameters information refer to [P2pAdvertInfoRequest]. - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchAdvertRaw( P2pAdvertInfoRequest request, ) async { @@ -99,7 +99,7 @@ class P2pAdvertInfoResponse extends P2pAdvertInfoResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -109,7 +109,7 @@ class P2pAdvertInfoResponse extends P2pAdvertInfoResponseModel { /// /// [delete] to permanently delete the advert /// [isActive] to activate or deactivate the advert - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future update({ bool? delete, bool? isActive, @@ -126,7 +126,7 @@ class P2pAdvertInfoResponse extends P2pAdvertInfoResponseModel { /// /// [delete] to permanently delete the advert /// [isActive] to activate or deactivate the advert - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future updateRaw({ bool? delete, bool? isActive, @@ -141,33 +141,33 @@ class P2pAdvertInfoResponse extends P2pAdvertInfoResponseModel { /// Deletes permanently a P2P (peer to peer) advert. Can only be used by the advertiser. /// - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future delete() => update(delete: true); /// Deletes permanently a P2P (peer to peer) advert. Can only be used by the advertiser. /// - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future deleteRaw() => updateRaw(delete: true); /// Activates a P2P (peer to peer) advert. Can only be used by the advertiser. /// - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future activate() async => update(isActive: true); /// Activates a P2P (peer to peer) advert. Can only be used by the advertiser. /// - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future activateRaw() async => updateRaw(isActive: true); /// Deactivates a P2P (peer to peer) advert. Can only be used by the advertiser. /// - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future deactivate() async => update(isActive: false); /// Deactivates a P2P (peer to peer) advert. Can only be used by the advertiser. /// - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future deactivateRaw() async => updateRaw(isActive: false); @@ -176,7 +176,7 @@ class P2pAdvertInfoResponse extends P2pAdvertInfoResponseModel { /// [amount] is the amount of currency to be bought or sold. /// [contactInfo] is seller contact information. Only applicable for [OrderType.sell]. /// [paymentInfo] is payment instructions. Only applicable for [OrderType.sell]. - /// Throws [P2POrderException] if API response contains an error. + /// Throws [BaseAPIException] if API response contains an error. Future createOrder({ required double amount, String? contactInfo, @@ -197,7 +197,7 @@ class P2pAdvertInfoResponse extends P2pAdvertInfoResponseModel { /// [amount] is the amount of currency to be bought or sold. /// [contactInfo] is seller contact information. Only applicable for [OrderType.sell]. /// [paymentInfo] is payment instructions. Only applicable for [OrderType.sell]. - /// Throws [P2POrderException] if API response contains an error. + /// Throws [BaseAPIException] if API response contains an error. Future createOrderRaw({ required double amount, String? contactInfo, diff --git a/lib/api/response/p2p_advert_list_response_result.dart b/lib/api/response/p2p_advert_list_response_result.dart index 0b6f31c80a..a42934b371 100644 --- a/lib/api/response/p2p_advert_list_response_result.dart +++ b/lib/api/response/p2p_advert_list_response_result.dart @@ -1,8 +1,8 @@ // ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import import 'package:equatable/equatable.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; -import 'package:flutter_deriv_api/api/exceptions/p2p_advert_exception.dart'; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_receive.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_send.dart'; @@ -56,7 +56,7 @@ class P2pAdvertListResponse extends P2pAdvertListResponseModel { /// Returns available adverts. /// /// For parameters information refer to [P2pAdvertListRequest]. - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchAdvertList( P2pAdvertListRequest request, ) async { @@ -68,7 +68,7 @@ class P2pAdvertListResponse extends P2pAdvertListResponseModel { /// Returns available adverts. /// /// For parameters information refer to [P2pAdvertListRequest]. - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchAdvertListRaw( P2pAdvertListRequest request, ) async { @@ -77,7 +77,7 @@ class P2pAdvertListResponse extends P2pAdvertListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/p2p_advert_update_response_result.dart b/lib/api/response/p2p_advert_update_response_result.dart index c4cf25b319..7c0c1ff086 100644 --- a/lib/api/response/p2p_advert_update_response_result.dart +++ b/lib/api/response/p2p_advert_update_response_result.dart @@ -56,7 +56,7 @@ class P2pAdvertUpdateResponse extends P2pAdvertUpdateResponseModel { /// Updates a P2P (peer to peer) advert. Can only be used by the advertiser. /// /// For parameters information refer to [P2pAdvertUpdateRequest]. - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future updateAdvert( P2pAdvertUpdateRequest request, ) async { @@ -68,7 +68,7 @@ class P2pAdvertUpdateResponse extends P2pAdvertUpdateResponseModel { /// Updates a P2P (peer to peer) advert. Can only be used by the advertiser. /// /// For parameters information refer to [P2pAdvertUpdateRequest]. - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future updateAdvertRaw( P2pAdvertUpdateRequest request, ) async { @@ -77,7 +77,7 @@ class P2pAdvertUpdateResponse extends P2pAdvertUpdateResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/p2p_advertiser_adverts_response_result.dart b/lib/api/response/p2p_advertiser_adverts_response_result.dart index 009499b828..4830ba2a78 100644 --- a/lib/api/response/p2p_advertiser_adverts_response_result.dart +++ b/lib/api/response/p2p_advertiser_adverts_response_result.dart @@ -77,7 +77,7 @@ class P2pAdvertiserAdvertsResponse extends P2pAdvertiserAdvertsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertiserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/p2p_advertiser_create_response_result.dart b/lib/api/response/p2p_advertiser_create_response_result.dart index 68bcc98fc5..abb9fc5f7f 100644 --- a/lib/api/response/p2p_advertiser_create_response_result.dart +++ b/lib/api/response/p2p_advertiser_create_response_result.dart @@ -92,7 +92,7 @@ class P2pAdvertiserCreateResponse extends P2pAdvertiserCreateResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertiserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -129,7 +129,7 @@ class P2pAdvertiserCreateResponse extends P2pAdvertiserCreateResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertiserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is P2pAdvertiserCreateReceive ? response : null; diff --git a/lib/api/response/p2p_advertiser_info_response_result.dart b/lib/api/response/p2p_advertiser_info_response_result.dart index 77bfc31f50..7d0da5dc1e 100644 --- a/lib/api/response/p2p_advertiser_info_response_result.dart +++ b/lib/api/response/p2p_advertiser_info_response_result.dart @@ -76,7 +76,7 @@ class P2pAdvertiserInfoResponse extends P2pAdvertiserInfoResponseModel { /// Retrieves information about a P2P (peer to peer) advertiser. /// /// For parameters information refer to [P2pAdvertiserInfoRequest]. - /// Throws a [P2PAdvertiserException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future fetchAdvertiserInformation( P2pAdvertiserInfoRequest request, ) async { @@ -90,7 +90,7 @@ class P2pAdvertiserInfoResponse extends P2pAdvertiserInfoResponseModel { /// Retrieves information about a P2P (peer to peer) advertiser. /// /// For parameters information refer to [P2pAdvertiserInfoRequest]. - /// Throws a [P2PAdvertiserException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future fetchAdvertiserInformationRaw( P2pAdvertiserInfoRequest request, ) async { @@ -132,7 +132,7 @@ class P2pAdvertiserInfoResponse extends P2pAdvertiserInfoResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertiserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is P2pAdvertiserInfoReceive ? response : null; @@ -141,7 +141,7 @@ class P2pAdvertiserInfoResponse extends P2pAdvertiserInfoResponseModel { /// Unsubscribes from P2P (peer to peer) advertiser information. /// - /// Throws a [P2PAdvertiserException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. Future unsubscribeAdvertiser() async { if (subscription == null) { return null; @@ -153,7 +153,7 @@ class P2pAdvertiserInfoResponse extends P2pAdvertiserInfoResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertiserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetResponse.fromJson(response.forget); @@ -161,7 +161,7 @@ class P2pAdvertiserInfoResponse extends P2pAdvertiserInfoResponseModel { /// Unsubscribes all P2P (peer to peer) advertisers. /// - /// Throws a [P2PAdvertiserException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future unsubscribeAllAdvertiser() async { final ForgetAllReceive response = await _api.unsubscribeAll(method: ForgetStreamType.p2pAdvertiser); @@ -169,7 +169,7 @@ class P2pAdvertiserInfoResponse extends P2pAdvertiserInfoResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertiserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetAllResponse.fromJson(response.forgetAll); diff --git a/lib/api/response/p2p_advertiser_list_response_result.dart b/lib/api/response/p2p_advertiser_list_response_result.dart index c32c40ee20..3f08084852 100644 --- a/lib/api/response/p2p_advertiser_list_response_result.dart +++ b/lib/api/response/p2p_advertiser_list_response_result.dart @@ -62,7 +62,7 @@ class P2pAdvertiserListResponse extends P2pAdvertiserListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertiserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/p2p_advertiser_payment_methods_response_result.dart b/lib/api/response/p2p_advertiser_payment_methods_response_result.dart index 6207a8c885..5b86419857 100644 --- a/lib/api/response/p2p_advertiser_payment_methods_response_result.dart +++ b/lib/api/response/p2p_advertiser_payment_methods_response_result.dart @@ -64,7 +64,7 @@ class P2pAdvertiserPaymentMethodsResponse /// Manage or list P2P advertiser payment methods. /// /// For parameters information refer to [P2pAdvertiserPaymentMethodsRequest]. - /// Throws an [P2PAdvertiserException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future fetchMethodsRaw( P2pAdvertiserPaymentMethodsRequest request, ) async { @@ -74,7 +74,7 @@ class P2pAdvertiserPaymentMethodsResponse checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertiserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -83,7 +83,7 @@ class P2pAdvertiserPaymentMethodsResponse /// Manage or list P2P advertiser payment methods. /// /// For parameters information refer to [P2pAdvertiserPaymentMethodsRequest]. - /// Throws an [P2PAdvertiserException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future fetchMethods( P2pAdvertiserPaymentMethodsRequest request, ) async { diff --git a/lib/api/response/p2p_advertiser_relations_response_result.dart b/lib/api/response/p2p_advertiser_relations_response_result.dart index f60863450f..aebad9df82 100644 --- a/lib/api/response/p2p_advertiser_relations_response_result.dart +++ b/lib/api/response/p2p_advertiser_relations_response_result.dart @@ -57,7 +57,7 @@ class P2pAdvertiserRelationsResponse /// Updates and returns favourite and blocked advertisers of the current user. /// /// For parameters information refer to [P2pAdvertiserRelationsRequest]. - /// Throws an [P2PAdvertiserException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future fetchRaw( P2pAdvertiserRelationsRequest request, ) async { @@ -67,7 +67,7 @@ class P2pAdvertiserRelationsResponse checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertiserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -76,7 +76,7 @@ class P2pAdvertiserRelationsResponse /// Updates and returns favourite and blocked advertisers of the current user. /// /// For parameters information refer to [P2pAdvertiserRelationsRequest]. - /// Throws an [P2PAdvertiserException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future fetch( P2pAdvertiserRelationsRequest request, ) async { diff --git a/lib/api/response/p2p_advertiser_update_response_result.dart b/lib/api/response/p2p_advertiser_update_response_result.dart index 115139e539..c6c470e5f5 100644 --- a/lib/api/response/p2p_advertiser_update_response_result.dart +++ b/lib/api/response/p2p_advertiser_update_response_result.dart @@ -77,7 +77,7 @@ class P2pAdvertiserUpdateResponse extends P2pAdvertiserUpdateResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertiserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/p2p_chat_create_response_result.dart b/lib/api/response/p2p_chat_create_response_result.dart index 32fb719aac..7a9764e85c 100644 --- a/lib/api/response/p2p_chat_create_response_result.dart +++ b/lib/api/response/p2p_chat_create_response_result.dart @@ -77,7 +77,7 @@ class P2pChatCreateResponse extends P2pChatCreateResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PChatException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/p2p_order_cancel_response_result.dart b/lib/api/response/p2p_order_cancel_response_result.dart index e7bc907df0..b38f92e2c4 100644 --- a/lib/api/response/p2p_order_cancel_response_result.dart +++ b/lib/api/response/p2p_order_cancel_response_result.dart @@ -55,7 +55,7 @@ class P2pOrderCancelResponse extends P2pOrderCancelResponseModel { /// Cancel a P2P order. /// /// For parameters information refer to [P2pOrderCancelRequest]. - /// Throws a [P2POrderException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future cancelOrderRaw( P2pOrderCancelRequest request, ) async { @@ -64,7 +64,7 @@ class P2pOrderCancelResponse extends P2pOrderCancelResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -73,7 +73,7 @@ class P2pOrderCancelResponse extends P2pOrderCancelResponseModel { /// Cancel a P2P order. /// /// For parameters information refer to [P2pOrderCancelRequest]. - /// Throws a [P2POrderException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future cancelOrder( P2pOrderCancelRequest request, ) async { diff --git a/lib/api/response/p2p_order_confirm_response_result.dart b/lib/api/response/p2p_order_confirm_response_result.dart index c1d6c9de3a..e0fc40b8b2 100644 --- a/lib/api/response/p2p_order_confirm_response_result.dart +++ b/lib/api/response/p2p_order_confirm_response_result.dart @@ -55,7 +55,7 @@ class P2pOrderConfirmResponse extends P2pOrderConfirmResponseModel { /// Cancel a P2P order confirm. /// /// For parameters information refer to [P2pOrderConfirmRequest]. - /// Throws an [P2POrderException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future confirmOrderRaw( P2pOrderConfirmRequest request, ) async { @@ -64,7 +64,7 @@ class P2pOrderConfirmResponse extends P2pOrderConfirmResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -73,7 +73,7 @@ class P2pOrderConfirmResponse extends P2pOrderConfirmResponseModel { /// Cancel a P2P order confirm. /// /// For parameters information refer to [P2pOrderConfirmRequest]. - /// Throws an [P2POrderException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future confirmOrder( P2pOrderConfirmRequest request, ) async { diff --git a/lib/api/response/p2p_order_create_response_result.dart b/lib/api/response/p2p_order_create_response_result.dart index 31f3270e02..0c0b04b3af 100644 --- a/lib/api/response/p2p_order_create_response_result.dart +++ b/lib/api/response/p2p_order_create_response_result.dart @@ -85,7 +85,7 @@ class P2pOrderCreateResponse extends P2pOrderCreateResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -93,7 +93,7 @@ class P2pOrderCreateResponse extends P2pOrderCreateResponseModel { /// Creates order and subscribes to the result with parameters specified in [P2pOrderCreateRequest] /// - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Stream createAndSubscribe( P2pOrderCreateRequest request, { RequestCompareFunction? comparePredicate, @@ -112,7 +112,7 @@ class P2pOrderCreateResponse extends P2pOrderCreateResponseModel { /// Creates order and subscribes to the result with parameters specified in [P2pOrderCreateRequest] /// - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Stream createAndSubscribeRaw( P2pOrderCreateRequest request, { RequestCompareFunction? comparePredicate, @@ -122,7 +122,7 @@ class P2pOrderCreateResponse extends P2pOrderCreateResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is P2pOrderCreateReceive ? response : null; diff --git a/lib/api/response/p2p_order_dispute_response_result.dart b/lib/api/response/p2p_order_dispute_response_result.dart index 8344e5511e..a2bdaae1be 100644 --- a/lib/api/response/p2p_order_dispute_response_result.dart +++ b/lib/api/response/p2p_order_dispute_response_result.dart @@ -56,7 +56,7 @@ class P2pOrderDisputeResponse extends P2pOrderDisputeResponseModel { /// Cancel a P2P order dispute. /// /// For parameters information refer to [P2pOrderDisputeRequest]. - /// Throws an [P2POrderException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future disputeOrderRaw( P2pOrderDisputeRequest request, ) async { @@ -65,7 +65,7 @@ class P2pOrderDisputeResponse extends P2pOrderDisputeResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -74,7 +74,7 @@ class P2pOrderDisputeResponse extends P2pOrderDisputeResponseModel { /// Cancel a P2P order dispute. /// /// For parameters information refer to [P2pOrderDisputeRequest]. - /// Throws an [P2POrderException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future disputeOrder( P2pOrderDisputeRequest request, ) async { diff --git a/lib/api/response/p2p_order_info_response_result.dart b/lib/api/response/p2p_order_info_response_result.dart index 972339e3ce..e3785742ed 100644 --- a/lib/api/response/p2p_order_info_response_result.dart +++ b/lib/api/response/p2p_order_info_response_result.dart @@ -81,7 +81,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { /// Gets order with parameters specified in [P2pOrderInfoRequest] /// - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchOrder( P2pOrderInfoRequest request) async { final P2pOrderInfoReceive response = await fetchOrderRaw(request); @@ -92,7 +92,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { /// Gets order with parameters specified in [P2pOrderInfoRequest] /// - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchOrderRaw( P2pOrderInfoRequest request) async { final P2pOrderInfoReceive response = await _api.call(request: request); @@ -100,7 +100,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -126,7 +126,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { /// Subscribes to order with parameters specified in [P2pOrderInfoRequest] /// - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Stream subscribeOrder( P2pOrderInfoRequest request, { RequestCompareFunction? comparePredicate, @@ -145,7 +145,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { /// Subscribes to order with parameters specified in [P2pOrderInfoRequest] /// - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Stream subscribeOrderRaw( P2pOrderInfoRequest request, { RequestCompareFunction? comparePredicate, @@ -157,7 +157,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is P2pOrderInfoReceive ? response : null; @@ -166,7 +166,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { /// Unsubscribes from order subscription. /// - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future unsubscribeOrder() async { if (subscription == null) { return null; @@ -178,7 +178,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetResponse.fromJson(response.forget); @@ -186,7 +186,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { /// Unsubscribes all order subscriptions (Subscriptions to a single order or list). /// - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future unsubscribeAllOrder() async { final ForgetAllReceive response = await _api.unsubscribeAll(method: ForgetStreamType.p2pOrder); @@ -194,7 +194,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetAllResponse.fromJson(response.forgetAll); @@ -203,7 +203,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { /// Cancels this order /// /// Returns an order with updated status if successful. - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future cancel() async { final P2pOrderCancelReceive response = await cancelRaw(); return P2pOrderCancelResponse.fromJson(response.p2pOrderCancel); @@ -212,7 +212,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { /// Cancels this order /// /// Returns an order with updated status if successful. - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future cancelRaw() async { final P2pOrderCancelReceive response = await _api.call(request: P2pOrderCancelRequest(id: p2pOrderInfo?.id)); @@ -220,7 +220,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -229,7 +229,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { /// Confirms this order /// /// Returns an order with updated status if successful. - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future confirm() async { final P2pOrderConfirmReceive response = await confirmRaw(); @@ -239,7 +239,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { /// Confirms this order /// /// Returns an order with updated status if successful. - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future confirmRaw() async { final P2pOrderConfirmReceive response = await _api.call(request: P2pOrderConfirmRequest(id: p2pOrderInfo?.id)); @@ -247,7 +247,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/p2p_order_list_response_result.dart b/lib/api/response/p2p_order_list_response_result.dart index 2a0459a68f..d094361c9a 100644 --- a/lib/api/response/p2p_order_list_response_result.dart +++ b/lib/api/response/p2p_order_list_response_result.dart @@ -94,7 +94,7 @@ class P2pOrderListResponse extends P2pOrderListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -132,7 +132,7 @@ class P2pOrderListResponse extends P2pOrderListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is P2pOrderListReceive ? response : null; @@ -141,7 +141,7 @@ class P2pOrderListResponse extends P2pOrderListResponseModel { /// Unsubscribes from order list subscription. /// - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future unsubscribeOrderList() async { if (subscription == null) { return null; @@ -153,7 +153,7 @@ class P2pOrderListResponse extends P2pOrderListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetResponse.fromJson(response.forget); @@ -161,7 +161,7 @@ class P2pOrderListResponse extends P2pOrderListResponseModel { /// Unsubscribes from all order subscriptions (Subscriptions to a single order or list). /// - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future unsubscribeAllOrder() => P2pOrderInfoResponse.unsubscribeAllOrder(); diff --git a/lib/api/response/p2p_order_review_response_result.dart b/lib/api/response/p2p_order_review_response_result.dart index e33f52528e..8e4e29fe9b 100644 --- a/lib/api/response/p2p_order_review_response_result.dart +++ b/lib/api/response/p2p_order_review_response_result.dart @@ -55,7 +55,7 @@ class P2pOrderReviewResponse extends P2pOrderReviewResponseModel { /// Cancel a P2P order review. /// /// For parameters information refer to [P2pOrderReviewReceive]. - /// Throws an [P2POrderException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future reviewOrderRaw( P2pOrderReviewRequest request, ) async { @@ -64,7 +64,7 @@ class P2pOrderReviewResponse extends P2pOrderReviewResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -73,7 +73,7 @@ class P2pOrderReviewResponse extends P2pOrderReviewResponseModel { /// Cancel a P2P order review. /// /// For parameters information refer to [P2pOrderReviewReceive]. - /// Throws an [P2POrderException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future reviewOrder( P2pOrderReviewRequest request, ) async { diff --git a/lib/api/response/p2p_payment_methods_response_result.dart b/lib/api/response/p2p_payment_methods_response_result.dart index a7d130588f..7a464168ae 100644 --- a/lib/api/response/p2p_payment_methods_response_result.dart +++ b/lib/api/response/p2p_payment_methods_response_result.dart @@ -73,7 +73,7 @@ class P2pPaymentMethodsResponse extends P2pPaymentMethodsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/payment_methods_response_result.dart b/lib/api/response/payment_methods_response_result.dart index 32b4aa502d..7847473d31 100644 --- a/lib/api/response/payment_methods_response_result.dart +++ b/lib/api/response/payment_methods_response_result.dart @@ -63,7 +63,7 @@ class PaymentMethodsResponse extends PaymentMethodsResponseModel { /// Get List of available payment methods for a given country. /// /// For parameters information refer to [PaymentMethodsRequest]. - /// Throws an [PaymentException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future updateApplication( PaymentMethodsRequest request) async { final PaymentMethodsReceive response = await _api.call(request: request); @@ -71,7 +71,7 @@ class PaymentMethodsResponse extends PaymentMethodsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - PaymentException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return PaymentMethodsResponse.fromJson(response.paymentMethods); diff --git a/lib/api/response/paymentagent_list_response_result.dart b/lib/api/response/paymentagent_list_response_result.dart index 2656b74821..fd0c3f7d7b 100644 --- a/lib/api/response/paymentagent_list_response_result.dart +++ b/lib/api/response/paymentagent_list_response_result.dart @@ -56,7 +56,7 @@ class PaymentagentListResponse extends PaymentagentListResponseModel { /// Returns a list of Payment Agents for a given country for a given currency. /// /// For parameters information refer to [PaymentagentListRequest]. - /// Throws a [PaymentAgentException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetch( PaymentagentListRequest request, ) async { @@ -65,7 +65,7 @@ class PaymentagentListResponse extends PaymentagentListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - PaymentAgentException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return PaymentagentListResponse.fromJson(response.paymentagentList); diff --git a/lib/api/response/paymentagent_transfer_response_result.dart b/lib/api/response/paymentagent_transfer_response_result.dart index c210072c7c..5367e3d2f9 100644 --- a/lib/api/response/paymentagent_transfer_response_result.dart +++ b/lib/api/response/paymentagent_transfer_response_result.dart @@ -80,7 +80,7 @@ class PaymentagentTransferResponse extends PaymentagentTransferResponseModel { /// /// This call is available only to accounts that are approved payment agents. /// For parameters information refer to [PaymentagentTransferRequest]. - /// Throws a [PaymentAgentException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future transfer( PaymentagentTransferRequest request, ) async { @@ -90,7 +90,7 @@ class PaymentagentTransferResponse extends PaymentagentTransferResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - PaymentAgentException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return PaymentagentTransferResponse.fromJson( diff --git a/lib/api/response/paymentagent_withdraw_response_result.dart b/lib/api/response/paymentagent_withdraw_response_result.dart index 4caa274b66..e416a89f67 100644 --- a/lib/api/response/paymentagent_withdraw_response_result.dart +++ b/lib/api/response/paymentagent_withdraw_response_result.dart @@ -70,7 +70,7 @@ class PaymentagentWithdrawResponse extends PaymentagentWithdrawResponseModel { /// Initiates a withdrawal to an approved payment agent. /// /// For parameters information refer to [PaymentagentWithdrawRequest]. - /// Throws a [PaymentAgentException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future withdraw( PaymentagentWithdrawRequest request, ) async { @@ -80,7 +80,7 @@ class PaymentagentWithdrawResponse extends PaymentagentWithdrawResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - PaymentAgentException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return PaymentagentWithdrawResponse.fromJson(response.paymentagentWithdraw, diff --git a/lib/api/response/payout_currencies_response_result.dart b/lib/api/response/payout_currencies_response_result.dart index 5b556e045f..3186bf5fa8 100644 --- a/lib/api/response/payout_currencies_response_result.dart +++ b/lib/api/response/payout_currencies_response_result.dart @@ -64,7 +64,7 @@ class PayoutCurrenciesResponse extends PayoutCurrenciesResponseModel { /// Retrieves a list of available option payout currencies. /// /// If a user is logged in, only the currencies available for the account will be returned. - /// Throws a [PayoutCurrencyException] if API response contains a error + /// Throws a [BaseAPIException] if API response contains a error static Future fetchPayoutCurrencies([ PayoutCurrenciesRequest? request, ]) async { @@ -75,7 +75,7 @@ class PayoutCurrenciesResponse extends PayoutCurrenciesResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - PayoutCurrencyException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return PayoutCurrenciesResponse.fromJson(response.payoutCurrencies); diff --git a/lib/api/response/ping_response_result.dart b/lib/api/response/ping_response_result.dart index beaebf0d02..d9cd881e22 100644 --- a/lib/api/response/ping_response_result.dart +++ b/lib/api/response/ping_response_result.dart @@ -54,7 +54,7 @@ class PingResponse extends PingResponseModel { /// Requests the ping request to the server. /// /// Mostly used to test the connection or to keep it alive. - /// Throws a [PingException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future pingMethodRaw([PingRequest? request]) async { final PingReceive response = await _api.call( request: request ?? const PingRequest(), @@ -63,7 +63,7 @@ class PingResponse extends PingResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - PingException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -72,7 +72,7 @@ class PingResponse extends PingResponseModel { /// Requests the ping request to the server. /// /// Mostly used to test the connection or to keep it alive. - /// Throws a [PingException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future pingMethod([PingRequest? request]) async { final PingReceive response = await pingMethodRaw(request); diff --git a/lib/api/response/portfolio_response_result.dart b/lib/api/response/portfolio_response_result.dart index caab859ee2..86e4e44e9c 100644 --- a/lib/api/response/portfolio_response_result.dart +++ b/lib/api/response/portfolio_response_result.dart @@ -54,7 +54,7 @@ class PortfolioResponse extends PortfolioResponseModel { /// Gets the portfolio fo logged-in account /// - /// Throws a [PortfolioException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchPortfolio( PortfolioRequest request) async { final PortfolioReceive response = await _api.call(request: request); @@ -62,7 +62,7 @@ class PortfolioResponse extends PortfolioResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - PortfolioException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return PortfolioResponse.fromJson(response.portfolio); diff --git a/lib/api/response/profit_table_response_result.dart b/lib/api/response/profit_table_response_result.dart index 38a3e3739a..c4593de8aa 100644 --- a/lib/api/response/profit_table_response_result.dart +++ b/lib/api/response/profit_table_response_result.dart @@ -56,14 +56,14 @@ class ProfitTableResponse extends ProfitTableResponseModel { /// Retrieves a summary of account Profit Table, according to given search criteria. /// /// For parameters information refer to [ProfitTableRequest]. - /// Throws a [ProfitTableException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetch(ProfitTableRequest request) async { final ProfitTableReceive response = await _api.call(request: request); checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ProfitTableException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ProfitTableResponse.fromJson(response.profitTable); diff --git a/lib/api/response/proposal_open_contract_response_result.dart b/lib/api/response/proposal_open_contract_response_result.dart index 4ccf0bf686..c233b7dec7 100644 --- a/lib/api/response/proposal_open_contract_response_result.dart +++ b/lib/api/response/proposal_open_contract_response_result.dart @@ -79,7 +79,7 @@ class ProposalOpenContractResponse extends ProposalOpenContractResponseModel { /// Gets the current spot of the the bought contract specified in [ProposalOpenContractRequest] /// - /// Throws a [ContractOperationException] if API response contains any error + /// Throws a [BaseAPIException] if API response contains any error static Future fetchContractState( ProposalOpenContractRequest request, ) async { @@ -90,7 +90,7 @@ class ProposalOpenContractResponse extends ProposalOpenContractResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ProposalOpenContractResponse.fromJson( @@ -99,7 +99,7 @@ class ProposalOpenContractResponse extends ProposalOpenContractResponseModel { /// Subscribes to the bought contract state specified in [ProposalOpenContractRequest] /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Stream subscribeContractState( ProposalOpenContractRequest request, { RequestCompareFunction? comparePredicate, @@ -111,8 +111,7 @@ class ProposalOpenContractResponse extends ProposalOpenContractResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException( - baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is ProposalOpenContractReceive @@ -126,7 +125,7 @@ class ProposalOpenContractResponse extends ProposalOpenContractResponseModel { /// Unsubscribes from open contract subscription. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future unsubscribeOpenContract() async { if (subscription == null) { return null; @@ -138,7 +137,7 @@ class ProposalOpenContractResponse extends ProposalOpenContractResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetResponse.fromJson(response.forget); @@ -146,7 +145,7 @@ class ProposalOpenContractResponse extends ProposalOpenContractResponseModel { /// Unsubscribes all open contract subscriptions. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future unsubscribeAllOpenContract() async { final ForgetAllReceive response = await _api.unsubscribeAll( method: ForgetStreamType.proposalOpenContract, @@ -155,7 +154,7 @@ class ProposalOpenContractResponse extends ProposalOpenContractResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetAllResponse.fromJson(response.forgetAll); @@ -165,14 +164,14 @@ class ProposalOpenContractResponse extends ProposalOpenContractResponseModel { /// /// [price] is the Minimum price at which to sell the contract, /// Default be 0 for 'sell at market'. - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future sell( {required int contractId, double price = 0}) => SellResponse.sellContract(SellRequest(sell: contractId, price: price)); /// Cancels this contract /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future cancel(int contractId) => CancelResponse.cancelContract(CancelRequest(cancel: contractId)); diff --git a/lib/api/response/proposal_response_result.dart b/lib/api/response/proposal_response_result.dart index 2df2317e58..00df4fd869 100644 --- a/lib/api/response/proposal_response_result.dart +++ b/lib/api/response/proposal_response_result.dart @@ -1,9 +1,8 @@ // ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import import 'package:equatable/equatable.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; -import 'package:flutter_deriv_api/api/exceptions/contract_operations_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/api/models/enums.dart'; import 'package:flutter_deriv_api/api/response/buy_response_result.dart'; import 'package:flutter_deriv_api/api/response/forget_all_response_result.dart'; @@ -77,7 +76,7 @@ class ProposalResponse extends ProposalResponseModel { /// Gets the price proposal for contract /// /// For parameters information refer to [ProposalRequest] - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchPriceForContract( ProposalRequest request, ) async { @@ -86,7 +85,7 @@ class ProposalResponse extends ProposalResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ProposalResponse.fromJson(response.proposal, response.subscription); @@ -95,7 +94,7 @@ class ProposalResponse extends ProposalResponseModel { /// Gets the price proposal for contract. /// /// For parameters information refer to [ProposalRequest] - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Stream subscribePriceForContract( ProposalRequest request, { RequestCompareFunction? comparePredicate, @@ -107,8 +106,7 @@ class ProposalResponse extends ProposalResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException( - baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is ProposalReceive @@ -122,7 +120,7 @@ class ProposalResponse extends ProposalResponseModel { /// Unsubscribes from price proposal subscription. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future unsubscribeProposal() async { if (subscription == null) { return null; @@ -134,7 +132,7 @@ class ProposalResponse extends ProposalResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetResponse.fromJson(response.forget); @@ -142,7 +140,7 @@ class ProposalResponse extends ProposalResponseModel { /// Unsubscribes all proposal subscriptions. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future unsubscribeAllProposal() async { final ForgetAllReceive response = await _api.unsubscribeAll(method: ForgetStreamType.proposal); @@ -150,7 +148,7 @@ class ProposalResponse extends ProposalResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetAllResponse.fromJson(response.forgetAll); @@ -158,7 +156,7 @@ class ProposalResponse extends ProposalResponseModel { /// Buys this proposal contract with [price] specified. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future buy({double? price}) => BuyResponse.buyMethod(BuyRequest( buy: proposal?.id, price: price ?? proposal?.askPrice, @@ -166,7 +164,7 @@ class ProposalResponse extends ProposalResponseModel { /// Buys this proposal contract with [price] specified and subscribes to it. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Stream buyAndSubscribe({double? price}) => BuyResponse.buyAndSubscribe(BuyRequest( buy: proposal?.id, diff --git a/lib/api/response/reality_check_response_result.dart b/lib/api/response/reality_check_response_result.dart index 53a719a58a..e2e438b247 100644 --- a/lib/api/response/reality_check_response_result.dart +++ b/lib/api/response/reality_check_response_result.dart @@ -58,7 +58,7 @@ class RealityCheckResponse extends RealityCheckResponseModel { /// A `reality check` means a display of time elapsed since the session began, and associated client profit/loss. /// The reality check facility is a regulatory requirement for certain landing companies. /// For parameters information refer to [RealityCheckRequest]. - /// Throws a [RealityCheckException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future check([ RealityCheckRequest? request, ]) async { @@ -69,7 +69,7 @@ class RealityCheckResponse extends RealityCheckResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - RealityCheckException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return RealityCheckResponse.fromJson(response.realityCheck); diff --git a/lib/api/response/reset_password_response_result.dart b/lib/api/response/reset_password_response_result.dart index bbfdbf6f90..12100483f2 100644 --- a/lib/api/response/reset_password_response_result.dart +++ b/lib/api/response/reset_password_response_result.dart @@ -58,7 +58,7 @@ class ResetPasswordResponse extends ResetPasswordResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - UserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ResetPasswordResponse.fromJson(response?.resetPassword); diff --git a/lib/api/response/residence_list_response_result.dart b/lib/api/response/residence_list_response_result.dart index 17aa6b3cfd..d581630799 100644 --- a/lib/api/response/residence_list_response_result.dart +++ b/lib/api/response/residence_list_response_result.dart @@ -63,7 +63,7 @@ class ResidenceListResponse extends ResidenceListResponseModel { /// Gets Residence list for the given [ResidenceListRequest] /// - /// Throws a [ResidenceException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchResidenceList([ ResidenceListRequest? request, ]) async { @@ -74,7 +74,7 @@ class ResidenceListResponse extends ResidenceListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ResidenceException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ResidenceListResponse.fromJson(response.residenceList); diff --git a/lib/api/response/revoke_oauth_app_response_result.dart b/lib/api/response/revoke_oauth_app_response_result.dart index c37c883105..ab6cda2c65 100644 --- a/lib/api/response/revoke_oauth_app_response_result.dart +++ b/lib/api/response/revoke_oauth_app_response_result.dart @@ -52,7 +52,7 @@ class RevokeOauthAppResponse extends RevokeOauthAppResponseModel { /// Revokes access of a particular app. /// /// For parameters information refer to [RevokeOauthAppRequest]. - /// Throws an [AppException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future revokeOauthApplication( RevokeOauthAppRequest request, ) async { @@ -61,7 +61,7 @@ class RevokeOauthAppResponse extends RevokeOauthAppResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AppException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return RevokeOauthAppResponse.fromJson(response.revokeOauthApp); diff --git a/lib/api/response/sell_response_result.dart b/lib/api/response/sell_response_result.dart index c7950c4531..8bf308af2c 100644 --- a/lib/api/response/sell_response_result.dart +++ b/lib/api/response/sell_response_result.dart @@ -56,14 +56,14 @@ class SellResponse extends SellResponseModel { /// Sells a contract with parameters specified in [SellRequest]. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future sellContract(SellRequest request) async { final SellReceive response = await _api.call(request: request); checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return SellResponse.fromJson(response.sell); @@ -71,7 +71,7 @@ class SellResponse extends SellResponseModel { /// tries to sell any expired contracts and returns the number of sold contracts as [SellExpiredContractModel]. /// - /// Throws [ContractOperationException] if API response contains an error + /// Throws [BaseAPIException] if API response contains an error static Future sellExpiredContracts([ SellExpiredRequest? request, ]) async { @@ -82,7 +82,7 @@ class SellResponse extends SellResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return SellExpiredResponse.fromJson(response.sellExpired); diff --git a/lib/api/response/service_token_response_result.dart b/lib/api/response/service_token_response_result.dart index 69be61aaf3..d11b839196 100644 --- a/lib/api/response/service_token_response_result.dart +++ b/lib/api/response/service_token_response_result.dart @@ -58,7 +58,7 @@ class ServiceTokenResponse extends ServiceTokenResponseModel { /// /// Retrieves the authorization token for the specified service. /// For parameters information refer to [ServiceTokenRequest]. - /// Throws a [APITokenException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future getServiceTokenRaw( ServiceTokenRequest request, ) async { @@ -67,7 +67,7 @@ class ServiceTokenResponse extends ServiceTokenResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - APITokenException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -77,7 +77,7 @@ class ServiceTokenResponse extends ServiceTokenResponseModel { /// /// Retrieves the authorization token for the specified service. /// For parameters information refer to [ServiceTokenRequest]. - /// Throws a [APITokenException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future getServiceToken( ServiceTokenRequest request, ) async { diff --git a/lib/api/response/set_account_currency_response_result.dart b/lib/api/response/set_account_currency_response_result.dart index 162d16114a..e468ea9aa2 100644 --- a/lib/api/response/set_account_currency_response_result.dart +++ b/lib/api/response/set_account_currency_response_result.dart @@ -53,7 +53,7 @@ class SetAccountCurrencyResponse extends SetAccountCurrencyResponseModel { /// /// Please note that account currency can only be set once, and then can never be changed. /// For parameters information refer to [SetAccountCurrencyRequest]. - /// Throws an [AccountCurrencyException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future setCurrency( SetAccountCurrencyRequest request, ) async { @@ -63,7 +63,7 @@ class SetAccountCurrencyResponse extends SetAccountCurrencyResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AccountCurrencyException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return SetAccountCurrencyResponse.fromJson(response.setAccountCurrency); diff --git a/lib/api/response/set_financial_assessment_response_result.dart b/lib/api/response/set_financial_assessment_response_result.dart index f5574aae3a..24f0b02bb8 100644 --- a/lib/api/response/set_financial_assessment_response_result.dart +++ b/lib/api/response/set_financial_assessment_response_result.dart @@ -59,7 +59,7 @@ class SetFinancialAssessmentResponse /// understand the risks involved with binary options trading. /// /// For parameters information refer to [SetFinancialAssessmentRequest]. - /// Throws a [FinancialAssessmentException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future setAssessment( SetFinancialAssessmentRequest request, ) async { @@ -69,7 +69,7 @@ class SetFinancialAssessmentResponse checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - FinancialAssessmentException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return SetFinancialAssessmentResponse.fromJson( diff --git a/lib/api/response/set_self_exclusion_response_result.dart b/lib/api/response/set_self_exclusion_response_result.dart index d778d02380..5e6e1857d6 100644 --- a/lib/api/response/set_self_exclusion_response_result.dart +++ b/lib/api/response/set_self_exclusion_response_result.dart @@ -52,7 +52,7 @@ class SetSelfExclusionResponse extends SetSelfExclusionResponseModel { /// Sets Self-Exclusion (this call should be used in conjunction with [fetchSelfExclusion]) /// /// For parameters information refer to [SetSelfExclusionRequest]. - /// Throws a [SelfExclusionException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future setSelfExclusionMethod( SetSelfExclusionRequest request) async { final SetSelfExclusionReceive response = await _api.call(request: request); @@ -60,7 +60,7 @@ class SetSelfExclusionResponse extends SetSelfExclusionResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - SelfExclusionException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return SetSelfExclusionResponse.fromJson(response.setSelfExclusion); diff --git a/lib/api/response/set_settings_response_result.dart b/lib/api/response/set_settings_response_result.dart index 36199363d0..a48625a2c4 100644 --- a/lib/api/response/set_settings_response_result.dart +++ b/lib/api/response/set_settings_response_result.dart @@ -51,7 +51,7 @@ class SetSettingsResponse extends SetSettingsResponseModel { /// Changes the user's settings with parameters specified as [SetSettingsRequest] /// - /// Throws an [AccountSettingsException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future changeAccountSetting( SetSettingsRequest request, ) async { @@ -60,7 +60,7 @@ class SetSettingsResponse extends SetSettingsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AccountSettingsException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return SetSettingsResponse(setSettings: response.setSettings ?? 0); diff --git a/lib/api/response/statement_response_result.dart b/lib/api/response/statement_response_result.dart index 2c4bd3cec2..c5b60f4ebb 100644 --- a/lib/api/response/statement_response_result.dart +++ b/lib/api/response/statement_response_result.dart @@ -55,14 +55,14 @@ class StatementResponse extends StatementResponseModel { /// Retrieves a summary of account transactions, according to given search criteria. /// /// For parameters information refer to [StatementRequest]. - /// Throws a [StatementException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetch(StatementRequest request) async { final StatementReceive response = await _api.call(request: request); checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - StatementException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return StatementResponse.fromJson(response.statement); diff --git a/lib/api/response/states_list_response_result.dart b/lib/api/response/states_list_response_result.dart index 0482ec3ed3..bab5ab4094 100644 --- a/lib/api/response/states_list_response_result.dart +++ b/lib/api/response/states_list_response_result.dart @@ -63,7 +63,7 @@ class StatesListResponse extends StatesListResponseModel { /// Gets the list of states for the given [StatesListRequest] /// - /// Throws a [StateException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchStatesList( StatesListRequest request) async { final StatesListReceive response = await _api.call(request: request); @@ -71,7 +71,7 @@ class StatesListResponse extends StatesListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - StateException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return StatesListResponse.fromJson(response.statesList); diff --git a/lib/api/response/ticks_history_response_result.dart b/lib/api/response/ticks_history_response_result.dart index af6c13e6d5..6f5ad2d9db 100644 --- a/lib/api/response/ticks_history_response_result.dart +++ b/lib/api/response/ticks_history_response_result.dart @@ -104,7 +104,7 @@ class TicksHistoryResponse extends TicksHistoryResponseModel { /// Gets the [TickHistory] for the given [symbol] in [request] /// - /// Throws a [TickException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchTickHistory( TicksHistoryRequest request, ) async { @@ -113,7 +113,7 @@ class TicksHistoryResponse extends TicksHistoryResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TickException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return TicksHistoryResponse.fromJson(response.candles, response.history, @@ -122,7 +122,7 @@ class TicksHistoryResponse extends TicksHistoryResponseModel { /// Gets ticks history and its stream /// - /// Throws [TickException] if API response contains an error + /// Throws [BaseAPIException] if API response contains an error static Future fetchTicksAndSubscribe( TicksHistoryRequest request, { RequestCompareFunction? comparePredicate, @@ -136,7 +136,7 @@ class TicksHistoryResponse extends TicksHistoryResponseModel { checkException( response: firstResponse, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TickException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); if (firstResponse is TicksHistoryReceive) { return TickHistorySubscription( @@ -150,7 +150,7 @@ class TicksHistoryResponse extends TicksHistoryResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TickException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is TicksReceive diff --git a/lib/api/response/ticks_response_result.dart b/lib/api/response/ticks_response_result.dart index 86a322574f..d689bceb68 100644 --- a/lib/api/response/ticks_response_result.dart +++ b/lib/api/response/ticks_response_result.dart @@ -71,7 +71,7 @@ class TicksResponse extends TicksResponseModel { /// Subscribes to a tick for given [TickRequest] /// - /// Throws [TickException] if API response contains an error + /// Throws [BaseAPIException] if API response contains an error static Stream subscribeTick( TicksRequest tickRequest, { RequestCompareFunction? comparePredicate, @@ -83,7 +83,7 @@ class TicksResponse extends TicksResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TickException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is TicksReceive @@ -97,7 +97,7 @@ class TicksResponse extends TicksResponseModel { /// Unsubscribes all ticks. /// - /// Throws a [TickException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future unsubscribeAllTicks() async { final ForgetAllReceive response = await _api.unsubscribeAll(method: ForgetStreamType.ticks); @@ -105,7 +105,7 @@ class TicksResponse extends TicksResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TickException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetAllResponse.fromJson(response.forgetAll); diff --git a/lib/api/response/time_response_result.dart b/lib/api/response/time_response_result.dart index 0fd05e0ffc..08a3227a67 100644 --- a/lib/api/response/time_response_result.dart +++ b/lib/api/response/time_response_result.dart @@ -61,7 +61,7 @@ class TimeResponse extends TimeResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ServerTimeException(), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/tnc_approval_response_result.dart b/lib/api/response/tnc_approval_response_result.dart index e439792bd0..1966a1926e 100644 --- a/lib/api/response/tnc_approval_response_result.dart +++ b/lib/api/response/tnc_approval_response_result.dart @@ -52,7 +52,7 @@ class TncApprovalResponse extends TncApprovalResponseModel { /// Approve the latest version of terms and conditions. /// /// For parameters information refer to [TncApprovalRequest]. - /// Throws a [UserException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future verify( TncApprovalRequest request, ) async { @@ -61,7 +61,7 @@ class TncApprovalResponse extends TncApprovalResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - UserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return TncApprovalResponse.fromJson(response.tncApproval); diff --git a/lib/api/response/topup_virtual_response_result.dart b/lib/api/response/topup_virtual_response_result.dart index df28ba593c..fb843a85b6 100644 --- a/lib/api/response/topup_virtual_response_result.dart +++ b/lib/api/response/topup_virtual_response_result.dart @@ -56,7 +56,7 @@ class TopupVirtualResponse extends TopupVirtualResponseModel { /// Topes up the virtual-money's account balance becomes when it becomes low. /// /// For parameters information refer to [TopupVirtualRequest]. - /// Throws a [TopUpVirtualException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future topUp([ TopupVirtualRequest? request, ]) async { @@ -67,7 +67,7 @@ class TopupVirtualResponse extends TopupVirtualResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TopUpVirtualException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return TopupVirtualResponse.fromJson(response.topupVirtual); diff --git a/lib/api/response/trading_durations_response_result.dart b/lib/api/response/trading_durations_response_result.dart index 0b3b7a6ca8..9cc7dd36aa 100644 --- a/lib/api/response/trading_durations_response_result.dart +++ b/lib/api/response/trading_durations_response_result.dart @@ -65,7 +65,7 @@ class TradingDurationsResponse extends TradingDurationsResponseModel { /// /// If the user is logged in, only the assets available for that user's landing company will be returned. /// For parameters information refer to [TradingDurationsRequest]. - /// Throws a [TradingException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchTradingDurations( TradingDurationsRequest request, ) async { @@ -74,7 +74,7 @@ class TradingDurationsResponse extends TradingDurationsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TradingException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return TradingDurationsResponse.fromJson(response.tradingDurations); diff --git a/lib/api/response/trading_platform_accounts_response_result.dart b/lib/api/response/trading_platform_accounts_response_result.dart index b019f395e6..806ddd905c 100644 --- a/lib/api/response/trading_platform_accounts_response_result.dart +++ b/lib/api/response/trading_platform_accounts_response_result.dart @@ -64,7 +64,7 @@ class TradingPlatformAccountsResponse /// /// Get list of Trading Platform accounts for client. /// For parameters information refer to [TradingPlatformAccountsRequest]. - /// Throws a [TradingPlatformException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future getAccounts( TradingPlatformAccountsRequest request, ) async { @@ -74,7 +74,7 @@ class TradingPlatformAccountsResponse checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TradingPlatformException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return TradingPlatformAccountsResponse.fromJson( diff --git a/lib/api/response/trading_platform_deposit_response_result.dart b/lib/api/response/trading_platform_deposit_response_result.dart index f462d7abcb..f01ad48e0d 100644 --- a/lib/api/response/trading_platform_deposit_response_result.dart +++ b/lib/api/response/trading_platform_deposit_response_result.dart @@ -52,7 +52,7 @@ class TradingPlatformDepositResponse /// /// Information about deposit transaction, or status of demo account top up. /// For parameters information refer to [TradingPlatformDepositRequest]. - /// Throws a [TradingPlatformException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future deposit( TradingPlatformDepositRequest request, ) async { @@ -62,7 +62,7 @@ class TradingPlatformDepositResponse checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TradingPlatformException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return TradingPlatformDepositResponse.fromJson( diff --git a/lib/api/response/trading_platform_new_account_response_result.dart b/lib/api/response/trading_platform_new_account_response_result.dart index 5799db3d69..f6fa27712a 100644 --- a/lib/api/response/trading_platform_new_account_response_result.dart +++ b/lib/api/response/trading_platform_new_account_response_result.dart @@ -57,7 +57,7 @@ class TradingPlatformNewAccountResponse /// /// This call creates new Trading account, either demo or real money. /// For parameters information refer to [TradingPlatformNewAccountRequest]. - /// Throws a [TradingPlatformException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future create( TradingPlatformNewAccountRequest request, ) async { @@ -67,7 +67,7 @@ class TradingPlatformNewAccountResponse checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TradingPlatformException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return TradingPlatformNewAccountResponse.fromJson( diff --git a/lib/api/response/trading_servers_response_result.dart b/lib/api/response/trading_servers_response_result.dart index 78d5524eed..8807252094 100644 --- a/lib/api/response/trading_servers_response_result.dart +++ b/lib/api/response/trading_servers_response_result.dart @@ -64,7 +64,7 @@ class TradingServersResponse extends TradingServersResponseModel { /// Get the list of servers for platform. Currently, only mt5 is supported /// /// For parameters information refer to [TradingServersRequest]. - /// Throws a [TradingException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchTradingServers( TradingServersRequest request, ) async { @@ -73,7 +73,7 @@ class TradingServersResponse extends TradingServersResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TradingException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return TradingServersResponse.fromJson(response.tradingServers); diff --git a/lib/api/response/trading_times_response_result.dart b/lib/api/response/trading_times_response_result.dart index 17f939da08..6c4af9d1b0 100644 --- a/lib/api/response/trading_times_response_result.dart +++ b/lib/api/response/trading_times_response_result.dart @@ -56,7 +56,7 @@ class TradingTimesResponse extends TradingTimesResponseModel { /// Receives a list of market opening times for a given date. /// /// For parameters information refer to [TradingTimesRequest]. - /// Throws a [TradingException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchTradingTimes( TradingTimesRequest request, ) async { @@ -65,7 +65,7 @@ class TradingTimesResponse extends TradingTimesResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TradingException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return TradingTimesResponse.fromJson(response.tradingTimes); diff --git a/lib/api/response/transaction_response_result.dart b/lib/api/response/transaction_response_result.dart index c81c36bc08..0d97e9a495 100644 --- a/lib/api/response/transaction_response_result.dart +++ b/lib/api/response/transaction_response_result.dart @@ -75,7 +75,7 @@ class TransactionResponse extends TransactionResponseModel { /// Subscribes to account's transactions /// - /// Throws a [TransactionsException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Stream subscribeTransactions({ RequestCompareFunction? comparePredicate, }) => @@ -88,7 +88,7 @@ class TransactionResponse extends TransactionResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TransactionsException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is TransactionReceive @@ -101,7 +101,7 @@ class TransactionResponse extends TransactionResponseModel { /// Unsubscribes from transaction subscription. /// - /// Throws a [TransactionsException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future unsubscribeTransaction() async { if (subscription == null) { return null; @@ -113,7 +113,7 @@ class TransactionResponse extends TransactionResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TransactionsException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetResponse.fromJson(response.forget); @@ -121,7 +121,7 @@ class TransactionResponse extends TransactionResponseModel { /// Unsubscribes all transaction subscriptions. /// - /// Throws a [TransactionsException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future unsubscribeAllTransaction() async { final ForgetAllReceive response = await _api.unsubscribeAll(method: ForgetStreamType.transaction); @@ -129,7 +129,7 @@ class TransactionResponse extends TransactionResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TransactionsException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetAllResponse.fromJson(response.forgetAll); diff --git a/lib/api/response/transfer_between_accounts_response_result.dart b/lib/api/response/transfer_between_accounts_response_result.dart index 945857f7e2..393049fcc7 100644 --- a/lib/api/response/transfer_between_accounts_response_result.dart +++ b/lib/api/response/transfer_between_accounts_response_result.dart @@ -103,7 +103,7 @@ class TransferBetweenAccountsResponse /// Transfer funds between your fiat and crypto currency accounts (for a fee). /// Please note that account_from should be same as current authorized account. /// For parameters information refer to [TransferBetweenAccountsRequest]. - /// Throws a [TransferException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future transfer( TransferBetweenAccountsRequest request, ) async { @@ -113,7 +113,7 @@ class TransferBetweenAccountsResponse checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TransferException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return TransferBetweenAccountsResponse.fromJson( diff --git a/lib/api/response/verify_email_response_result.dart b/lib/api/response/verify_email_response_result.dart index 235532ddc0..03468dfd66 100644 --- a/lib/api/response/verify_email_response_result.dart +++ b/lib/api/response/verify_email_response_result.dart @@ -53,7 +53,7 @@ class VerifyEmailResponse extends VerifyEmailResponseModel { /// /// The system will send an email to the address containing a security code for verification. /// For parameters information refer to [VerifyEmailRequest]. - /// Throws a [UserException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future verify( VerifyEmailRequest request, ) async { @@ -62,7 +62,7 @@ class VerifyEmailResponse extends VerifyEmailResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - UserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return VerifyEmailResponse.fromJson(response.verifyEmail); diff --git a/lib/api/response/website_status_response_result.dart b/lib/api/response/website_status_response_result.dart index d7641881f2..058b5a26ac 100644 --- a/lib/api/response/website_status_response_result.dart +++ b/lib/api/response/website_status_response_result.dart @@ -76,7 +76,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { /// Gets Website status. /// /// For parameters information refer to [WebsiteStatusRequest]. - /// Throws a [WebsiteStatusException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future fetchWebsiteStatusRaw([ WebsiteStatusRequest? request, ]) async { @@ -87,7 +87,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - WebsiteStatusException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -95,7 +95,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { /// Subscribes to website status. /// - /// Throws a [WebsiteStatusException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Stream subscribeWebsiteStatusRaw( WebsiteStatusRequest request, { RequestCompareFunction? comparePredicate, @@ -107,7 +107,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - WebsiteStatusException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is WebsiteStatusReceive ? response : null; @@ -116,7 +116,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { /// Unsubscribes from website status. /// - /// Throws an [WebsiteStatusException] if the API response contains an error. + /// Throws an [BaseAPIException] if the API response contains an error. Future unsubscribeWebsiteStatusRaw() async { if (subscription == null) { return null; @@ -128,7 +128,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - WebsiteStatusException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -136,7 +136,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { /// Unsubscribes all website status subscriptions. /// - /// Throws an [WebsiteStatusException] if the API response contains an error. + /// Throws an [BaseAPIException] if the API response contains an error. static Future unsubscribeAllWebsiteStatusRaw() async { final ForgetAllReceive response = await _api.unsubscribeAll(method: ForgetStreamType.websiteStatus); @@ -144,7 +144,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - WebsiteStatusException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -152,7 +152,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { /// Gets Website status. /// - /// Throws an [WebsiteStatusException] if the API response contains an error. + /// Throws an [BaseAPIException] if the API response contains an error. static Future fetchWebsiteStatus([ WebsiteStatusRequest? request, ]) async { @@ -183,7 +183,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { /// Unsubscribes from website status. /// - /// Throws an [WebsiteStatusException] if the API response contains an error. + /// Throws an [BaseAPIException] if the API response contains an error. Future unsubscribeWebsiteStatus() async { final ForgetReceive? response = await unsubscribeWebsiteStatusRaw(); @@ -192,7 +192,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { /// Unsubscribes all website status subscriptions. /// - /// Throws an [WebsiteStatusException] if the API response contains an error. + /// Throws an [BaseAPIException] if the API response contains an error. static Future unsubscribeAllWebsiteStatus() async { final ForgetAllReceive response = await unsubscribeAllWebsiteStatusRaw(); diff --git a/lib/basic_api/generated/methods/active_symbols_receive_methods.json b/lib/basic_api/generated/methods/active_symbols_receive_methods.json index e646705a2f..998e66b0de 100644 --- a/lib/basic_api/generated/methods/active_symbols_receive_methods.json +++ b/lib/basic_api/generated/methods/active_symbols_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the list of active symbols.\n ///\n /// For parameters information refer to [ActiveSymbolsRequest].\n /// Throws an [ActiveSymbolsException] if API response contains an error\n static Future fetchActiveSymbols(\n ActiveSymbolsRequest request,\n ) async {\n final ActiveSymbolsReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ActiveSymbolsException(baseExceptionModel: baseExceptionModel),\n );\n\n return ActiveSymbolsResponse.fromJson(response.activeSymbols);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the list of active symbols.\n ///\n /// For parameters information refer to [ActiveSymbolsRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future fetchActiveSymbols(\n ActiveSymbolsRequest request,\n ) async {\n final ActiveSymbolsReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ActiveSymbolsResponse.fromJson(response.activeSymbols);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/active_symbols_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/active_symbols_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/api_token_receive_methods.json b/lib/basic_api/generated/methods/api_token_receive_methods.json index d049c08e5a..fe3e68dee5 100644 --- a/lib/basic_api/generated/methods/api_token_receive_methods.json +++ b/lib/basic_api/generated/methods/api_token_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": " static final BaseAPI _api = Injector()();\n\n /// Creates an API tokens\n ///\n /// [name] is the name of the token.\n /// [scopes] is a list of permission scopes to provide with the token.\n /// [validForCurrentIPOnly] is optional and if you set this parameter during token creation,\n /// then the token created will only work for the IP address that was used to create the token\n /// Throws an [APITokenException] if API response contains an error.\n static Future create({\n required String name,\n required List scopes,\n bool? validForCurrentIPOnly,\n }) async {\n final ApiTokenReceive response = await _api.call(\n request: ApiTokenRequest(\n newToken: name,\n newTokenScopes: getStringListFromEnums(\n scopes), \n validForCurrentIpOnly: validForCurrentIPOnly,\n ),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n APITokenException(baseExceptionModel: baseExceptionModel),\n );\n\n return ApiTokenResponse.fromJson(response.apiToken);\n }\n\n /// Deletes the [token]\n ///\n /// Throws an [APITokenException] if API response contains an error\n static Future delete({\n required String token,\n }) async {\n final ApiTokenReceive response = await _api.call(\n request: ApiTokenRequest(deleteToken: token),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n APITokenException(baseExceptionModel: baseExceptionModel),\n );\n\n return ApiTokenResponse.fromJson(response.apiToken);\n }", + "methods": " static final BaseAPI _api = Injector()();\n\n /// Creates an API tokens\n ///\n /// [name] is the name of the token.\n /// [scopes] is a list of permission scopes to provide with the token.\n /// [validForCurrentIPOnly] is optional and if you set this parameter during token creation,\n /// then the token created will only work for the IP address that was used to create the token\n /// Throws an [BaseAPIException] if API response contains an error.\n static Future create({\n required String name,\n required List scopes,\n bool? validForCurrentIPOnly,\n }) async {\n final ApiTokenReceive response = await _api.call(\n request: ApiTokenRequest(\n newToken: name,\n newTokenScopes: getStringListFromEnums(\n scopes), \n validForCurrentIpOnly: validForCurrentIPOnly,\n ),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ApiTokenResponse.fromJson(response.apiToken);\n }\n\n /// Deletes the [token]\n ///\n /// Throws an [BaseAPIException] if API response contains an error\n static Future delete({\n required String token,\n }) async {\n final ApiTokenReceive response = await _api.call(\n request: ApiTokenRequest(deleteToken: token),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ApiTokenResponse.fromJson(response.apiToken);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/api_token_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/api_token_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/app_delete_receive_methods.json b/lib/basic_api/generated/methods/app_delete_receive_methods.json index 1e2f876b5b..fa8703186c 100644 --- a/lib/basic_api/generated/methods/app_delete_receive_methods.json +++ b/lib/basic_api/generated/methods/app_delete_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": " static final BaseAPI _api = Injector()();\n\n /// Deletes the application by appId specified in [AppDeleteRequest.appDelete].\n ///\n /// For parameters information refer to [AppDeleteRequest].\n /// Throws an [AppException] if API response contains an error\n static Future deleteApplication(\n AppDeleteRequest request) async {\n final AppDeleteReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AppException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppDeleteResponse.fromJson(response.appDelete);\n }", + "methods": " static final BaseAPI _api = Injector()();\n\n /// Deletes the application by appId specified in [AppDeleteRequest.appDelete].\n ///\n /// For parameters information refer to [AppDeleteRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future deleteApplication(\n AppDeleteRequest request) async {\n final AppDeleteReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppDeleteResponse.fromJson(response.appDelete);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_delete_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_delete_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/app_get_receive_methods.json b/lib/basic_api/generated/methods/app_get_receive_methods.json index 3266e24af7..f4ec13cb4e 100644 --- a/lib/basic_api/generated/methods/app_get_receive_methods.json +++ b/lib/basic_api/generated/methods/app_get_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the information of the OAuth application specified by [appId] in [request]\n ///\n /// For parameters information refer to [AppGetRequest].\n /// Throws an [AppException] if API response contains an error\n static Future fetchApplicationDetails(\n AppGetRequest request,\n ) async {\n final AppGetReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AppException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppGetResponse.fromJson(response.appGet);\n }\n\n /// Gets all of the account's OAuth applications.\n ///\n /// For parameters information refer to [AppListRequest].\n /// Throws an [AppException] if API response contains an error\n static Future?> fetchApplicationList(\n AppListRequest request,\n ) async {\n final AppListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AppException(baseExceptionModel: baseExceptionModel),\n );\n\n return getListFromMap(\n response.appList,\n itemToTypeCallback: (dynamic item) => AppGetResponse.fromJson(item),\n );\n }\n\n /// Retrieves details of app markup according to criteria specified.\n Future fetchApplicationMarkupDetails({\n required DateTime dateFrom,\n required DateTime dateTo,\n String? clientLoginId,\n bool? description,\n int? limit,\n int? offset,\n String? sort,\n List? sortFields,\n }) =>\n AppMarkupDetailsResponse.fetchApplicationMarkupDetails(\n AppMarkupDetailsRequest(\n appId: appGet?.appId,\n clientLoginid: clientLoginId,\n dateFrom: dateFrom.toString(),\n dateTo: dateTo.toString(),\n description: description,\n limit: limit,\n offset: offset,\n sort: sort,\n sortFields: sortFields,\n ),\n );\n\n /// The request for deleting an application.\n Future deleteApplication() =>\n AppDeleteResponse.deleteApplication(\n AppDeleteRequest(appDelete: appGet?.appId),\n );\n\n /// Register a new Oauth application.\n Future registerApplication(\n {required List scopes}) =>\n AppRegisterResponse.registerApplication(\n AppRegisterRequest(\n appMarkupPercentage: appGet?.appMarkupPercentage,\n appstore: appGet?.appstore,\n github: appGet?.github,\n googleplay: appGet?.googleplay,\n homepage: appGet?.homepage,\n name: appGet?.name,\n redirectUri: appGet?.redirectUri,\n scopes: scopes\n .map((TokenScope scope) => getStringFromEnum(scope))\n .toList(),\n verificationUri: appGet?.verificationUri,\n ),\n );\n\n /// Update application.\n Future updateApplication(\n {required List scopes}) =>\n AppUpdateResponse.updateApplication(\n AppUpdateRequest(\n appMarkupPercentage: appGet?.appMarkupPercentage,\n appUpdate: appGet?.appId,\n appstore: appGet?.appstore,\n github: appGet?.github,\n googleplay: appGet?.googleplay,\n homepage: appGet?.homepage,\n name: appGet?.name,\n redirectUri: appGet?.redirectUri,\n scopes: scopes\n .map((TokenScope scope) => getStringFromEnum(scope))\n .toList(),\n verificationUri: appGet?.verificationUri,\n ),\n );\n\n /// Revoke access of particular app.\n Future revokeOauthApplication() =>\n RevokeOauthAppResponse.revokeOauthApplication(\n RevokeOauthAppRequest(revokeOauthApp: appGet?.appId),\n );", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the information of the OAuth application specified by [appId] in [request]\n ///\n /// For parameters information refer to [AppGetRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future fetchApplicationDetails(\n AppGetRequest request,\n ) async {\n final AppGetReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppGetResponse.fromJson(response.appGet);\n }\n\n /// Gets all of the account's OAuth applications.\n ///\n /// For parameters information refer to [AppListRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future?> fetchApplicationList(\n AppListRequest request,\n ) async {\n final AppListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return getListFromMap(\n response.appList,\n itemToTypeCallback: (dynamic item) => AppGetResponse.fromJson(item),\n );\n }\n\n /// Retrieves details of app markup according to criteria specified.\n Future fetchApplicationMarkupDetails({\n required DateTime dateFrom,\n required DateTime dateTo,\n String? clientLoginId,\n bool? description,\n int? limit,\n int? offset,\n String? sort,\n List? sortFields,\n }) =>\n AppMarkupDetailsResponse.fetchApplicationMarkupDetails(\n AppMarkupDetailsRequest(\n appId: appGet?.appId,\n clientLoginid: clientLoginId,\n dateFrom: dateFrom.toString(),\n dateTo: dateTo.toString(),\n description: description,\n limit: limit,\n offset: offset,\n sort: sort,\n sortFields: sortFields,\n ),\n );\n\n /// The request for deleting an application.\n Future deleteApplication() =>\n AppDeleteResponse.deleteApplication(\n AppDeleteRequest(appDelete: appGet?.appId),\n );\n\n /// Register a new Oauth application.\n Future registerApplication(\n {required List scopes}) =>\n AppRegisterResponse.registerApplication(\n AppRegisterRequest(\n appMarkupPercentage: appGet?.appMarkupPercentage,\n appstore: appGet?.appstore,\n github: appGet?.github,\n googleplay: appGet?.googleplay,\n homepage: appGet?.homepage,\n name: appGet?.name,\n redirectUri: appGet?.redirectUri,\n scopes: scopes\n .map((TokenScope scope) => getStringFromEnum(scope))\n .toList(),\n verificationUri: appGet?.verificationUri,\n ),\n );\n\n /// Update application.\n Future updateApplication(\n {required List scopes}) =>\n AppUpdateResponse.updateApplication(\n AppUpdateRequest(\n appMarkupPercentage: appGet?.appMarkupPercentage,\n appUpdate: appGet?.appId,\n appstore: appGet?.appstore,\n github: appGet?.github,\n googleplay: appGet?.googleplay,\n homepage: appGet?.homepage,\n name: appGet?.name,\n redirectUri: appGet?.redirectUri,\n scopes: scopes\n .map((TokenScope scope) => getStringFromEnum(scope))\n .toList(),\n verificationUri: appGet?.verificationUri,\n ),\n );\n\n /// Revoke access of particular app.\n Future revokeOauthApplication() =>\n RevokeOauthAppResponse.revokeOauthApplication(\n RevokeOauthAppRequest(revokeOauthApp: appGet?.appId),\n );", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/app_delete_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/app_markup_details_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/app_register_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/app_update_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/revoke_oauth_app_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_delete_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_get_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_get_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_list_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_list_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_markup_details_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_register_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_update_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/revoke_oauth_app_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/app_list_receive_methods.json b/lib/basic_api/generated/methods/app_list_receive_methods.json index 75f43c54dc..9bf0f4e612 100644 --- a/lib/basic_api/generated/methods/app_list_receive_methods.json +++ b/lib/basic_api/generated/methods/app_list_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets all of the account's OAuth applications.\n ///\n /// For parameters information refer to [AppListRequest].\n /// Throws an [AppException] if API response contains an error\n static Future fetchApplicationList(\n AppListRequest request,\n ) async {\n final AppListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AppException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppListResponse.fromJson(response.appList);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets all of the account's OAuth applications.\n ///\n /// For parameters information refer to [AppListRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future fetchApplicationList(\n AppListRequest request,\n ) async {\n final AppListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppListResponse.fromJson(response.appList);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_list_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_list_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/app_markup_details_receive_methods.json b/lib/basic_api/generated/methods/app_markup_details_receive_methods.json index 07cf2d29e1..a1e44f688c 100644 --- a/lib/basic_api/generated/methods/app_markup_details_receive_methods.json +++ b/lib/basic_api/generated/methods/app_markup_details_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieve details of app markup according to criteria specified.\n ///\n /// For parameters information refer to [AppMarkupDetailsRequest].\n /// Throws an [AppException] if API response contains an error\n static Future fetchApplicationMarkupDetails(\n AppMarkupDetailsRequest request,\n ) async {\n final AppMarkupDetailsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AppException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppMarkupDetailsResponse.fromJson(response.appMarkupDetails);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieve details of app markup according to criteria specified.\n ///\n /// For parameters information refer to [AppMarkupDetailsRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future fetchApplicationMarkupDetails(\n AppMarkupDetailsRequest request,\n ) async {\n final AppMarkupDetailsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppMarkupDetailsResponse.fromJson(response.appMarkupDetails);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_markup_details_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_markup_details_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/app_register_receive_methods.json b/lib/basic_api/generated/methods/app_register_receive_methods.json index 0ec886fd0e..1bb152c27c 100644 --- a/lib/basic_api/generated/methods/app_register_receive_methods.json +++ b/lib/basic_api/generated/methods/app_register_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Registers a new OAuth application.\n ///\n /// For parameters information refer to [AppRegisterRequest].\n /// Throws an [AppException] if API response contains an error\n static Future registerApplication(\n AppRegisterRequest request,\n ) async {\n final AppRegisterReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AppException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppRegisterResponse.fromJson(response.appRegister);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Registers a new OAuth application.\n ///\n /// For parameters information refer to [AppRegisterRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future registerApplication(\n AppRegisterRequest request,\n ) async {\n final AppRegisterReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppRegisterResponse.fromJson(response.appRegister);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_register_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_register_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/app_update_receive_methods.json b/lib/basic_api/generated/methods/app_update_receive_methods.json index 82728bc6cd..18827d8be5 100644 --- a/lib/basic_api/generated/methods/app_update_receive_methods.json +++ b/lib/basic_api/generated/methods/app_update_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Updates the application specified in [request].\n ///\n /// For parameters information refer to [AppUpdateRequest].\n /// Throws an [AppException] if API response contains an error\n static Future updateApplication(\n AppUpdateRequest request) async {\n final AppUpdateReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AppException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppUpdateResponse.fromJson(response.appUpdate);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Updates the application specified in [request].\n ///\n /// For parameters information refer to [AppUpdateRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future updateApplication(\n AppUpdateRequest request) async {\n final AppUpdateReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppUpdateResponse.fromJson(response.appUpdate);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_update_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_update_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/asset_index_receive_methods.json b/lib/basic_api/generated/methods/asset_index_receive_methods.json index 6a713b8f1f..bd80bf1226 100644 --- a/lib/basic_api/generated/methods/asset_index_receive_methods.json +++ b/lib/basic_api/generated/methods/asset_index_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": " static final BaseAPI _api = Injector()();\n\n /// Retrieves a list of all available underlyings and the corresponding contract types and duration boundaries.\n ///\n /// If the user is logged in, only the assets available for that user's landing company will be returned.\n /// Throws an [AssetIndexException] if API response contains an error\n static Future fetchAssetIndices(\n AssetIndexRequest request,\n ) async {\n final AssetIndexReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AssetIndexException(baseExceptionModel: baseExceptionModel),\n );\n\n return AssetIndexResponse.fromJson(response.assetIndex);\n }", + "methods": " static final BaseAPI _api = Injector()();\n\n /// Retrieves a list of all available underlyings and the corresponding contract types and duration boundaries.\n ///\n /// If the user is logged in, only the assets available for that user's landing company will be returned.\n /// Throws an [BaseAPIException] if API response contains an error\n static Future fetchAssetIndices(\n AssetIndexRequest request,\n ) async {\n final AssetIndexReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return AssetIndexResponse.fromJson(response.assetIndex);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/asset_index_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/asset_index_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/authorize_receive_methods.json b/lib/basic_api/generated/methods/authorize_receive_methods.json index c978580ecd..b82623671f 100644 --- a/lib/basic_api/generated/methods/authorize_receive_methods.json +++ b/lib/basic_api/generated/methods/authorize_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Authorizes current WebSocket session to act on behalf of the owner of a given token. \n /// \n /// For parameters information refer to [AuthorizeRequest]. \n /// Throws an [AuthorizeException] if API response contains an error. \n static Future authorizeMethodRaw( \n AuthorizeRequest request, \n ) async { \n final AuthorizeReceive response = await _api.call( \n request: request, \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n AuthorizeException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Authorizes current WebSocket session to act on behalf of the owner of a given token. \n /// \n /// For parameters information refer to [AuthorizeRequest]. \n /// Throws an [AuthorizeException] if API response contains an error. \n static Future authorizeMethod( \n AuthorizeRequest request, \n ) async { \n final AuthorizeReceive response = await authorizeMethodRaw(request); \n \n return AuthorizeResponse.fromJson(response.authorize); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Authorizes current WebSocket session to act on behalf of the owner of a given token. \n /// \n /// For parameters information refer to [AuthorizeRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future authorizeMethodRaw( \n AuthorizeRequest request, \n ) async { \n final AuthorizeReceive response = await _api.call( \n request: request, \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Authorizes current WebSocket session to act on behalf of the owner of a given token. \n /// \n /// For parameters information refer to [AuthorizeRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future authorizeMethod( \n AuthorizeRequest request, \n ) async { \n final AuthorizeReceive response = await authorizeMethodRaw(request); \n \n return AuthorizeResponse.fromJson(response.authorize); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/authorize_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/authorize_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/balance_receive_methods.json b/lib/basic_api/generated/methods/balance_receive_methods.json index 7ea265903c..db7d99034c 100644 --- a/lib/basic_api/generated/methods/balance_receive_methods.json +++ b/lib/basic_api/generated/methods/balance_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the balance of account\n ///\n /// For parameters info refer to [BalanceRequest]\n /// Throws a [BalanceException] if API response contains an error\n static Future fetchBalance(BalanceRequest request) async {\n final BalanceReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BalanceException(baseExceptionModel: baseExceptionModel),\n );\n\n return BalanceResponse.fromJson(response.balance, response.subscription);\n }\n\n /// Instead of one call [Balance.fetchBalance] gets stream of [Balance]\n ///\n /// Throws a [BalanceException] if API response contains an error\n static Stream subscribeBalance(\n BalanceRequest request, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: request, comparePredicate: comparePredicate)!\n .map((Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BalanceException(baseExceptionModel: baseExceptionModel),\n );\n\n return response is BalanceReceive\n ? BalanceResponse.fromJson(\n response.balance,\n response.subscription,\n )\n : null;\n });\n\n /// Unsubscribes from balance subscription.\n ///\n /// Throws a [BalanceException] if API response contains an error\n Future unsubscribeBalance() async {\n if (subscription == null) {\n return null;\n }\n\n final ForgetReceive response =\n await _api.unsubscribe(subscriptionId: subscription!.id);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BalanceException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }\n\n /// Unsubscribes all balance subscriptions.\n ///\n /// Throws a [BalanceException] if API response contains an error\n static Future unsubscribeAllBalance() async {\n final ForgetAllReceive response =\n await _api.unsubscribeAll(method: ForgetStreamType.balance);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BalanceException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the balance of account\n ///\n /// For parameters info refer to [BalanceRequest]\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchBalance(BalanceRequest request) async {\n final BalanceReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return BalanceResponse.fromJson(response.balance, response.subscription);\n }\n\n /// Instead of one call [Balance.fetchBalance] gets stream of [Balance]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Stream subscribeBalance(\n BalanceRequest request, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: request, comparePredicate: comparePredicate)!\n .map((Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response is BalanceReceive\n ? BalanceResponse.fromJson(\n response.balance,\n response.subscription,\n )\n : null;\n });\n\n /// Unsubscribes from balance subscription.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future unsubscribeBalance() async {\n if (subscription == null) {\n return null;\n }\n\n final ForgetReceive response =\n await _api.unsubscribe(subscriptionId: subscription!.id);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }\n\n /// Unsubscribes all balance subscriptions.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future unsubscribeAllBalance() async {\n final ForgetAllReceive response =\n await _api.unsubscribeAll(method: ForgetStreamType.balance);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/balance_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/balance_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/buy_receive_methods.json b/lib/basic_api/generated/methods/buy_receive_methods.json index 79fab41830..cfd4a6220e 100644 --- a/lib/basic_api/generated/methods/buy_receive_methods.json +++ b/lib/basic_api/generated/methods/buy_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Buys a contract with parameters specified in given [BuyRequest]\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n static Future buyMethod(BuyRequest request) async {\n final BuyReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return BuyResponse.fromJson(response.buy, response.subscription);\n }\n\n /// Buys contract with parameters specified in request and subscribes to it.\n ///\n /// Throws a [ContractOperationException] is API response contains an error\n static Stream buyAndSubscribe(\n BuyRequest request, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: request, comparePredicate: comparePredicate)!\n .map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(\n baseExceptionModel: baseExceptionModel),\n );\n return response is ProposalOpenContractReceive\n ? ProposalOpenContractResponse.fromJson(\n response.proposalOpenContract,\n response.subscription,\n )\n : null;\n },\n );\n\n /// Gets the current spot of the this bought contract as [Contract].\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n Future fetchState() =>\n ProposalOpenContractResponse.fetchContractState(\n ProposalOpenContractRequest(\n contractId: buy?.contractId,\n ),\n );\n\n /// Subscribes to this bought contract spot and returns its spot update as [ContractBaseModel].\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n Stream subscribeState({\n RequestCompareFunction? comparePredicate,\n }) =>\n ProposalOpenContractResponse.subscribeContractState(\n ProposalOpenContractRequest(contractId: buy?.contractId),\n comparePredicate: comparePredicate,\n );\n\n /// Updates this contract\n ///\n /// New [stopLoss] value for a contract. To cancel, pass null.\n /// New [takeProfit] value for a contract. To cancel, pass null.\n /// Throws a [ContractOperationException] if API response contains an error\n Future update({\n double? stopLoss,\n double? takeProfit,\n }) =>\n ContractUpdateResponse.updateContract(ContractUpdateRequest(\n contractId: buy?.contractId,\n limitOrder: {\n 'stop_loss': stopLoss,\n 'take_profit': takeProfit,\n },\n ));\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Buys a contract with parameters specified in given [BuyRequest]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future buyMethod(BuyRequest request) async {\n final BuyReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return BuyResponse.fromJson(response.buy, response.subscription);\n }\n\n /// Buys contract with parameters specified in request and subscribes to it.\n ///\n /// Throws a [BaseAPIException] is API response contains an error\n static Stream buyAndSubscribe(\n BuyRequest request, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: request, comparePredicate: comparePredicate)!\n .map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(\n baseExceptionModel: baseExceptionModel),\n );\n return response is ProposalOpenContractReceive\n ? ProposalOpenContractResponse.fromJson(\n response.proposalOpenContract,\n response.subscription,\n )\n : null;\n },\n );\n\n /// Gets the current spot of the this bought contract as [Contract].\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future fetchState() =>\n ProposalOpenContractResponse.fetchContractState(\n ProposalOpenContractRequest(\n contractId: buy?.contractId,\n ),\n );\n\n /// Subscribes to this bought contract spot and returns its spot update as [ContractBaseModel].\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Stream subscribeState({\n RequestCompareFunction? comparePredicate,\n }) =>\n ProposalOpenContractResponse.subscribeContractState(\n ProposalOpenContractRequest(contractId: buy?.contractId),\n comparePredicate: comparePredicate,\n );\n\n /// Updates this contract\n ///\n /// New [stopLoss] value for a contract. To cancel, pass null.\n /// New [takeProfit] value for a contract. To cancel, pass null.\n /// Throws a [BaseAPIException] if API response contains an error\n Future update({\n double? stopLoss,\n double? takeProfit,\n }) =>\n ContractUpdateResponse.updateContract(ContractUpdateRequest(\n contractId: buy?.contractId,\n limitOrder: {\n 'stop_loss': stopLoss,\n 'take_profit': takeProfit,\n },\n ));\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/response/contract_update_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/proposal_open_contract_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/buy_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/buy_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/contract_update_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/proposal_open_contract_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/proposal_open_contract_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';" } diff --git a/lib/basic_api/generated/methods/cancel_receive_methods.json b/lib/basic_api/generated/methods/cancel_receive_methods.json index fc9f61e9ac..532589936d 100644 --- a/lib/basic_api/generated/methods/cancel_receive_methods.json +++ b/lib/basic_api/generated/methods/cancel_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Cancels a contract with parameters specified in [CancelRequest].\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n static Future cancelContract(CancelRequest request) async {\n final CancelReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return CancelResponse.fromJson(response.cancel);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Cancels a contract with parameters specified in [CancelRequest].\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future cancelContract(CancelRequest request) async {\n final CancelReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return CancelResponse.fromJson(response.cancel);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/cancel_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/cancel_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/cashier_receive_methods.json b/lib/basic_api/generated/methods/cashier_receive_methods.json index 444a774871..aab5f555a4 100644 --- a/lib/basic_api/generated/methods/cashier_receive_methods.json +++ b/lib/basic_api/generated/methods/cashier_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": " static final BaseAPI _api = Injector()();\n\n /// Gets the cashier URL for given [CashierRequest]\n static Future fetchInformation(\n CashierRequest request,\n ) async {\n final CashierReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n CashierException(baseExceptionModel: baseExceptionModel),\n );\n\n return CashierResponse.fromJson(response.cashier, response.cashier);\n }", + "methods": " static final BaseAPI _api = Injector()();\n\n /// Gets the cashier URL for given [CashierRequest]\n static Future fetchInformation(\n CashierRequest request,\n ) async {\n final CashierReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return CashierResponse.fromJson(response.cashier, response.cashier);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/cashier_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/cashier_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/contract_update_history_receive_methods.json b/lib/basic_api/generated/methods/contract_update_history_receive_methods.json index e15c6a1080..6b14abb64f 100644 --- a/lib/basic_api/generated/methods/contract_update_history_receive_methods.json +++ b/lib/basic_api/generated/methods/contract_update_history_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets update history for contract as List of [HistorySpotPriceModel]\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n static Future fetchContractUpdateHistory(\n ContractUpdateHistoryRequest request,\n ) async {\n final ContractUpdateHistoryReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return ContractUpdateHistoryResponse.fromJson(\n response.contractUpdateHistory);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets update history for contract as List of [HistorySpotPriceModel]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchContractUpdateHistory(\n ContractUpdateHistoryRequest request,\n ) async {\n final ContractUpdateHistoryReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ContractUpdateHistoryResponse.fromJson(\n response.contractUpdateHistory);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/contract_update_history_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/contract_update_history_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/contract_update_receive_methods.json b/lib/basic_api/generated/methods/contract_update_receive_methods.json index 1c89837acb..a42b9fd17c 100644 --- a/lib/basic_api/generated/methods/contract_update_receive_methods.json +++ b/lib/basic_api/generated/methods/contract_update_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// updates a contract with parameters specified in [ContractUpdateRequest].\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n static Future updateContract(\n ContractUpdateRequest request,\n ) async {\n final ContractUpdateReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return ContractUpdateResponse.fromJson(response.contractUpdate);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// updates a contract with parameters specified in [ContractUpdateRequest].\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future updateContract(\n ContractUpdateRequest request,\n ) async {\n final ContractUpdateReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ContractUpdateResponse.fromJson(response.contractUpdate);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/contract_update_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/contract_update_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/contracts_for_receive_methods.json b/lib/basic_api/generated/methods/contracts_for_receive_methods.json index a489b62af2..1be8460b88 100644 --- a/lib/basic_api/generated/methods/contracts_for_receive_methods.json +++ b/lib/basic_api/generated/methods/contracts_for_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets available contracts for given symbol in [ContractsForRequest]\n ///\n /// Throws a [ContractsForSymbolException] if API response contains an error\n static Future fetchContractsForSymbol(\n ContractsForRequest request,\n ) async {\n final ContractsForReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractsForSymbolException(baseExceptionModel: baseExceptionModel),\n );\n\n return ContractsForResponse.fromJson(response.contractsFor);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets available contracts for given symbol in [ContractsForRequest]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchContractsForSymbol(\n ContractsForRequest request,\n ) async {\n final ContractsForReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ContractsForResponse.fromJson(response.contractsFor);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/contracts_for_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/contracts_for_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/copy_start_receive_methods.json b/lib/basic_api/generated/methods/copy_start_receive_methods.json index cf00a2b9f6..02ce18a1af 100644 --- a/lib/basic_api/generated/methods/copy_start_receive_methods.json +++ b/lib/basic_api/generated/methods/copy_start_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Starts copy trader bets.\n ///\n /// For parameters information refer to [CopyStartRequest].\n /// Throws a [CopyTradingException] if API response contains an error\n static Future start(CopyStartRequest request) async {\n final CopyStartReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n CopyTradingException(baseExceptionModel: baseExceptionModel),\n );\n\n return CopyStartResponse.fromJson(response.copyStart);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Starts copy trader bets.\n ///\n /// For parameters information refer to [CopyStartRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future start(CopyStartRequest request) async {\n final CopyStartReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return CopyStartResponse.fromJson(response.copyStart);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/copy_start_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/copy_start_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/copy_stop_receive_methods.json b/lib/basic_api/generated/methods/copy_stop_receive_methods.json index 24f77e0474..3a1675951d 100644 --- a/lib/basic_api/generated/methods/copy_stop_receive_methods.json +++ b/lib/basic_api/generated/methods/copy_stop_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Stops copy trader bets.\n ///\n /// For parameters information refer to [CopyStopRequest].\n /// Throws a [CopyTradingException] if API response contains an error\n static Future stop(CopyStopRequest request) async {\n final CopyStopReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n CopyTradingException(baseExceptionModel: baseExceptionModel),\n );\n\n return CopyStopResponse.fromJson(response.copyStop);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Stops copy trader bets.\n ///\n /// For parameters information refer to [CopyStopRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future stop(CopyStopRequest request) async {\n final CopyStopReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return CopyStopResponse.fromJson(response.copyStop);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/copy_stop_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/copy_stop_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/copytrading_list_receive_methods.json b/lib/basic_api/generated/methods/copytrading_list_receive_methods.json index 57842468f9..5947c23b93 100644 --- a/lib/basic_api/generated/methods/copytrading_list_receive_methods.json +++ b/lib/basic_api/generated/methods/copytrading_list_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the list of active copiers and/or traders for Copy Trading\n ///\n /// Throws a [CopyTradingException] if API response contains an error\n static Future fetchList([\n CopytradingListRequest? request,\n ]) async {\n final CopytradingListReceive response = await _api.call(\n request: request ?? const CopytradingListRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n CopyTradingException(baseExceptionModel: baseExceptionModel),\n );\n\n return CopytradingListResponse.fromJson(response.copytradingList);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the list of active copiers and/or traders for Copy Trading\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchList([\n CopytradingListRequest? request,\n ]) async {\n final CopytradingListReceive response = await _api.call(\n request: request ?? const CopytradingListRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return CopytradingListResponse.fromJson(response.copytradingList);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/copytrading_list_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/copytrading_list_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/copytrading_statistics_receive_methods.json b/lib/basic_api/generated/methods/copytrading_statistics_receive_methods.json index f3a20f20ec..dbf7095e0f 100644 --- a/lib/basic_api/generated/methods/copytrading_statistics_receive_methods.json +++ b/lib/basic_api/generated/methods/copytrading_statistics_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the copy trading statistics for given `traderId` in [request]\n ///\n /// Throws a [CopyTradingException] if API response contains an error\n static Future fetchStatistics(\n CopytradingStatisticsRequest request,\n ) async {\n final CopytradingStatisticsReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n CopyTradingException(baseExceptionModel: baseExceptionModel),\n );\n\n return CopytradingStatisticsResponse.fromJson(\n response.copytradingStatistics);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the copy trading statistics for given `traderId` in [request]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchStatistics(\n CopytradingStatisticsRequest request,\n ) async {\n final CopytradingStatisticsReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return CopytradingStatisticsResponse.fromJson(\n response.copytradingStatistics);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/copytrading_statistics_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/copytrading_statistics_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/exchange_rates_receive_methods.json b/lib/basic_api/generated/methods/exchange_rates_receive_methods.json index 3ee84b9b7e..0d2ecdd8db 100644 --- a/lib/basic_api/generated/methods/exchange_rates_receive_methods.json +++ b/lib/basic_api/generated/methods/exchange_rates_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Retrieves the exchange rates from a base currency to all currencies supported by the system. \n /// \n /// For parameters information refer to [ExchangeRatesRequest]. \n /// Throws an [ExchangeException] if API response contains an error. \n static Future fetchExchangeRatesRaw( \n ExchangeRatesRequest request, \n ) async { \n final ExchangeRatesReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n ExchangeException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Retrieves the exchange rates from a base currency to all currencies supported by the system. \n /// \n /// For parameters information refer to [ExchangeRatesRequest]. \n /// Throws an [ExchangeException] if API response contains an error. \n static Future fetchExchangeRates( \n ExchangeRatesRequest request, \n ) async { \n final ExchangeRatesReceive response = await fetchExchangeRatesRaw(request); \n \n return ExchangeRates.fromJson(response.exchangeRates!); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Retrieves the exchange rates from a base currency to all currencies supported by the system. \n /// \n /// For parameters information refer to [ExchangeRatesRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchExchangeRatesRaw( \n ExchangeRatesRequest request, \n ) async { \n final ExchangeRatesReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Retrieves the exchange rates from a base currency to all currencies supported by the system. \n /// \n /// For parameters information refer to [ExchangeRatesRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchExchangeRates( \n ExchangeRatesRequest request, \n ) async { \n final ExchangeRatesReceive response = await fetchExchangeRatesRaw(request); \n \n return ExchangeRates.fromJson(response.exchangeRates!); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/exchange_rates_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/exchange_rates_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/forget_all_receive_methods.json b/lib/basic_api/generated/methods/forget_all_receive_methods.json index 39ac2157fc..fa95b0195b 100644 --- a/lib/basic_api/generated/methods/forget_all_receive_methods.json +++ b/lib/basic_api/generated/methods/forget_all_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Immediately cancels the real-time streams of messages of given type.\n ///\n /// For parameters information refer to [ForgetAllRequest].\n /// Throws a [ForgetException] if API response contains an error\n static Future forgetAllMethod(\n ForgetAllRequest request,\n ) async {\n final ForgetAllReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ForgetException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Immediately cancels the real-time streams of messages of given type.\n ///\n /// For parameters information refer to [ForgetAllRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future forgetAllMethod(\n ForgetAllRequest request,\n ) async {\n final ForgetAllReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/forget_receive_methods.json b/lib/basic_api/generated/methods/forget_receive_methods.json index cbfed8f9a6..48254d444c 100644 --- a/lib/basic_api/generated/methods/forget_receive_methods.json +++ b/lib/basic_api/generated/methods/forget_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Immediately cancels the real-time stream of messages with a specific id.\n ///\n /// For parameters information refer to [ForgetRequest].\n /// Throws a [ForgetException] if API response contains an error\n static Future forgetMethod(\n ForgetRequest request,\n ) async {\n final ForgetReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ForgetException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Immediately cancels the real-time stream of messages with a specific id.\n ///\n /// For parameters information refer to [ForgetRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future forgetMethod(\n ForgetRequest request,\n ) async {\n final ForgetReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/get_account_status_receive_methods.json b/lib/basic_api/generated/methods/get_account_status_receive_methods.json index bdc88ffb2b..712a34feba 100644 --- a/lib/basic_api/generated/methods/get_account_status_receive_methods.json +++ b/lib/basic_api/generated/methods/get_account_status_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets the account's status. \n /// \n /// For parameters information refer to [GetAccountStatusRequest]. \n /// Throws an [AccountStatusException] if API response contains an error. \n static Future fetchAccountStatusRaw() async { \n final GetAccountStatusReceive response = await _api.call( \n request: const GetAccountStatusRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n AccountStatusException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Gets the account's status. \n /// \n /// For parameters information refer to [GetAccountStatusRequest]. \n /// Throws an [AccountStatusException] if API response contains an error. \n static Future fetchAccountStatus() async { \n final GetAccountStatusReceive response = await fetchAccountStatusRaw(); \n \n return GetAccountStatusResponse.fromJson(response.getAccountStatus); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets the account's status. \n /// \n /// For parameters information refer to [GetAccountStatusRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchAccountStatusRaw() async { \n final GetAccountStatusReceive response = await _api.call( \n request: const GetAccountStatusRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Gets the account's status. \n /// \n /// For parameters information refer to [GetAccountStatusRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchAccountStatus() async { \n final GetAccountStatusReceive response = await fetchAccountStatusRaw(); \n \n return GetAccountStatusResponse.fromJson(response.getAccountStatus); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_account_status_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_account_status_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/get_financial_assessment_receive_methods.json b/lib/basic_api/generated/methods/get_financial_assessment_receive_methods.json index c9ec6289fe..578df28a8f 100644 --- a/lib/basic_api/generated/methods/get_financial_assessment_receive_methods.json +++ b/lib/basic_api/generated/methods/get_financial_assessment_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the financial assessment details.\n ///\n /// The 'financial assessment' is a questionnaire that clients of certain Landing Companies need to complete,\n /// due to regulatory and KYC (know your client) requirements.\n /// Throws a [FinancialAssessmentException] if API response contains an error\n static Future fetchAssessment(\n GetFinancialAssessmentRequest request,\n ) async {\n final GetFinancialAssessmentReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n FinancialAssessmentException(baseExceptionModel: baseExceptionModel),\n );\n\n return GetFinancialAssessmentResponse.fromJson(response.getFinancialAssessment);\n }\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the financial assessment details.\n ///\n /// The 'financial assessment' is a questionnaire that clients of certain Landing Companies need to complete,\n /// due to regulatory and KYC (know your client) requirements.\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchAssessment(\n GetFinancialAssessmentRequest request,\n ) async {\n final GetFinancialAssessmentReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return GetFinancialAssessmentResponse.fromJson(response.getFinancialAssessment);\n }\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_financial_assessment_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_financial_assessment_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/get_limits_receive_methods.json b/lib/basic_api/generated/methods/get_limits_receive_methods.json index dcb770c184..0925e800a7 100644 --- a/lib/basic_api/generated/methods/get_limits_receive_methods.json +++ b/lib/basic_api/generated/methods/get_limits_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the trading and withdrawal limits for logged in account\n ///\n /// Throws an [AccountLimitsException] if API response contains an error\n static Future fetchAccountLimits([\n GetLimitsRequest? request,\n ]) async {\n final GetLimitsReceive response = await _api.call(\n request: request ?? const GetLimitsRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AccountLimitsException(baseExceptionModel: baseExceptionModel),\n );\n\n return GetLimitsResponse.fromJson(response.getLimits);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the trading and withdrawal limits for logged in account\n ///\n /// Throws an [BaseAPIException] if API response contains an error\n static Future fetchAccountLimits([\n GetLimitsRequest? request,\n ]) async {\n final GetLimitsReceive response = await _api.call(\n request: request ?? const GetLimitsRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return GetLimitsResponse.fromJson(response.getLimits);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_limits_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_limits_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/get_self_exclusion_receive_methods.json b/lib/basic_api/generated/methods/get_self_exclusion_receive_methods.json index 832d790698..30f1d09a66 100644 --- a/lib/basic_api/generated/methods/get_self_exclusion_receive_methods.json +++ b/lib/basic_api/generated/methods/get_self_exclusion_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Allows users to exclude themselves from the website for certain periods of time,\n /// or to set limits on their trading activities.\n ///\n /// This facility is a regulatory requirement for certain Landing Companies.\n /// For parameters information refer to [GetSelfExclusionRequest].\n /// Throws a [SelfExclusionException] if API response contains an error\n static Future fetchSelfExclusion([\n GetSelfExclusionRequest? request,\n ]) async {\n final GetSelfExclusionReceive response = await _api.call(\n request: request ?? const GetSelfExclusionRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n SelfExclusionException(baseExceptionModel: baseExceptionModel),\n );\n\n return GetSelfExclusionResponse.fromJson(response.getSelfExclusion);\n }\n\n /// Sets Self-Exclusion (this call should be used in conjunction with [fetchSelfExclusion])\n ///\n /// For parameters information refer to [SetSelfExclusionRequest].\n /// Throws a [SelfExclusionException] if API response contains an error\n static Future setSelfExclusion(SetSelfExclusionRequest request) async {\n final SetSelfExclusionReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n SelfExclusionException(baseExceptionModel: baseExceptionModel),\n );\n\n return getBool(response.setSelfExclusion);\n }\n\n /// Excludes user from the website based this parameters\n ///\n /// (this call should be used in conjunction with [fetchSelfExclusion])\n /// Throws a [SelfExclusionException] if API response contains an error\n Future exclude() async {\n final SetSelfExclusionReceive response = await _api.call(\n request: SetSelfExclusionRequest(\n excludeUntil: getSelfExclusion?.excludeUntil,\n max30dayDeposit: getSelfExclusion?.max30dayDeposit,\n max30dayLosses: getSelfExclusion?.max30dayLosses,\n max30dayTurnover: getSelfExclusion?.max30dayTurnover,\n max7dayDeposit: getSelfExclusion?.max7dayDeposit,\n max7dayLosses: getSelfExclusion?.max7dayLosses,\n max7dayTurnover: getSelfExclusion?.max7dayTurnover,\n maxBalance: getSelfExclusion?.maxBalance,\n maxDeposit: getSelfExclusion?.maxDeposit,\n maxLosses: getSelfExclusion?.maxLosses,\n maxOpenBets: getSelfExclusion?.maxOpenBets,\n maxTurnover: getSelfExclusion?.maxTurnover,\n sessionDurationLimit: getSelfExclusion?.sessionDurationLimit,\n timeoutUntil:\n getSecondsSinceEpochDateTime(getSelfExclusion?.timeoutUntil),\n ),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n SelfExclusionException(baseExceptionModel: baseExceptionModel),\n );\n\n return getBool(response.setSelfExclusion);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Allows users to exclude themselves from the website for certain periods of time,\n /// or to set limits on their trading activities.\n ///\n /// This facility is a regulatory requirement for certain Landing Companies.\n /// For parameters information refer to [GetSelfExclusionRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchSelfExclusion([\n GetSelfExclusionRequest? request,\n ]) async {\n final GetSelfExclusionReceive response = await _api.call(\n request: request ?? const GetSelfExclusionRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return GetSelfExclusionResponse.fromJson(response.getSelfExclusion);\n }\n\n /// Sets Self-Exclusion (this call should be used in conjunction with [fetchSelfExclusion])\n ///\n /// For parameters information refer to [SetSelfExclusionRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future setSelfExclusion(SetSelfExclusionRequest request) async {\n final SetSelfExclusionReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return getBool(response.setSelfExclusion);\n }\n\n /// Excludes user from the website based this parameters\n ///\n /// (this call should be used in conjunction with [fetchSelfExclusion])\n /// Throws a [BaseAPIException] if API response contains an error\n Future exclude() async {\n final SetSelfExclusionReceive response = await _api.call(\n request: SetSelfExclusionRequest(\n excludeUntil: getSelfExclusion?.excludeUntil,\n max30dayDeposit: getSelfExclusion?.max30dayDeposit,\n max30dayLosses: getSelfExclusion?.max30dayLosses,\n max30dayTurnover: getSelfExclusion?.max30dayTurnover,\n max7dayDeposit: getSelfExclusion?.max7dayDeposit,\n max7dayLosses: getSelfExclusion?.max7dayLosses,\n max7dayTurnover: getSelfExclusion?.max7dayTurnover,\n maxBalance: getSelfExclusion?.maxBalance,\n maxDeposit: getSelfExclusion?.maxDeposit,\n maxLosses: getSelfExclusion?.maxLosses,\n maxOpenBets: getSelfExclusion?.maxOpenBets,\n maxTurnover: getSelfExclusion?.maxTurnover,\n sessionDurationLimit: getSelfExclusion?.sessionDurationLimit,\n timeoutUntil:\n getSecondsSinceEpochDateTime(getSelfExclusion?.timeoutUntil),\n ),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return getBool(response.setSelfExclusion);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_self_exclusion_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_self_exclusion_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_self_exclusion_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_self_exclusion_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/get_settings_receive_methods.json b/lib/basic_api/generated/methods/get_settings_receive_methods.json index c54aefd3d9..1d1a36ca9d 100644 --- a/lib/basic_api/generated/methods/get_settings_receive_methods.json +++ b/lib/basic_api/generated/methods/get_settings_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets user's settings (email, date of birth, address etc). \n /// \n /// For parameters information refer to [GetSettingsRequest]. \n /// Throws an [AccountSettingsException] if API response contains an error. \n static Future fetchAccountSettingRaw([ \n GetSettingsRequest? request, \n ]) async { \n final GetSettingsReceive response = await _api.call( \n request: request ?? const GetSettingsRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n AccountSettingsException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Gets user's settings (email, date of birth, address etc). \n /// \n /// For parameters information refer to [GetSettingsRequest]. \n /// Throws an [AccountSettingsException] if API response contains an error. \n static Future changeAccountSettingRaw( \n SetSettingsRequest request, \n ) async { \n final SetSettingsReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n AccountSettingsException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Gets user's settings (email, date of birth, address etc). \n /// \n /// Throws an [AccountSettingsException] if API response contains an error. \n static Future fetchAccountSetting([ \n GetSettingsRequest? request, \n ]) async { \n final GetSettingsReceive response = await fetchAccountSettingRaw(request); \n \n return GetSettingsResponse.fromJson(response.getSettings); \n } \n \n /// Changes the user's settings with parameters specified as [SetSettingsRequest]. \n /// \n /// Throws an [AccountSettingsException] if API response contains an error. \n static Future changeAccountSetting( \n SetSettingsRequest request, \n ) async { \n final SetSettingsReceive response = await changeAccountSettingRaw(request); \n \n return SetSettingsResponse(setSettings: response.setSettings ?? 0); \n } \n \n /// Changes user's setting \n Future changeSetting({ \n required String secretAnswer, \n required String secretQuestion, \n }) => \n changeAccountSetting( \n SetSettingsRequest( \n accountOpeningReason: getSettings?.accountOpeningReason, \n addressCity: getSettings?.addressCity, \n addressLine1: getSettings?.addressLine1, \n addressLine2: getSettings?.addressLine2, \n addressPostcode: getSettings?.addressPostcode, \n addressState: getSettings?.addressState, \n allowCopiers: getSettings?.allowCopiers, \n citizen: getSettings?.citizen, \n dateOfBirth: getStringFromDateTime(getSettings?.dateOfBirth), \n emailConsent: getSettings?.emailConsent, \n firstName: getSettings?.firstName, \n lastName: getSettings?.lastName, \n phone: getSettings?.phone, \n placeOfBirth: getSettings?.placeOfBirth, \n requestProfessionalStatus: \n getInt(value: getSettings?.requestProfessionalStatus), \n residence: getSettings?.residence, \n salutation: getSettings?.salutation, \n secretAnswer: secretAnswer, \n secretQuestion: secretQuestion, \n taxIdentificationNumber: getSettings?.taxIdentificationNumber, \n taxResidence: getSettings?.taxResidence, \n ), \n );", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets user's settings (email, date of birth, address etc). \n /// \n /// For parameters information refer to [GetSettingsRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchAccountSettingRaw([ \n GetSettingsRequest? request, \n ]) async { \n final GetSettingsReceive response = await _api.call( \n request: request ?? const GetSettingsRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Gets user's settings (email, date of birth, address etc). \n /// \n /// For parameters information refer to [GetSettingsRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future changeAccountSettingRaw( \n SetSettingsRequest request, \n ) async { \n final SetSettingsReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Gets user's settings (email, date of birth, address etc). \n /// \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchAccountSetting([ \n GetSettingsRequest? request, \n ]) async { \n final GetSettingsReceive response = await fetchAccountSettingRaw(request); \n \n return GetSettingsResponse.fromJson(response.getSettings); \n } \n \n /// Changes the user's settings with parameters specified as [SetSettingsRequest]. \n /// \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future changeAccountSetting( \n SetSettingsRequest request, \n ) async { \n final SetSettingsReceive response = await changeAccountSettingRaw(request); \n \n return SetSettingsResponse(setSettings: response.setSettings ?? 0); \n } \n \n /// Changes user's setting \n Future changeSetting({ \n required String secretAnswer, \n required String secretQuestion, \n }) => \n changeAccountSetting( \n SetSettingsRequest( \n accountOpeningReason: getSettings?.accountOpeningReason, \n addressCity: getSettings?.addressCity, \n addressLine1: getSettings?.addressLine1, \n addressLine2: getSettings?.addressLine2, \n addressPostcode: getSettings?.addressPostcode, \n addressState: getSettings?.addressState, \n allowCopiers: getSettings?.allowCopiers, \n citizen: getSettings?.citizen, \n dateOfBirth: getStringFromDateTime(getSettings?.dateOfBirth), \n emailConsent: getSettings?.emailConsent, \n firstName: getSettings?.firstName, \n lastName: getSettings?.lastName, \n phone: getSettings?.phone, \n placeOfBirth: getSettings?.placeOfBirth, \n requestProfessionalStatus: \n getInt(value: getSettings?.requestProfessionalStatus), \n residence: getSettings?.residence, \n salutation: getSettings?.salutation, \n secretAnswer: secretAnswer, \n secretQuestion: secretQuestion, \n taxIdentificationNumber: getSettings?.taxIdentificationNumber, \n taxResidence: getSettings?.taxResidence, \n ), \n );", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/response/set_settings_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_settings_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_settings_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_settings_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_settings_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/landing_company_receive_methods.json b/lib/basic_api/generated/methods/landing_company_receive_methods.json index fd35abb944..62bb7206ea 100644 --- a/lib/basic_api/generated/methods/landing_company_receive_methods.json +++ b/lib/basic_api/generated/methods/landing_company_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets landing companies for given [LandingCompanyRequest]\n ///\n /// Throws a [LandingCompanyException] if API response contains an error\n static Future fetchLandingCompanies(\n LandingCompanyRequest request,\n ) async {\n final LandingCompanyReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n LandingCompanyException(baseExceptionModel: baseExceptionModel),\n );\n\n return LandingCompanyResponse.fromJson(response.landingCompany);\n }\n\n /// Gets details of a landing company specified in [LandingCompanyDetailsRequest]\n ///\n /// Throws a [LandingCompanyException] if API response contains an error\n static Future fetchLandingCompanyDetails(\n LandingCompanyDetailsRequest request,\n ) async {\n final LandingCompanyDetailsReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n LandingCompanyException(baseExceptionModel: baseExceptionModel),\n );\n\n return LandingCompanyDetailsResponse.fromJson(response.landingCompanyDetails);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets landing companies for given [LandingCompanyRequest]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchLandingCompanies(\n LandingCompanyRequest request,\n ) async {\n final LandingCompanyReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return LandingCompanyResponse.fromJson(response.landingCompany);\n }\n\n /// Gets details of a landing company specified in [LandingCompanyDetailsRequest]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchLandingCompanyDetails(\n LandingCompanyDetailsRequest request,\n ) async {\n final LandingCompanyDetailsReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return LandingCompanyDetailsResponse.fromJson(response.landingCompanyDetails);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/response/landing_company_details_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/landing_company_details_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/landing_company_details_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/landing_company_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/landing_company_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/login_history_receive_methods.json b/lib/basic_api/generated/methods/login_history_receive_methods.json index a4d5c69049..d2791fd5ea 100644 --- a/lib/basic_api/generated/methods/login_history_receive_methods.json +++ b/lib/basic_api/generated/methods/login_history_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves a summary of login history for user.\n ///\n /// For parameters information refer to [LoginHistory].\n /// Throws an [AuthorizeException] if API response contains an error\n static Future fetchHistory([\n LoginHistoryRequest? request,\n ]) async {\n final LoginHistoryReceive response = await _api.call(\n request: request ?? const LoginHistoryRequest(limit: 10),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AuthorizeException(baseExceptionModel: baseExceptionModel),\n );\n\n return LoginHistoryResponse.fromJson(response.loginHistory);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves a summary of login history for user.\n ///\n /// For parameters information refer to [LoginHistory].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future fetchHistory([\n LoginHistoryRequest? request,\n ]) async {\n final LoginHistoryReceive response = await _api.call(\n request: request ?? const LoginHistoryRequest(limit: 10),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return LoginHistoryResponse.fromJson(response.loginHistory);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/login_history_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/login_history_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/logout_receive_methods.json b/lib/basic_api/generated/methods/logout_receive_methods.json index f50d699826..22088f521a 100644 --- a/lib/basic_api/generated/methods/logout_receive_methods.json +++ b/lib/basic_api/generated/methods/logout_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Logs out from the web-socket's session. \n /// \n /// For parameters information refer to [LogoutRequest]. \n /// Throws an [AuthorizeException] if API response contains an error. \n static Future logoutMethodRaw([LogoutRequest? request]) async { \n final LogoutReceive response = \n await _api.call(request: request ?? const LogoutRequest()); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n AuthorizeException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Logs out from the web-socket's session. \n /// \n /// For parameters information refer to [LogoutRequest]. \n /// Throws an [AuthorizeException] if API response contains an error. \n static Future logoutMethod([LogoutRequest? request]) async { \n final LogoutReceive response = await logoutMethodRaw(request); \n \n return LogoutResponse.fromJson(response.logout); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Logs out from the web-socket's session. \n /// \n /// For parameters information refer to [LogoutRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future logoutMethodRaw([LogoutRequest? request]) async { \n final LogoutReceive response = \n await _api.call(request: request ?? const LogoutRequest()); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Logs out from the web-socket's session. \n /// \n /// For parameters information refer to [LogoutRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future logoutMethod([LogoutRequest? request]) async { \n final LogoutReceive response = await logoutMethodRaw(request); \n \n return LogoutResponse.fromJson(response.logout); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/logout_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/logout_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/mt5_deposit_receive_methods.json b/lib/basic_api/generated/methods/mt5_deposit_receive_methods.json index 5a4cc52268..68bcdc56b5 100644 --- a/lib/basic_api/generated/methods/mt5_deposit_receive_methods.json +++ b/lib/basic_api/generated/methods/mt5_deposit_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Allows deposit into MT5 account from binary account.\n ///\n /// For parameters information refer to [Mt5DepositRequest].\n /// Throws a [MT5Exception] if API response contains an error\n static Future deposit(Mt5DepositRequest request) async {\n final Mt5DepositReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n MT5Exception(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5DepositResponse.fromJson(\n response.mt5Deposit,\n response.binaryTransactionId,\n );\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Allows deposit into MT5 account from binary account.\n ///\n /// For parameters information refer to [Mt5DepositRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future deposit(Mt5DepositRequest request) async {\n final Mt5DepositReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5DepositResponse.fromJson(\n response.mt5Deposit,\n response.binaryTransactionId,\n );\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_deposit_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_deposit_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/mt5_get_settings_receive_methods.json b/lib/basic_api/generated/methods/mt5_get_settings_receive_methods.json index f8b9e3c160..5f5328cc7d 100644 --- a/lib/basic_api/generated/methods/mt5_get_settings_receive_methods.json +++ b/lib/basic_api/generated/methods/mt5_get_settings_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets MT5 user account settings.\n ///\n /// For parameters information refer to [Mt5GetSettingsRequest].\n /// Throws a [MT5Exception] if API response contains an error\n static Future fetchSettings(\n Mt5GetSettingsRequest request,\n ) async {\n final Mt5GetSettingsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n MT5Exception(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5GetSettingsResponse.fromJson(response.mt5GetSettings);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets MT5 user account settings.\n ///\n /// For parameters information refer to [Mt5GetSettingsRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchSettings(\n Mt5GetSettingsRequest request,\n ) async {\n final Mt5GetSettingsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5GetSettingsResponse.fromJson(response.mt5GetSettings);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_get_settings_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_get_settings_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/mt5_login_list_receive_methods.json b/lib/basic_api/generated/methods/mt5_login_list_receive_methods.json index f771371b7e..44512b8880 100644 --- a/lib/basic_api/generated/methods/mt5_login_list_receive_methods.json +++ b/lib/basic_api/generated/methods/mt5_login_list_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the list of MT5 accounts for client.\n ///\n /// For parameters information refer to [Mt5LoginListRequest].\n /// Throws a [MT5Exception] if API response contains an error\n static Future fetchLoginList(\n Mt5LoginListRequest request,\n ) async {\n final Mt5LoginListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n MT5Exception(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5LoginListResponse.fromJson(response.mt5LoginList);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the list of MT5 accounts for client.\n ///\n /// For parameters information refer to [Mt5LoginListRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchLoginList(\n Mt5LoginListRequest request,\n ) async {\n final Mt5LoginListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5LoginListResponse.fromJson(response.mt5LoginList);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_login_list_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_login_list_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/mt5_new_account_receive_methods.json b/lib/basic_api/generated/methods/mt5_new_account_receive_methods.json index de572eecd3..72de8ac590 100644 --- a/lib/basic_api/generated/methods/mt5_new_account_receive_methods.json +++ b/lib/basic_api/generated/methods/mt5_new_account_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Creates new MT5 user, either demo or real money user.\n ///\n /// For parameters information refer to [Mt5NewAccountRequest].\n /// Throws a [MT5Exception] if API response contains an error\n static Future createNewAccount(\n Mt5NewAccountRequest request,\n ) async {\n final Mt5NewAccountReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n MT5Exception(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5NewAccountResponse.fromJson(response.mt5NewAccount);\n }\n\n /// Allows deposit into MT5 account from binary account.\n ///\n /// Throws a [MT5Exception] if API response contains an error\n Future deposit({\n required double amount,\n required String fromBinary,\n }) =>\n Mt5DepositResponse.deposit(\n Mt5DepositRequest(\n amount: amount,\n fromBinary: fromBinary,\n toMt5: mt5NewAccount?.login,\n ),\n );\n\n /// Changes password of the MT5 account.\n ///\n /// Throws a [MT5Exception] if API response contains an error\n Future changePassword({\n required String newPassword,\n required String oldPassword,\n required PasswordType passwordType,\n }) =>\n Mt5PasswordChangeResponse.changePassword(\n Mt5PasswordChangeRequest(\n login: mt5NewAccount?.login,\n newPassword: newPassword,\n oldPassword: oldPassword,\n passwordType: getStringFromEnum(passwordType),\n ),\n );\n\n /// Validates the main password for the MT5 user.\n ///\n /// Throws a [MT5Exception] if API response contains an error\n Future checkPassword({\n required String password,\n required PasswordType passwordType,\n }) =>\n Mt5PasswordCheckResponse.checkPassword(\n Mt5PasswordCheckRequest(\n login: mt5NewAccount?.login,\n password: password,\n passwordType: getStringFromEnum(passwordType),\n ),\n );\n\n /// Resets the password of MT5 account.\n ///\n /// Throws a [MT5Exception] if API response contains an error\n Future resetPassword({\n required String newPassword,\n required PasswordType passwordType,\n required String verificationCode,\n }) =>\n Mt5PasswordResetResponse.resetPassword(\n Mt5PasswordResetRequest(\n login: mt5NewAccount?.login,\n newPassword: newPassword,\n passwordType: getStringFromEnum(passwordType),\n verificationCode: verificationCode,\n ),\n );\n\n /// Gets the MT5 user account settings.\n ///\n /// Throws a [MT5Exception] if API response contains an error\n Future fetchSettings() =>\n Mt5GetSettingsResponse.fetchSettings(\n Mt5GetSettingsRequest(login: mt5NewAccount?.login));\n\n /// Allows withdrawal from MT5 account to Binary account.\n ///\n /// Throws a [MT5Exception] if API response contains an error\n Future withdraw({\n required double amount,\n required String toBinary,\n }) =>\n Mt5WithdrawalResponse.withdraw(\n Mt5WithdrawalRequest(\n amount: amount,\n fromMt5: mt5NewAccount?.login,\n toBinary: toBinary,\n ),\n );", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Creates new MT5 user, either demo or real money user.\n ///\n /// For parameters information refer to [Mt5NewAccountRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future createNewAccount(\n Mt5NewAccountRequest request,\n ) async {\n final Mt5NewAccountReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5NewAccountResponse.fromJson(response.mt5NewAccount);\n }\n\n /// Allows deposit into MT5 account from binary account.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future deposit({\n required double amount,\n required String fromBinary,\n }) =>\n Mt5DepositResponse.deposit(\n Mt5DepositRequest(\n amount: amount,\n fromBinary: fromBinary,\n toMt5: mt5NewAccount?.login,\n ),\n );\n\n /// Changes password of the MT5 account.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future changePassword({\n required String newPassword,\n required String oldPassword,\n required PasswordType passwordType,\n }) =>\n Mt5PasswordChangeResponse.changePassword(\n Mt5PasswordChangeRequest(\n login: mt5NewAccount?.login,\n newPassword: newPassword,\n oldPassword: oldPassword,\n passwordType: getStringFromEnum(passwordType),\n ),\n );\n\n /// Validates the main password for the MT5 user.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future checkPassword({\n required String password,\n required PasswordType passwordType,\n }) =>\n Mt5PasswordCheckResponse.checkPassword(\n Mt5PasswordCheckRequest(\n login: mt5NewAccount?.login,\n password: password,\n passwordType: getStringFromEnum(passwordType),\n ),\n );\n\n /// Resets the password of MT5 account.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future resetPassword({\n required String newPassword,\n required PasswordType passwordType,\n required String verificationCode,\n }) =>\n Mt5PasswordResetResponse.resetPassword(\n Mt5PasswordResetRequest(\n login: mt5NewAccount?.login,\n newPassword: newPassword,\n passwordType: getStringFromEnum(passwordType),\n verificationCode: verificationCode,\n ),\n );\n\n /// Gets the MT5 user account settings.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future fetchSettings() =>\n Mt5GetSettingsResponse.fetchSettings(\n Mt5GetSettingsRequest(login: mt5NewAccount?.login));\n\n /// Allows withdrawal from MT5 account to Binary account.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future withdraw({\n required double amount,\n required String toBinary,\n }) =>\n Mt5WithdrawalResponse.withdraw(\n Mt5WithdrawalRequest(\n amount: amount,\n fromMt5: mt5NewAccount?.login,\n toBinary: toBinary,\n ),\n );", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/mt5_deposit_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/mt5_get_settings_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/mt5_password_change_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/mt5_password_check_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/mt5_password_reset_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/mt5_withdrawal_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_deposit_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_get_settings_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_new_account_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_new_account_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_password_change_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_password_check_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_password_reset_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_withdrawal_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/mt5_password_change_receive_methods.json b/lib/basic_api/generated/methods/mt5_password_change_receive_methods.json index b8242c6dc4..3ec33261a9 100644 --- a/lib/basic_api/generated/methods/mt5_password_change_receive_methods.json +++ b/lib/basic_api/generated/methods/mt5_password_change_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Changes the password of the MT5 account.\n ///\n /// For parameters information refer to [Mt5PasswordChangeRequest].\n /// Throws a [MT5Exception] if API response contains an error\n static Future changePassword(\n Mt5PasswordChangeRequest request,\n ) async {\n final Mt5PasswordChangeReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n MT5Exception(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5PasswordChangeResponse.fromJson(response.mt5PasswordChange);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Changes the password of the MT5 account.\n ///\n /// For parameters information refer to [Mt5PasswordChangeRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future changePassword(\n Mt5PasswordChangeRequest request,\n ) async {\n final Mt5PasswordChangeReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5PasswordChangeResponse.fromJson(response.mt5PasswordChange);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_password_change_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_password_change_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/mt5_password_check_receive_methods.json b/lib/basic_api/generated/methods/mt5_password_check_receive_methods.json index 338d2adcca..37fced0811 100644 --- a/lib/basic_api/generated/methods/mt5_password_check_receive_methods.json +++ b/lib/basic_api/generated/methods/mt5_password_check_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": " static final BaseAPI _api = Injector()();\n\n /// Validates the main password for the MT5 user.\n ///\n /// For parameters information refer to [Mt5PasswordCheckRequest].\n /// Throws a [MT5Exception] if API response contains an error\n static Future checkPassword(\n Mt5PasswordCheckRequest request) async {\n final Mt5PasswordCheckReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n MT5Exception(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5PasswordCheckResponse.fromJson(response.mt5PasswordCheck);\n }", + "methods": " static final BaseAPI _api = Injector()();\n\n /// Validates the main password for the MT5 user.\n ///\n /// For parameters information refer to [Mt5PasswordCheckRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future checkPassword(\n Mt5PasswordCheckRequest request) async {\n final Mt5PasswordCheckReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5PasswordCheckResponse.fromJson(response.mt5PasswordCheck);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_password_check_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_password_check_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/mt5_password_reset_receive_methods.json b/lib/basic_api/generated/methods/mt5_password_reset_receive_methods.json index 4ac6345815..313455c694 100644 --- a/lib/basic_api/generated/methods/mt5_password_reset_receive_methods.json +++ b/lib/basic_api/generated/methods/mt5_password_reset_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Resets the password of MT5 account.\n ///\n /// For parameters information refer to [Mt5PasswordResetRequest].\n /// Throws a [MT5Exception] if API response contains an error\n static Future resetPassword(\n Mt5PasswordResetRequest request,\n ) async {\n final Mt5PasswordResetReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n MT5Exception(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5PasswordResetResponse.fromJson(response.mt5PasswordReset);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Resets the password of MT5 account.\n ///\n /// For parameters information refer to [Mt5PasswordResetRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future resetPassword(\n Mt5PasswordResetRequest request,\n ) async {\n final Mt5PasswordResetReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5PasswordResetResponse.fromJson(response.mt5PasswordReset);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_password_reset_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_password_reset_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/mt5_withdrawal_receive_methods.json b/lib/basic_api/generated/methods/mt5_withdrawal_receive_methods.json index ab2b385cb4..d331066cf3 100644 --- a/lib/basic_api/generated/methods/mt5_withdrawal_receive_methods.json +++ b/lib/basic_api/generated/methods/mt5_withdrawal_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Allows withdrawal from MT5 account to Binary account.\n ///\n /// For parameters information refer to [Mt5WithdrawalRequest].\n /// Throws a [MT5Exception] if API response contains an error\n static Future withdraw(\n Mt5WithdrawalRequest request,\n ) async {\n final Mt5WithdrawalReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n MT5Exception(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5WithdrawalResponse.fromJson(\n response.mt5Withdrawal,\n response.binaryTransactionId,\n );\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Allows withdrawal from MT5 account to Binary account.\n ///\n /// For parameters information refer to [Mt5WithdrawalRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future withdraw(\n Mt5WithdrawalRequest request,\n ) async {\n final Mt5WithdrawalReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5WithdrawalResponse.fromJson(\n response.mt5Withdrawal,\n response.binaryTransactionId,\n );\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_withdrawal_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_withdrawal_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/new_account_real_receive_methods.json b/lib/basic_api/generated/methods/new_account_real_receive_methods.json index e54b0370ad..9acffcad3d 100644 --- a/lib/basic_api/generated/methods/new_account_real_receive_methods.json +++ b/lib/basic_api/generated/methods/new_account_real_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Opens a new real account.\n ///\n /// For parameters information refer to [NewAccountRealRequest].\n /// Throws a [NewAccountException] ifAP\n static Future openNewRealAccount(\n NewAccountRealRequest request,\n ) async {\n final NewAccountRealReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n NewAccountException(baseExceptionModel: baseExceptionModel),\n );\n\n return NewAccountRealResponse.fromJson(response.newAccountReal);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Opens a new real account.\n ///\n /// For parameters information refer to [NewAccountRealRequest].\n /// Throws a [BaseAPIException] ifAP\n static Future openNewRealAccount(\n NewAccountRealRequest request,\n ) async {\n final NewAccountRealReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return NewAccountRealResponse.fromJson(response.newAccountReal);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/new_account_real_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/new_account_real_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/new_account_virtual_receive_methods.json b/lib/basic_api/generated/methods/new_account_virtual_receive_methods.json index a5e6695b8c..b095060dab 100644 --- a/lib/basic_api/generated/methods/new_account_virtual_receive_methods.json +++ b/lib/basic_api/generated/methods/new_account_virtual_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Opens a new virtual account.\n ///\n /// For parameters information refer to [NewAccountVirtualRequest].\n /// Throws a [NewAccountException] if API response contains an error\n static Future openNewVirtualAccount(\n NewAccountVirtualRequest request,\n ) async {\n final NewAccountVirtualReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n NewAccountException(baseExceptionModel: baseExceptionModel),\n );\n\n return NewAccountVirtualResponse.fromJson(response.newAccountVirtual);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Opens a new virtual account.\n ///\n /// For parameters information refer to [NewAccountVirtualRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future openNewVirtualAccount(\n NewAccountVirtualRequest request,\n ) async {\n final NewAccountVirtualReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return NewAccountVirtualResponse.fromJson(response.newAccountVirtual);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/new_account_virtual_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/new_account_virtual_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/oauth_apps_receive_methods.json b/lib/basic_api/generated/methods/oauth_apps_receive_methods.json index 410222195f..4906abfe66 100644 --- a/lib/basic_api/generated/methods/oauth_apps_receive_methods.json +++ b/lib/basic_api/generated/methods/oauth_apps_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets oauth application that used for the authorized account.\n ///\n /// Throws an [AppException] if API response contains an error\n static Future fetchOauthApps([\n OauthAppsRequest? request,\n ]) async {\n final OauthAppsReceive response = await _api.call(\n request: request ?? const OauthAppsRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AppException(baseExceptionModel: baseExceptionModel),\n );\n\n return OauthAppsResponse.fromJson(response.oauthApps);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets oauth application that used for the authorized account.\n ///\n /// Throws an [BaseAPIException] if API response contains an error\n static Future fetchOauthApps([\n OauthAppsRequest? request,\n ]) async {\n final OauthAppsReceive response = await _api.call(\n request: request ?? const OauthAppsRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return OauthAppsResponse.fromJson(response.oauthApps);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/oauth_apps_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/oauth_apps_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_advert_create_receive_methods.json b/lib/basic_api/generated/methods/p2p_advert_create_receive_methods.json index 505e5ec077..289d4406f0 100644 --- a/lib/basic_api/generated/methods/p2p_advert_create_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advert_create_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Creates a P2P (peer to peer) advert. Can only be used by an approved P2P advertiser.\n ///\n /// For parameters information refer to [P2pAdvertCreateRequest].\n /// Throws a [P2PAdvertException] if API response contains an error\n static Future createAdvert(\n P2pAdvertCreateRequest request,\n ) async {\n final P2pAdvertCreateReceive response = await createAdvertRaw(request);\n\n return P2pAdvertCreateResponse.fromJson(response.p2pAdvertCreate);\n }\n\n /// Creates a P2P (peer to peer) advert. Can only be used by an approved P2P advertiser.\n ///\n /// For parameters information refer to [P2pAdvertCreateRequest].\n /// Throws a [P2PAdvertException] if API response contains an error\n static Future createAdvertRaw(\n P2pAdvertCreateRequest request,\n ) async {\n final P2pAdvertCreateReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n P2PAdvertException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Creates a P2P (peer to peer) advert. Can only be used by an approved P2P advertiser.\n ///\n /// For parameters information refer to [P2pAdvertCreateRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future createAdvert(\n P2pAdvertCreateRequest request,\n ) async {\n final P2pAdvertCreateReceive response = await createAdvertRaw(request);\n\n return P2pAdvertCreateResponse.fromJson(response.p2pAdvertCreate);\n }\n\n /// Creates a P2P (peer to peer) advert. Can only be used by an approved P2P advertiser.\n ///\n /// For parameters information refer to [P2pAdvertCreateRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future createAdvertRaw(\n P2pAdvertCreateRequest request,\n ) async {\n final P2pAdvertCreateReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/p2p_advert_exception.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_advert_info_receive_methods.json b/lib/basic_api/generated/methods/p2p_advert_info_receive_methods.json index ed9fe72e9a..f802837575 100644 --- a/lib/basic_api/generated/methods/p2p_advert_info_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advert_info_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves information about a P2P (peer to peer) advert.\n ///\n /// For parameters information refer to [P2pAdvertInfoRequest].\n /// Throws a [P2PAdvertException] if API response contains an error\n static Future fetchAdvert(\n P2pAdvertInfoRequest request,\n ) async {\n final P2pAdvertInfoReceive response = await fetchAdvertRaw(request);\n\n return P2pAdvertInfoResponse.fromJson(\n response.p2pAdvertInfo, response.subscription);\n }\n\n /// Retrieves information about a P2P (peer to peer) advert.\n ///\n /// For parameters information refer to [P2pAdvertInfoRequest].\n /// Throws a [P2PAdvertException] if API response contains an error\n static Future fetchAdvertRaw(\n P2pAdvertInfoRequest request,\n ) async {\n final P2pAdvertInfoReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n P2PAdvertException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }\n\n /// Updates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// [delete] to permanently delete the advert\n /// [isActive] to activate or deactivate the advert\n /// Throws a [P2PAdvertException] if API response contains an error\n Future update({\n bool? delete,\n bool? isActive,\n }) =>\n P2pAdvertUpdateResponse.updateAdvert(\n P2pAdvertUpdateRequest(\n id: p2pAdvertInfo?.id,\n delete: delete ?? false,\n isActive: isActive ?? p2pAdvertInfo?.isActive,\n ),\n );\n\n /// Updates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// [delete] to permanently delete the advert\n /// [isActive] to activate or deactivate the advert\n /// Throws a [P2PAdvertException] if API response contains an error\n Future updateRaw({\n bool? delete,\n bool? isActive,\n }) =>\n P2pAdvertUpdateResponse.updateAdvertRaw(\n P2pAdvertUpdateRequest(\n id: p2pAdvertInfo?.id,\n delete: delete ?? false,\n isActive: isActive ?? p2pAdvertInfo?.isActive,\n ),\n );\n\n /// Deletes permanently a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [P2PAdvertException] if API response contains an error\n Future delete() => update(delete: true);\n\n /// Deletes permanently a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [P2PAdvertException] if API response contains an error\n Future deleteRaw() => updateRaw(delete: true);\n\n /// Activates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [P2PAdvertException] if API response contains an error\n Future activate() async => update(isActive: true);\n\n /// Activates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [P2PAdvertException] if API response contains an error\n Future activateRaw() async =>\n updateRaw(isActive: true);\n\n /// Deactivates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [P2PAdvertException] if API response contains an error\n Future deactivate() async => update(isActive: false);\n\n /// Deactivates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [P2PAdvertException] if API response contains an error\n Future deactivateRaw() async =>\n updateRaw(isActive: false);\n\n /// Creates order on this advert.\n ///\n /// [amount] is the amount of currency to be bought or sold.\n /// [contactInfo] is seller contact information. Only applicable for [OrderType.sell].\n /// [paymentInfo] is payment instructions. Only applicable for [OrderType.sell].\n /// Throws [P2POrderException] if API response contains an error.\n Future createOrder({\n required double amount,\n String? contactInfo,\n String? paymentInfo,\n }) =>\n P2pOrderCreateResponse.create(\n P2pOrderCreateRequest(\n advertId: p2pAdvertInfo?.id,\n amount: amount,\n contactInfo: contactInfo,\n paymentInfo: paymentInfo,\n paymentMethodIds: const [],\n ),\n );\n\n /// Creates order on this advert.\n ///\n /// [amount] is the amount of currency to be bought or sold.\n /// [contactInfo] is seller contact information. Only applicable for [OrderType.sell].\n /// [paymentInfo] is payment instructions. Only applicable for [OrderType.sell].\n /// Throws [P2POrderException] if API response contains an error.\n Future createOrderRaw({\n required double amount,\n String? contactInfo,\n String? paymentInfo,\n }) =>\n P2pOrderCreateResponse.createRaw(\n P2pOrderCreateRequest(\n advertId: p2pAdvertInfo?.id,\n amount: amount,\n contactInfo: contactInfo,\n paymentInfo: paymentInfo,\n paymentMethodIds: const [],\n ),\n );", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves information about a P2P (peer to peer) advert.\n ///\n /// For parameters information refer to [P2pAdvertInfoRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchAdvert(\n P2pAdvertInfoRequest request,\n ) async {\n final P2pAdvertInfoReceive response = await fetchAdvertRaw(request);\n\n return P2pAdvertInfoResponse.fromJson(\n response.p2pAdvertInfo, response.subscription);\n }\n\n /// Retrieves information about a P2P (peer to peer) advert.\n ///\n /// For parameters information refer to [P2pAdvertInfoRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchAdvertRaw(\n P2pAdvertInfoRequest request,\n ) async {\n final P2pAdvertInfoReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }\n\n /// Updates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// [delete] to permanently delete the advert\n /// [isActive] to activate or deactivate the advert\n /// Throws a [BaseAPIException] if API response contains an error\n Future update({\n bool? delete,\n bool? isActive,\n }) =>\n P2pAdvertUpdateResponse.updateAdvert(\n P2pAdvertUpdateRequest(\n id: p2pAdvertInfo?.id,\n delete: delete ?? false,\n isActive: isActive ?? p2pAdvertInfo?.isActive,\n ),\n );\n\n /// Updates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// [delete] to permanently delete the advert\n /// [isActive] to activate or deactivate the advert\n /// Throws a [BaseAPIException] if API response contains an error\n Future updateRaw({\n bool? delete,\n bool? isActive,\n }) =>\n P2pAdvertUpdateResponse.updateAdvertRaw(\n P2pAdvertUpdateRequest(\n id: p2pAdvertInfo?.id,\n delete: delete ?? false,\n isActive: isActive ?? p2pAdvertInfo?.isActive,\n ),\n );\n\n /// Deletes permanently a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future delete() => update(delete: true);\n\n /// Deletes permanently a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future deleteRaw() => updateRaw(delete: true);\n\n /// Activates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future activate() async => update(isActive: true);\n\n /// Activates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future activateRaw() async =>\n updateRaw(isActive: true);\n\n /// Deactivates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future deactivate() async => update(isActive: false);\n\n /// Deactivates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future deactivateRaw() async =>\n updateRaw(isActive: false);\n\n /// Creates order on this advert.\n ///\n /// [amount] is the amount of currency to be bought or sold.\n /// [contactInfo] is seller contact information. Only applicable for [OrderType.sell].\n /// [paymentInfo] is payment instructions. Only applicable for [OrderType.sell].\n /// Throws [BaseAPIException] if API response contains an error.\n Future createOrder({\n required double amount,\n String? contactInfo,\n String? paymentInfo,\n }) =>\n P2pOrderCreateResponse.create(\n P2pOrderCreateRequest(\n advertId: p2pAdvertInfo?.id,\n amount: amount,\n contactInfo: contactInfo,\n paymentInfo: paymentInfo,\n paymentMethodIds: const [],\n ),\n );\n\n /// Creates order on this advert.\n ///\n /// [amount] is the amount of currency to be bought or sold.\n /// [contactInfo] is seller contact information. Only applicable for [OrderType.sell].\n /// [paymentInfo] is payment instructions. Only applicable for [OrderType.sell].\n /// Throws [BaseAPIException] if API response contains an error.\n Future createOrderRaw({\n required double amount,\n String? contactInfo,\n String? paymentInfo,\n }) =>\n P2pOrderCreateResponse.createRaw(\n P2pOrderCreateRequest(\n advertId: p2pAdvertInfo?.id,\n amount: amount,\n contactInfo: contactInfo,\n paymentInfo: paymentInfo,\n paymentMethodIds: const [],\n ),\n );", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_payment_methods_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_payment_methods_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/response/p2p_advert_update_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/p2p_order_create_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advert_info_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advert_info_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advert_update_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advert_update_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_create_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_create_send.dart';" } diff --git a/lib/basic_api/generated/methods/p2p_advert_list_receive_methods.json b/lib/basic_api/generated/methods/p2p_advert_list_receive_methods.json index 70657825fe..daebd9dca1 100644 --- a/lib/basic_api/generated/methods/p2p_advert_list_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advert_list_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Returns available adverts.\n ///\n /// For parameters information refer to [P2pAdvertListRequest].\n /// Throws a [P2PAdvertException] if API response contains an error\n static Future fetchAdvertList(\n P2pAdvertListRequest request,\n ) async {\n final P2pAdvertListReceive response = await fetchAdvertListRaw(request);\n\n return P2pAdvertListResponse.fromJson(response.p2pAdvertList);\n }\n\n /// Returns available adverts.\n ///\n /// For parameters information refer to [P2pAdvertListRequest].\n /// Throws a [P2PAdvertException] if API response contains an error\n static Future fetchAdvertListRaw(\n P2pAdvertListRequest request,\n ) async {\n final P2pAdvertListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n P2PAdvertException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Returns available adverts.\n ///\n /// For parameters information refer to [P2pAdvertListRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchAdvertList(\n P2pAdvertListRequest request,\n ) async {\n final P2pAdvertListReceive response = await fetchAdvertListRaw(request);\n\n return P2pAdvertListResponse.fromJson(response.p2pAdvertList);\n }\n\n /// Returns available adverts.\n ///\n /// For parameters information refer to [P2pAdvertListRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchAdvertListRaw(\n P2pAdvertListRequest request,\n ) async {\n final P2pAdvertListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/p2p_advert_exception.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_advert_update_receive_methods.json b/lib/basic_api/generated/methods/p2p_advert_update_receive_methods.json index c1e214b6fe..f376f3a98b 100644 --- a/lib/basic_api/generated/methods/p2p_advert_update_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advert_update_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Updates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// For parameters information refer to [P2pAdvertUpdateRequest].\n /// Throws a [P2PAdvertException] if API response contains an error\n static Future updateAdvert(\n P2pAdvertUpdateRequest request,\n ) async {\n final P2pAdvertUpdateReceive response = await updateAdvertRaw(request);\n\n return P2pAdvertUpdateResponse.fromJson(response.p2pAdvertUpdate);\n }\n\n /// Updates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// For parameters information refer to [P2pAdvertUpdateRequest].\n /// Throws a [P2PAdvertException] if API response contains an error\n static Future updateAdvertRaw(\n P2pAdvertUpdateRequest request,\n ) async {\n final P2pAdvertUpdateReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n P2PAdvertException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Updates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// For parameters information refer to [P2pAdvertUpdateRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future updateAdvert(\n P2pAdvertUpdateRequest request,\n ) async {\n final P2pAdvertUpdateReceive response = await updateAdvertRaw(request);\n\n return P2pAdvertUpdateResponse.fromJson(response.p2pAdvertUpdate);\n }\n\n /// Updates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// For parameters information refer to [P2pAdvertUpdateRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future updateAdvertRaw(\n P2pAdvertUpdateRequest request,\n ) async {\n final P2pAdvertUpdateReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advert_update_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advert_update_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_advertiser_adverts_receive_methods.json b/lib/basic_api/generated/methods/p2p_advertiser_adverts_receive_methods.json index a333189fff..e0c60aff10 100644 --- a/lib/basic_api/generated/methods/p2p_advertiser_adverts_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advertiser_adverts_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Returns all P2P (peer to peer) adverts created by the authorized client.\n /// Can only be used by a registered P2P advertiser.\n /// For parameters information refer to [P2pAdvertiserAdvertsRequest].\n static Future fetchAdvertiserAdverts(\n P2pAdvertiserAdvertsRequest request,\n ) async {\n final P2pAdvertiserAdvertsReceive response =\n await fetchAdvertiserAdvertsRaw(request);\n\n return P2pAdvertiserAdvertsResponse.fromJson(response.p2pAdvertiserAdverts);\n }\n\n /// Returns all P2P (peer to peer) adverts created by the authorized client.\n /// Can only be used by a registered P2P advertiser.\n /// For parameters information refer to [P2pAdvertiserAdvertsRequest].\n static Future fetchAdvertiserAdvertsRaw(\n P2pAdvertiserAdvertsRequest request,\n ) async {\n final P2pAdvertiserAdvertsReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n P2PAdvertiserException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Returns all P2P (peer to peer) adverts created by the authorized client.\n /// Can only be used by a registered P2P advertiser.\n /// For parameters information refer to [P2pAdvertiserAdvertsRequest].\n static Future fetchAdvertiserAdverts(\n P2pAdvertiserAdvertsRequest request,\n ) async {\n final P2pAdvertiserAdvertsReceive response =\n await fetchAdvertiserAdvertsRaw(request);\n\n return P2pAdvertiserAdvertsResponse.fromJson(response.p2pAdvertiserAdverts);\n }\n\n /// Returns all P2P (peer to peer) adverts created by the authorized client.\n /// Can only be used by a registered P2P advertiser.\n /// For parameters information refer to [P2pAdvertiserAdvertsRequest].\n static Future fetchAdvertiserAdvertsRaw(\n P2pAdvertiserAdvertsRequest request,\n ) async {\n final P2pAdvertiserAdvertsReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_adverts_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_adverts_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_advertiser_create_receive_methods.json b/lib/basic_api/generated/methods/p2p_advertiser_create_receive_methods.json index 08ca259654..253fe61c3f 100644 --- a/lib/basic_api/generated/methods/p2p_advertiser_create_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advertiser_create_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Registers the client as a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserCreateRequest]. \n static Future createAdvertiser( \n P2pAdvertiserCreateRequest request, \n ) async { \n final P2pAdvertiserCreateReceive response = \n await createAdvertiserRaw(request); \n \n return P2pAdvertiserCreateResponse.fromJson( \n response.p2pAdvertiserCreate, response.subscription); \n } \n \n /// Registers the client as a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserCreateRequest]. \n static Future createAdvertiserRaw( \n P2pAdvertiserCreateRequest request, \n ) async { \n final P2pAdvertiserCreateReceive response = await _api.call( \n request: request.copyWith(subscribe: false), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2PAdvertiserException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Registers the client as a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserCreateRequest]. \n static Stream createAdvertiserAndSubscribe( \n P2pAdvertiserCreateRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n createAdvertiserAndSubscribeRaw( \n request, \n comparePredicate: comparePredicate, \n ).map( \n (P2pAdvertiserCreateReceive? response) => response == null \n ? null \n : P2pAdvertiserCreateResponse.fromJson( \n response.p2pAdvertiserCreate, \n response.subscription, \n ), \n ); \n \n /// Registers the client as a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserCreateRequest]. \n static Stream createAdvertiserAndSubscribeRaw( \n P2pAdvertiserCreateRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n _api \n .subscribe(request: request, comparePredicate: comparePredicate)! \n .map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2PAdvertiserException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is P2pAdvertiserCreateReceive ? response : null; \n }, \n );", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Registers the client as a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserCreateRequest]. \n static Future createAdvertiser( \n P2pAdvertiserCreateRequest request, \n ) async { \n final P2pAdvertiserCreateReceive response = \n await createAdvertiserRaw(request); \n \n return P2pAdvertiserCreateResponse.fromJson( \n response.p2pAdvertiserCreate, response.subscription); \n } \n \n /// Registers the client as a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserCreateRequest]. \n static Future createAdvertiserRaw( \n P2pAdvertiserCreateRequest request, \n ) async { \n final P2pAdvertiserCreateReceive response = await _api.call( \n request: request.copyWith(subscribe: false), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Registers the client as a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserCreateRequest]. \n static Stream createAdvertiserAndSubscribe( \n P2pAdvertiserCreateRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n createAdvertiserAndSubscribeRaw( \n request, \n comparePredicate: comparePredicate, \n ).map( \n (P2pAdvertiserCreateReceive? response) => response == null \n ? null \n : P2pAdvertiserCreateResponse.fromJson( \n response.p2pAdvertiserCreate, \n response.subscription, \n ), \n ); \n \n /// Registers the client as a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserCreateRequest]. \n static Stream createAdvertiserAndSubscribeRaw( \n P2pAdvertiserCreateRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n _api \n .subscribe(request: request, comparePredicate: comparePredicate)! \n .map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is P2pAdvertiserCreateReceive ? response : null; \n }, \n );", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_create_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_create_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_advertiser_info_receive_methods.json b/lib/basic_api/generated/methods/p2p_advertiser_info_receive_methods.json index 80dc0a9c03..ebff4791a0 100644 --- a/lib/basic_api/generated/methods/p2p_advertiser_info_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advertiser_info_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Retrieves information about a P2P (peer to peer) advertiser. \n /// \n /// For parameters information refer to [P2pAdvertiserInfoRequest]. \n /// Throws a [P2PAdvertiserException] if API response contains an error. \n static Future fetchAdvertiserInformation( \n P2pAdvertiserInfoRequest request, \n ) async { \n final P2pAdvertiserInfoReceive response = \n await fetchAdvertiserInformationRaw(request); \n \n return P2pAdvertiserInfoResponse.fromJson( \n response.p2pAdvertiserInfo, response.subscription); \n } \n \n /// Retrieves information about a P2P (peer to peer) advertiser. \n /// \n /// For parameters information refer to [P2pAdvertiserInfoRequest]. \n /// Throws a [P2PAdvertiserException] if API response contains an error. \n static Future fetchAdvertiserInformationRaw( \n P2pAdvertiserInfoRequest request, \n ) async { \n final P2pAdvertiserInfoReceive response = await _api.call( \n request: request.copyWith(subscribe: false), \n ); \n \n return response; \n } \n \n /// Subscribes to information about a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserInfoRequest]. \n static Stream subscribeAdvertiserInformation( \n P2pAdvertiserInfoRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeAdvertiserInformationRaw( \n request, \n comparePredicate: comparePredicate, \n ).map( \n (P2pAdvertiserInfoReceive? response) => response == null \n ? null \n : P2pAdvertiserInfoResponse.fromJson( \n response.p2pAdvertiserInfo, \n response.subscription, \n ), \n ); \n \n /// Subscribes to information about a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserInfoRequest]. \n static Stream subscribeAdvertiserInformationRaw( \n P2pAdvertiserInfoRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n _api \n .subscribe(request: request, comparePredicate: comparePredicate)! \n .map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2PAdvertiserException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is P2pAdvertiserInfoReceive ? response : null; \n }, \n ); \n \n /// Unsubscribes from P2P (peer to peer) advertiser information. \n /// \n /// Throws a [P2PAdvertiserException] if API response contains an error. \n Future unsubscribeAdvertiser() async { \n if (subscription == null) { \n return null; \n } \n \n final ForgetReceive response = \n await _api.unsubscribe(subscriptionId: subscription!.id); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2PAdvertiserException(baseExceptionModel: baseExceptionModel), \n ); \n \n return ForgetResponse.fromJson(response.forget); \n } \n \n /// Unsubscribes all P2P (peer to peer) advertisers. \n /// \n /// Throws a [P2PAdvertiserException] if API response contains an error. \n static Future unsubscribeAllAdvertiser() async { \n final ForgetAllReceive response = \n await _api.unsubscribeAll(method: ForgetStreamType.p2pAdvertiser); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2PAdvertiserException(baseExceptionModel: baseExceptionModel), \n ); \n \n return ForgetAllResponse.fromJson(response.forgetAll); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Retrieves information about a P2P (peer to peer) advertiser. \n /// \n /// For parameters information refer to [P2pAdvertiserInfoRequest]. \n /// Throws a [BaseAPIException] if API response contains an error. \n static Future fetchAdvertiserInformation( \n P2pAdvertiserInfoRequest request, \n ) async { \n final P2pAdvertiserInfoReceive response = \n await fetchAdvertiserInformationRaw(request); \n \n return P2pAdvertiserInfoResponse.fromJson( \n response.p2pAdvertiserInfo, response.subscription); \n } \n \n /// Retrieves information about a P2P (peer to peer) advertiser. \n /// \n /// For parameters information refer to [P2pAdvertiserInfoRequest]. \n /// Throws a [BaseAPIException] if API response contains an error. \n static Future fetchAdvertiserInformationRaw( \n P2pAdvertiserInfoRequest request, \n ) async { \n final P2pAdvertiserInfoReceive response = await _api.call( \n request: request.copyWith(subscribe: false), \n ); \n \n return response; \n } \n \n /// Subscribes to information about a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserInfoRequest]. \n static Stream subscribeAdvertiserInformation( \n P2pAdvertiserInfoRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeAdvertiserInformationRaw( \n request, \n comparePredicate: comparePredicate, \n ).map( \n (P2pAdvertiserInfoReceive? response) => response == null \n ? null \n : P2pAdvertiserInfoResponse.fromJson( \n response.p2pAdvertiserInfo, \n response.subscription, \n ), \n ); \n \n /// Subscribes to information about a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserInfoRequest]. \n static Stream subscribeAdvertiserInformationRaw( \n P2pAdvertiserInfoRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n _api \n .subscribe(request: request, comparePredicate: comparePredicate)! \n .map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is P2pAdvertiserInfoReceive ? response : null; \n }, \n ); \n \n /// Unsubscribes from P2P (peer to peer) advertiser information. \n /// \n /// Throws a [BaseAPIException] if API response contains an error. \n Future unsubscribeAdvertiser() async { \n if (subscription == null) { \n return null; \n } \n \n final ForgetReceive response = \n await _api.unsubscribe(subscriptionId: subscription!.id); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return ForgetResponse.fromJson(response.forget); \n } \n \n /// Unsubscribes all P2P (peer to peer) advertisers. \n /// \n /// Throws a [BaseAPIException] if API response contains an error. \n static Future unsubscribeAllAdvertiser() async { \n final ForgetAllReceive response = \n await _api.unsubscribeAll(method: ForgetStreamType.p2pAdvertiser); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return ForgetAllResponse.fromJson(response.forgetAll); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_info_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_info_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_advertiser_list_receive_methods.json b/lib/basic_api/generated/methods/p2p_advertiser_list_receive_methods.json index 631dd05928..be58dbd598 100644 --- a/lib/basic_api/generated/methods/p2p_advertiser_list_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advertiser_list_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Returns P2P advertiser list. \n /// \n /// For parameters information refer to [P2pAdvertiserListRequest]. \n static Future fetchAdvertiserListRaw( \n P2pAdvertiserListRequest request, \n ) async { \n final P2pAdvertiserListReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2PAdvertiserException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Returns P2P advertiser list. \n /// \n /// For parameters information refer to [P2pAdvertiserListRequest]. \n static Future fetchAdvertiserList( \n P2pAdvertiserListRequest request, \n ) async { \n final P2pAdvertiserListReceive response = \n await fetchAdvertiserListRaw(request); \n \n return P2pAdvertiserListResponse.fromJson(response.p2pAdvertiserList); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Returns P2P advertiser list. \n /// \n /// For parameters information refer to [P2pAdvertiserListRequest]. \n static Future fetchAdvertiserListRaw( \n P2pAdvertiserListRequest request, \n ) async { \n final P2pAdvertiserListReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Returns P2P advertiser list. \n /// \n /// For parameters information refer to [P2pAdvertiserListRequest]. \n static Future fetchAdvertiserList( \n P2pAdvertiserListRequest request, \n ) async { \n final P2pAdvertiserListReceive response = \n await fetchAdvertiserListRaw(request); \n \n return P2pAdvertiserListResponse.fromJson(response.p2pAdvertiserList); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; \nimport 'package:flutter_deriv_api/basic_api/generated/api.dart'; \nimport 'package:flutter_deriv_api/helpers/helpers.dart'; \nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; \nimport 'package:deriv_dependency_injector/dependency_injector.dart';" } diff --git a/lib/basic_api/generated/methods/p2p_advertiser_payment_methods_receive_methods.json b/lib/basic_api/generated/methods/p2p_advertiser_payment_methods_receive_methods.json index 416f5ef7bc..3b177ab7ff 100644 --- a/lib/basic_api/generated/methods/p2p_advertiser_payment_methods_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advertiser_payment_methods_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Manage or list P2P advertiser payment methods. \n /// \n /// For parameters information refer to [P2pAdvertiserPaymentMethodsRequest]. \n /// Throws an [P2PAdvertiserException] if API response contains an error. \n static Future fetchMethodsRaw( \n P2pAdvertiserPaymentMethodsRequest request, \n ) async { \n final P2pAdvertiserPaymentMethodsReceive response = \n await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2PAdvertiserException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Manage or list P2P advertiser payment methods. \n /// \n /// For parameters information refer to [P2pAdvertiserPaymentMethodsRequest]. \n /// Throws an [P2PAdvertiserException] if API response contains an error. \n static Future fetchMethods( \n P2pAdvertiserPaymentMethodsRequest request, \n ) async { \n final P2pAdvertiserPaymentMethodsReceive response = \n await fetchMethodsRaw(request); \n \n return P2pAdvertiserPaymentMethodsResponse.fromJson( \n response.p2pAdvertiserPaymentMethods, \n ); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Manage or list P2P advertiser payment methods. \n /// \n /// For parameters information refer to [P2pAdvertiserPaymentMethodsRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchMethodsRaw( \n P2pAdvertiserPaymentMethodsRequest request, \n ) async { \n final P2pAdvertiserPaymentMethodsReceive response = \n await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Manage or list P2P advertiser payment methods. \n /// \n /// For parameters information refer to [P2pAdvertiserPaymentMethodsRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchMethods( \n P2pAdvertiserPaymentMethodsRequest request, \n ) async { \n final P2pAdvertiserPaymentMethodsReceive response = \n await fetchMethodsRaw(request); \n \n return P2pAdvertiserPaymentMethodsResponse.fromJson( \n response.p2pAdvertiserPaymentMethods, \n ); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; \nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart'; \nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_payment_methods_receive.dart'; \nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_payment_methods_send.dart'; \nimport 'package:flutter_deriv_api/helpers/helpers.dart'; \nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; \nimport 'package:deriv_dependency_injector/dependency_injector.dart';" } diff --git a/lib/basic_api/generated/methods/p2p_advertiser_relations_receive_methods.json b/lib/basic_api/generated/methods/p2p_advertiser_relations_receive_methods.json index 787fff5736..e6c65c6f75 100644 --- a/lib/basic_api/generated/methods/p2p_advertiser_relations_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advertiser_relations_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Updates and returns favourite and blocked advertisers of the current user. \n /// \n /// For parameters information refer to [P2pAdvertiserRelationsRequest]. \n /// Throws an [P2PAdvertiserException] if API response contains an error. \n static Future fetchRaw( \n P2pAdvertiserRelationsRequest request, \n ) async { \n final P2pAdvertiserRelationsReceive response = \n await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2PAdvertiserException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Updates and returns favourite and blocked advertisers of the current user. \n /// \n /// For parameters information refer to [P2pAdvertiserRelationsRequest]. \n /// Throws an [P2PAdvertiserException] if API response contains an error. \n static Future fetch( \n P2pAdvertiserRelationsRequest request, \n ) async { \n final P2pAdvertiserRelationsReceive response = await fetchRaw(request); \n \n return P2pAdvertiserRelationsResponse.fromJson( \n response.p2pAdvertiserRelations); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Updates and returns favourite and blocked advertisers of the current user. \n /// \n /// For parameters information refer to [P2pAdvertiserRelationsRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchRaw( \n P2pAdvertiserRelationsRequest request, \n ) async { \n final P2pAdvertiserRelationsReceive response = \n await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Updates and returns favourite and blocked advertisers of the current user. \n /// \n /// For parameters information refer to [P2pAdvertiserRelationsRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetch( \n P2pAdvertiserRelationsRequest request, \n ) async { \n final P2pAdvertiserRelationsReceive response = await fetchRaw(request); \n \n return P2pAdvertiserRelationsResponse.fromJson( \n response.p2pAdvertiserRelations); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_relations_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_relations_send.dart';\n\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_advertiser_update_receive_methods.json b/lib/basic_api/generated/methods/p2p_advertiser_update_receive_methods.json index 98f52e3fba..02c3216d1a 100644 --- a/lib/basic_api/generated/methods/p2p_advertiser_update_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advertiser_update_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Updates the information of the P2P (peer to peer) advertiser for the current account.\n /// Can only be used by an approved P2P advertiser.\n /// For parameters information refer to [P2pAdvertiserUpdateRequest].\n static Future updateAdvertiser(\n P2pAdvertiserUpdateRequest request,\n ) async {\n final P2pAdvertiserUpdateReceive response =\n await updateAdvertiserRaw(request);\n\n return P2pAdvertiserUpdateResponse.fromJson(response.p2pAdvertiserUpdate);\n }\n\n /// Updates the information of the P2P (peer to peer) advertiser for the current account.\n /// Can only be used by an approved P2P advertiser.\n /// For parameters information refer to [P2pAdvertiserUpdateRequest].\n static Future updateAdvertiserRaw(\n P2pAdvertiserUpdateRequest request,\n ) async {\n final P2pAdvertiserUpdateReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n P2PAdvertiserException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Updates the information of the P2P (peer to peer) advertiser for the current account.\n /// Can only be used by an approved P2P advertiser.\n /// For parameters information refer to [P2pAdvertiserUpdateRequest].\n static Future updateAdvertiser(\n P2pAdvertiserUpdateRequest request,\n ) async {\n final P2pAdvertiserUpdateReceive response =\n await updateAdvertiserRaw(request);\n\n return P2pAdvertiserUpdateResponse.fromJson(response.p2pAdvertiserUpdate);\n }\n\n /// Updates the information of the P2P (peer to peer) advertiser for the current account.\n /// Can only be used by an approved P2P advertiser.\n /// For parameters information refer to [P2pAdvertiserUpdateRequest].\n static Future updateAdvertiserRaw(\n P2pAdvertiserUpdateRequest request,\n ) async {\n final P2pAdvertiserUpdateReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_update_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_update_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_chat_create_receive_methods.json b/lib/basic_api/generated/methods/p2p_chat_create_receive_methods.json index 017b23a569..8292489322 100644 --- a/lib/basic_api/generated/methods/p2p_chat_create_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_chat_create_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Creates a P2P (peer to peer) chat for the specified order.\n ///\n /// For parameters information refer to [P2pChatCreateRequest].\n /// Throws a [P2PException] if API response contains an error\n static Future createChat(\n P2pChatCreateRequest request,\n ) async {\n final P2pChatCreateReceive response = await createChatRaw(request);\n\n return P2pChatCreateResponse.fromJson(response.p2pChatCreate);\n }\n\n /// Creates a P2P (peer to peer) chat for the specified order.\n ///\n /// For parameters information refer to [P2pChatCreateRequest].\n /// Throws a [P2PException] if API response contains an error\n static Future createChatRaw(\n P2pChatCreateRequest request,\n ) async {\n final P2pChatCreateReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n P2PChatException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Creates a P2P (peer to peer) chat for the specified order.\n ///\n /// For parameters information refer to [P2pChatCreateRequest].\n /// Throws a [P2PException] if API response contains an error\n static Future createChat(\n P2pChatCreateRequest request,\n ) async {\n final P2pChatCreateReceive response = await createChatRaw(request);\n\n return P2pChatCreateResponse.fromJson(response.p2pChatCreate);\n }\n\n /// Creates a P2P (peer to peer) chat for the specified order.\n ///\n /// For parameters information refer to [P2pChatCreateRequest].\n /// Throws a [P2PException] if API response contains an error\n static Future createChatRaw(\n P2pChatCreateRequest request,\n ) async {\n final P2pChatCreateReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_chat_create_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_chat_create_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_order_cancel_receive_methods.json b/lib/basic_api/generated/methods/p2p_order_cancel_receive_methods.json index e7ee333345..1d84f329e0 100644 --- a/lib/basic_api/generated/methods/p2p_order_cancel_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_order_cancel_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Cancel a P2P order. \n /// \n /// For parameters information refer to [P2pOrderCancelRequest]. \n /// Throws a [P2POrderException] if API response contains an error. \n static Future cancelOrderRaw( \n P2pOrderCancelRequest request, \n ) async { \n final P2pOrderCancelReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Cancel a P2P order. \n /// \n /// For parameters information refer to [P2pOrderCancelRequest]. \n /// Throws a [P2POrderException] if API response contains an error. \n static Future cancelOrder( \n P2pOrderCancelRequest request, \n ) async { \n final P2pOrderCancelReceive response = await cancelOrderRaw(request); \n \n return P2pOrderCancelResponse.fromJson(response.p2pOrderCancel); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Cancel a P2P order. \n /// \n /// For parameters information refer to [P2pOrderCancelRequest]. \n /// Throws a [BaseAPIException] if API response contains an error. \n static Future cancelOrderRaw( \n P2pOrderCancelRequest request, \n ) async { \n final P2pOrderCancelReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Cancel a P2P order. \n /// \n /// For parameters information refer to [P2pOrderCancelRequest]. \n /// Throws a [BaseAPIException] if API response contains an error. \n static Future cancelOrder( \n P2pOrderCancelRequest request, \n ) async { \n final P2pOrderCancelReceive response = await cancelOrderRaw(request); \n \n return P2pOrderCancelResponse.fromJson(response.p2pOrderCancel); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_cancel_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_cancel_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_order_confirm_receive_methods.json b/lib/basic_api/generated/methods/p2p_order_confirm_receive_methods.json index 32c7af8324..693e3a02a6 100644 --- a/lib/basic_api/generated/methods/p2p_order_confirm_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_order_confirm_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Cancel a P2P order confirm. \n /// \n /// For parameters information refer to [P2pOrderConfirmRequest]. \n /// Throws an [P2POrderException] if API response contains an error. \n static Future confirmOrderRaw( \n P2pOrderConfirmRequest request, \n ) async { \n final P2pOrderConfirmReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Cancel a P2P order confirm. \n /// \n /// For parameters information refer to [P2pOrderConfirmRequest]. \n /// Throws an [P2POrderException] if API response contains an error. \n static Future confirmOrder( \n P2pOrderConfirmRequest request, \n ) async { \n final P2pOrderConfirmReceive response = await confirmOrderRaw(request); \n \n return P2pOrderConfirmResponse.fromJson(response.p2pOrderConfirm); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Cancel a P2P order confirm. \n /// \n /// For parameters information refer to [P2pOrderConfirmRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future confirmOrderRaw( \n P2pOrderConfirmRequest request, \n ) async { \n final P2pOrderConfirmReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Cancel a P2P order confirm. \n /// \n /// For parameters information refer to [P2pOrderConfirmRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future confirmOrder( \n P2pOrderConfirmRequest request, \n ) async { \n final P2pOrderConfirmReceive response = await confirmOrderRaw(request); \n \n return P2pOrderConfirmResponse.fromJson(response.p2pOrderConfirm); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_confirm_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_confirm_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_order_create_receive_methods.json b/lib/basic_api/generated/methods/p2p_order_create_receive_methods.json index 77922b9180..6eec513313 100644 --- a/lib/basic_api/generated/methods/p2p_order_create_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_order_create_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Creates order with parameters specified in [P2pOrderCreateRequest] \n static Future create( \n P2pOrderCreateRequest request) async { \n final P2pOrderCreateReceive response = await createRaw(request); \n \n return P2pOrderCreateResponse.fromJson( \n response.p2pOrderCreate, response.subscription); \n } \n \n /// Creates order with parameters specified in [P2pOrderCreateRequest] \n static Future createRaw( \n P2pOrderCreateRequest request) async { \n final P2pOrderCreateReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Creates order and subscribes to the result with parameters specified in [P2pOrderCreateRequest] \n /// \n /// Throws a [P2POrderException] if API response contains an error \n static Stream createAndSubscribe( \n P2pOrderCreateRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n createAndSubscribeRaw( \n request, \n comparePredicate: comparePredicate, \n ).map( \n (P2pOrderCreateReceive? response) => response == null \n ? null \n : P2pOrderCreateResponse.fromJson( \n response.p2pOrderCreate, \n response.subscription, \n ), \n ); \n \n /// Creates order and subscribes to the result with parameters specified in [P2pOrderCreateRequest] \n /// \n /// Throws a [P2POrderException] if API response contains an error \n static Stream createAndSubscribeRaw( \n P2pOrderCreateRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n _api.subscribe(request: request, comparePredicate: comparePredicate)!.map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is P2pOrderCreateReceive ? response : null; \n }, \n );", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Creates order with parameters specified in [P2pOrderCreateRequest] \n static Future create( \n P2pOrderCreateRequest request) async { \n final P2pOrderCreateReceive response = await createRaw(request); \n \n return P2pOrderCreateResponse.fromJson( \n response.p2pOrderCreate, response.subscription); \n } \n \n /// Creates order with parameters specified in [P2pOrderCreateRequest] \n static Future createRaw( \n P2pOrderCreateRequest request) async { \n final P2pOrderCreateReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Creates order and subscribes to the result with parameters specified in [P2pOrderCreateRequest] \n /// \n /// Throws a [BaseAPIException] if API response contains an error \n static Stream createAndSubscribe( \n P2pOrderCreateRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n createAndSubscribeRaw( \n request, \n comparePredicate: comparePredicate, \n ).map( \n (P2pOrderCreateReceive? response) => response == null \n ? null \n : P2pOrderCreateResponse.fromJson( \n response.p2pOrderCreate, \n response.subscription, \n ), \n ); \n \n /// Creates order and subscribes to the result with parameters specified in [P2pOrderCreateRequest] \n /// \n /// Throws a [BaseAPIException] if API response contains an error \n static Stream createAndSubscribeRaw( \n P2pOrderCreateRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n _api.subscribe(request: request, comparePredicate: comparePredicate)!.map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is P2pOrderCreateReceive ? response : null; \n }, \n );", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_create_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_create_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_order_dispute_receive_methods.json b/lib/basic_api/generated/methods/p2p_order_dispute_receive_methods.json index 700b484b7a..7a11ad0cd9 100644 --- a/lib/basic_api/generated/methods/p2p_order_dispute_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_order_dispute_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Cancel a P2P order dispute. \n /// \n /// For parameters information refer to [P2pOrderDisputeRequest]. \n /// Throws an [P2POrderException] if API response contains an error. \n static Future disputeOrderRaw( \n P2pOrderDisputeRequest request, \n ) async { \n final P2pOrderDisputeReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Cancel a P2P order dispute. \n /// \n /// For parameters information refer to [P2pOrderDisputeRequest]. \n /// Throws an [P2POrderException] if API response contains an error. \n static Future disputeOrder( \n P2pOrderDisputeRequest request, \n ) async { \n final P2pOrderDisputeReceive response = await disputeOrderRaw(request); \n \n return P2pOrderDisputeResponse.fromJson(response.p2pOrderDispute); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Cancel a P2P order dispute. \n /// \n /// For parameters information refer to [P2pOrderDisputeRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future disputeOrderRaw( \n P2pOrderDisputeRequest request, \n ) async { \n final P2pOrderDisputeReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Cancel a P2P order dispute. \n /// \n /// For parameters information refer to [P2pOrderDisputeRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future disputeOrder( \n P2pOrderDisputeRequest request, \n ) async { \n final P2pOrderDisputeReceive response = await disputeOrderRaw(request); \n \n return P2pOrderDisputeResponse.fromJson(response.p2pOrderDispute); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_dispute_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_dispute_send.dart';\n\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_order_info_receive_methods.json b/lib/basic_api/generated/methods/p2p_order_info_receive_methods.json index 3f207b231c..0e10499db4 100644 --- a/lib/basic_api/generated/methods/p2p_order_info_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_order_info_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets order with parameters specified in [P2pOrderInfoRequest] \n /// \n /// Throws a [P2POrderException] if API response contains an error \n static Future fetchOrder( \n P2pOrderInfoRequest request) async { \n final P2pOrderInfoReceive response = await fetchOrderRaw(request); \n \n return P2pOrderInfoResponse.fromJson( \n response.p2pOrderInfo, response.subscription); \n } \n \n /// Gets order with parameters specified in [P2pOrderInfoRequest] \n /// \n /// Throws a [P2POrderException] if API response contains an error \n static Future fetchOrderRaw( \n P2pOrderInfoRequest request) async { \n final P2pOrderInfoReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Subscribes to this order \n Stream subscribe({ \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeOrder( \n P2pOrderInfoRequest(id: p2pOrderInfo?.id), \n comparePredicate: comparePredicate, \n ); \n \n /// Subscribes to this order \n Stream subscribeRaw({ \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeOrderRaw( \n P2pOrderInfoRequest(id: p2pOrderInfo?.id), \n comparePredicate: comparePredicate, \n ); \n \n /// Subscribes to order with parameters specified in [P2pOrderInfoRequest] \n /// \n /// Throws a [P2POrderException] if API response contains an error \n static Stream subscribeOrder( \n P2pOrderInfoRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeOrderRaw( \n request, \n comparePredicate: comparePredicate, \n ).map( \n (P2pOrderInfoReceive? response) => response == null \n ? null \n : P2pOrderInfoResponse.fromJson( \n response.p2pOrderInfo, \n response.subscription, \n ), \n ); \n \n /// Subscribes to order with parameters specified in [P2pOrderInfoRequest] \n /// \n /// Throws a [P2POrderException] if API response contains an error \n static Stream subscribeOrderRaw( \n P2pOrderInfoRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n _api \n .subscribe(request: request, comparePredicate: comparePredicate)! \n .map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is P2pOrderInfoReceive ? response : null; \n }, \n ); \n \n /// Unsubscribes from order subscription. \n /// \n /// Throws a [P2POrderException] if API response contains an error \n Future unsubscribeOrder() async { \n if (subscription == null) { \n return null; \n } \n \n final ForgetReceive response = \n await _api.unsubscribe(subscriptionId: subscription!.id); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return ForgetResponse.fromJson(response.forget); \n } \n \n /// Unsubscribes all order subscriptions (Subscriptions to a single order or list). \n /// \n /// Throws a [P2POrderException] if API response contains an error \n static Future unsubscribeAllOrder() async { \n final ForgetAllReceive response = \n await _api.unsubscribeAll(method: ForgetStreamType.p2pOrder); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return ForgetAllResponse.fromJson(response.forgetAll); \n } \n \n /// Cancels this order \n /// \n /// Returns an order with updated status if successful. \n /// Throws a [P2POrderException] if API response contains an error \n Future cancel() async { \n final P2pOrderCancelReceive response = await cancelRaw(); \n return P2pOrderCancelResponse.fromJson(response.p2pOrderCancel); \n } \n \n /// Cancels this order \n /// \n /// Returns an order with updated status if successful. \n /// Throws a [P2POrderException] if API response contains an error \n Future cancelRaw() async { \n final P2pOrderCancelReceive response = \n await _api.call(request: P2pOrderCancelRequest(id: p2pOrderInfo?.id)); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Confirms this order \n /// \n /// Returns an order with updated status if successful. \n /// Throws a [P2POrderException] if API response contains an error \n Future confirm() async { \n final P2pOrderConfirmReceive response = await confirmRaw(); \n \n return P2pOrderConfirmResponse.fromJson(response.p2pOrderConfirm); \n } \n \n /// Confirms this order \n /// \n /// Returns an order with updated status if successful. \n /// Throws a [P2POrderException] if API response contains an error \n Future confirmRaw() async { \n final P2pOrderConfirmReceive response = \n await _api.call(request: P2pOrderConfirmRequest(id: p2pOrderInfo?.id)); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets order with parameters specified in [P2pOrderInfoRequest] \n /// \n /// Throws a [BaseAPIException] if API response contains an error \n static Future fetchOrder( \n P2pOrderInfoRequest request) async { \n final P2pOrderInfoReceive response = await fetchOrderRaw(request); \n \n return P2pOrderInfoResponse.fromJson( \n response.p2pOrderInfo, response.subscription); \n } \n \n /// Gets order with parameters specified in [P2pOrderInfoRequest] \n /// \n /// Throws a [BaseAPIException] if API response contains an error \n static Future fetchOrderRaw( \n P2pOrderInfoRequest request) async { \n final P2pOrderInfoReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Subscribes to this order \n Stream subscribe({ \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeOrder( \n P2pOrderInfoRequest(id: p2pOrderInfo?.id), \n comparePredicate: comparePredicate, \n ); \n \n /// Subscribes to this order \n Stream subscribeRaw({ \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeOrderRaw( \n P2pOrderInfoRequest(id: p2pOrderInfo?.id), \n comparePredicate: comparePredicate, \n ); \n \n /// Subscribes to order with parameters specified in [P2pOrderInfoRequest] \n /// \n /// Throws a [BaseAPIException] if API response contains an error \n static Stream subscribeOrder( \n P2pOrderInfoRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeOrderRaw( \n request, \n comparePredicate: comparePredicate, \n ).map( \n (P2pOrderInfoReceive? response) => response == null \n ? null \n : P2pOrderInfoResponse.fromJson( \n response.p2pOrderInfo, \n response.subscription, \n ), \n ); \n \n /// Subscribes to order with parameters specified in [P2pOrderInfoRequest] \n /// \n /// Throws a [BaseAPIException] if API response contains an error \n static Stream subscribeOrderRaw( \n P2pOrderInfoRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n _api \n .subscribe(request: request, comparePredicate: comparePredicate)! \n .map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is P2pOrderInfoReceive ? response : null; \n }, \n ); \n \n /// Unsubscribes from order subscription. \n /// \n /// Throws a [BaseAPIException] if API response contains an error \n Future unsubscribeOrder() async { \n if (subscription == null) { \n return null; \n } \n \n final ForgetReceive response = \n await _api.unsubscribe(subscriptionId: subscription!.id); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return ForgetResponse.fromJson(response.forget); \n } \n \n /// Unsubscribes all order subscriptions (Subscriptions to a single order or list). \n /// \n /// Throws a [BaseAPIException] if API response contains an error \n static Future unsubscribeAllOrder() async { \n final ForgetAllReceive response = \n await _api.unsubscribeAll(method: ForgetStreamType.p2pOrder); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return ForgetAllResponse.fromJson(response.forgetAll); \n } \n \n /// Cancels this order \n /// \n /// Returns an order with updated status if successful. \n /// Throws a [BaseAPIException] if API response contains an error \n Future cancel() async { \n final P2pOrderCancelReceive response = await cancelRaw(); \n return P2pOrderCancelResponse.fromJson(response.p2pOrderCancel); \n } \n \n /// Cancels this order \n /// \n /// Returns an order with updated status if successful. \n /// Throws a [BaseAPIException] if API response contains an error \n Future cancelRaw() async { \n final P2pOrderCancelReceive response = \n await _api.call(request: P2pOrderCancelRequest(id: p2pOrderInfo?.id)); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Confirms this order \n /// \n /// Returns an order with updated status if successful. \n /// Throws a [BaseAPIException] if API response contains an error \n Future confirm() async { \n final P2pOrderConfirmReceive response = await confirmRaw(); \n \n return P2pOrderConfirmResponse.fromJson(response.p2pOrderConfirm); \n } \n \n /// Confirms this order \n /// \n /// Returns an order with updated status if successful. \n /// Throws a [BaseAPIException] if API response contains an error \n Future confirmRaw() async { \n final P2pOrderConfirmReceive response = \n await _api.call(request: P2pOrderConfirmRequest(id: p2pOrderInfo?.id)); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/p2p_order_cancel_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/p2p_order_confirm_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_cancel_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_cancel_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_confirm_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_confirm_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_info_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_info_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_order_list_receive_methods.json b/lib/basic_api/generated/methods/p2p_order_list_receive_methods.json index f15c62e2ab..72c9bb33f6 100644 --- a/lib/basic_api/generated/methods/p2p_order_list_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_order_list_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets the list of [P2POrder] with parameters specified in [P2pOrderListRequest] \n static Future fetchOrderList([ \n P2pOrderListRequest? request, \n ]) async { \n final P2pOrderListReceive response = \n await fetchOrderListRaw(request ?? const P2pOrderListRequest()); \n \n return P2pOrderListResponse.fromJson( \n response.p2pOrderList, response.subscription); \n } \n \n /// Gets the list of [P2POrder] with parameters specified in [P2pOrderListRequest] \n static Future fetchOrderListRaw([ \n P2pOrderListRequest? request, \n ]) async { \n final P2pOrderListReceive response = await _api.call( \n request: request ?? const P2pOrderListRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Subscribes to the list of [P2POrder] with parameters specified in [P2pOrderListRequest] \n static Stream subscribeOrderList({ \n P2pOrderListRequest? request, \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeOrderListRaw( \n request: request, \n comparePredicate: comparePredicate, \n ).map( \n (P2pOrderListReceive? response) => response == null \n ? null \n : P2pOrderListResponse.fromJson( \n response.p2pOrderList, \n response.subscription, \n ), \n ); \n \n /// Subscribes to the list of [P2POrder] with parameters specified in [P2pOrderListRequest] \n static Stream subscribeOrderListRaw({ \n P2pOrderListRequest? request, \n RequestCompareFunction? comparePredicate, \n }) => \n _api \n .subscribe( \n request: request ?? const P2pOrderListRequest(), \n comparePredicate: comparePredicate, \n )! \n .map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is P2pOrderListReceive ? response : null; \n }, \n ); \n \n /// Unsubscribes from order list subscription. \n /// \n /// Throws a [P2POrderException] if API response contains an error \n Future unsubscribeOrderList() async { \n if (subscription == null) { \n return null; \n } \n \n final ForgetReceive response = \n await _api.unsubscribe(subscriptionId: subscription!.id); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return ForgetResponse.fromJson(response.forget); \n } \n \n /// Unsubscribes from all order subscriptions (Subscriptions to a single order or list). \n /// \n /// Throws a [P2POrderException] if API response contains an error \n static Future unsubscribeAllOrder() => \n P2pOrderInfoResponse.unsubscribeAllOrder();", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets the list of [P2POrder] with parameters specified in [P2pOrderListRequest] \n static Future fetchOrderList([ \n P2pOrderListRequest? request, \n ]) async { \n final P2pOrderListReceive response = \n await fetchOrderListRaw(request ?? const P2pOrderListRequest()); \n \n return P2pOrderListResponse.fromJson( \n response.p2pOrderList, response.subscription); \n } \n \n /// Gets the list of [P2POrder] with parameters specified in [P2pOrderListRequest] \n static Future fetchOrderListRaw([ \n P2pOrderListRequest? request, \n ]) async { \n final P2pOrderListReceive response = await _api.call( \n request: request ?? const P2pOrderListRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Subscribes to the list of [P2POrder] with parameters specified in [P2pOrderListRequest] \n static Stream subscribeOrderList({ \n P2pOrderListRequest? request, \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeOrderListRaw( \n request: request, \n comparePredicate: comparePredicate, \n ).map( \n (P2pOrderListReceive? response) => response == null \n ? null \n : P2pOrderListResponse.fromJson( \n response.p2pOrderList, \n response.subscription, \n ), \n ); \n \n /// Subscribes to the list of [P2POrder] with parameters specified in [P2pOrderListRequest] \n static Stream subscribeOrderListRaw({ \n P2pOrderListRequest? request, \n RequestCompareFunction? comparePredicate, \n }) => \n _api \n .subscribe( \n request: request ?? const P2pOrderListRequest(), \n comparePredicate: comparePredicate, \n )! \n .map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is P2pOrderListReceive ? response : null; \n }, \n ); \n \n /// Unsubscribes from order list subscription. \n /// \n /// Throws a [BaseAPIException] if API response contains an error \n Future unsubscribeOrderList() async { \n if (subscription == null) { \n return null; \n } \n \n final ForgetReceive response = \n await _api.unsubscribe(subscriptionId: subscription!.id); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return ForgetResponse.fromJson(response.forget); \n } \n \n /// Unsubscribes from all order subscriptions (Subscriptions to a single order or list). \n /// \n /// Throws a [BaseAPIException] if API response contains an error \n static Future unsubscribeAllOrder() => \n P2pOrderInfoResponse.unsubscribeAllOrder();", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/p2p_order_info_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_list_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_list_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_order_review_receive_methods.json b/lib/basic_api/generated/methods/p2p_order_review_receive_methods.json index e29c2f7700..b8d4150601 100644 --- a/lib/basic_api/generated/methods/p2p_order_review_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_order_review_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Cancel a P2P order review. \n /// \n /// For parameters information refer to [P2pOrderReviewReceive]. \n /// Throws an [P2POrderException] if API response contains an error. \n static Future reviewOrderRaw( \n P2pOrderReviewRequest request, \n ) async { \n final P2pOrderReviewReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Cancel a P2P order review. \n /// \n /// For parameters information refer to [P2pOrderReviewReceive]. \n /// Throws an [P2POrderException] if API response contains an error. \n static Future reviewOrder( \n P2pOrderReviewRequest request, \n ) async { \n final P2pOrderReviewReceive response = await reviewOrderRaw(request); \n \n return P2pOrderReviewResponse.fromJson(response.p2pOrderReview); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Cancel a P2P order review. \n /// \n /// For parameters information refer to [P2pOrderReviewReceive]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future reviewOrderRaw( \n P2pOrderReviewRequest request, \n ) async { \n final P2pOrderReviewReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Cancel a P2P order review. \n /// \n /// For parameters information refer to [P2pOrderReviewReceive]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future reviewOrder( \n P2pOrderReviewRequest request, \n ) async { \n final P2pOrderReviewReceive response = await reviewOrderRaw(request); \n \n return P2pOrderReviewResponse.fromJson(response.p2pOrderReview); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_review_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_review_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_payment_methods_receive_methods.json b/lib/basic_api/generated/methods/p2p_payment_methods_receive_methods.json index bc1a072bf7..7a8d29a94f 100644 --- a/lib/basic_api/generated/methods/p2p_payment_methods_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_payment_methods_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// List all P2P payment methods.\n static Future fetch(\n P2pPaymentMethodsRequest request,\n ) async {\n final P2pPaymentMethodsReceive response = await fetchRaw(request);\n\n return P2pPaymentMethodsResponse.fromJson(response.p2pPaymentMethods);\n }\n\n /// Dispute a P2P order.\n static Future fetchRaw(\n P2pPaymentMethodsRequest request,\n ) async {\n final P2pPaymentMethodsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n P2POrderException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// List all P2P payment methods.\n static Future fetch(\n P2pPaymentMethodsRequest request,\n ) async {\n final P2pPaymentMethodsReceive response = await fetchRaw(request);\n\n return P2pPaymentMethodsResponse.fromJson(response.p2pPaymentMethods);\n }\n\n /// Dispute a P2P order.\n static Future fetchRaw(\n P2pPaymentMethodsRequest request,\n ) async {\n final P2pPaymentMethodsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_payment_methods_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_payment_methods_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/payment_methods_receive_methods.json b/lib/basic_api/generated/methods/payment_methods_receive_methods.json index 5b2d80943c..4dcfb2e577 100644 --- a/lib/basic_api/generated/methods/payment_methods_receive_methods.json +++ b/lib/basic_api/generated/methods/payment_methods_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Get List of available payment methods for a given country.\n ///\n /// For parameters information refer to [PaymentMethodsRequest].\n /// Throws an [PaymentException] if API response contains an error\n static Future updateApplication(\n PaymentMethodsRequest request) async {\n final PaymentMethodsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n PaymentException(baseExceptionModel: baseExceptionModel),\n );\n\n return PaymentMethodsResponse.fromJson(response.paymentMethods);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Get List of available payment methods for a given country.\n ///\n /// For parameters information refer to [PaymentMethodsRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future updateApplication(\n PaymentMethodsRequest request) async {\n final PaymentMethodsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return PaymentMethodsResponse.fromJson(response.paymentMethods);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/payment_methods_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/payment_methods_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/paymentagent_list_receive_methods.json b/lib/basic_api/generated/methods/paymentagent_list_receive_methods.json index 766ad67d39..f5961026c8 100644 --- a/lib/basic_api/generated/methods/paymentagent_list_receive_methods.json +++ b/lib/basic_api/generated/methods/paymentagent_list_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Returns a list of Payment Agents for a given country for a given currency.\n ///\n /// For parameters information refer to [PaymentagentListRequest].\n /// Throws a [PaymentAgentException] if API response contains an error\n static Future fetch(\n PaymentagentListRequest request,\n ) async {\n final PaymentagentListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n PaymentAgentException(baseExceptionModel: baseExceptionModel),\n );\n\n return PaymentagentListResponse.fromJson(response.paymentagentList);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Returns a list of Payment Agents for a given country for a given currency.\n ///\n /// For parameters information refer to [PaymentagentListRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetch(\n PaymentagentListRequest request,\n ) async {\n final PaymentagentListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return PaymentagentListResponse.fromJson(response.paymentagentList);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/paymentagent_list_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/paymentagent_list_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/paymentagent_transfer_receive_methods.json b/lib/basic_api/generated/methods/paymentagent_transfer_receive_methods.json index 6e06444b27..9dff97eea9 100644 --- a/lib/basic_api/generated/methods/paymentagent_transfer_receive_methods.json +++ b/lib/basic_api/generated/methods/paymentagent_transfer_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": " static final BaseAPI _api = Injector()();\n\n /// Payment Agent Transfer.\n ///\n /// This call is available only to accounts that are approved payment agents.\n /// For parameters information refer to [PaymentagentTransferRequest].\n /// Throws a [PaymentAgentException] if API response contains an error\n static Future transfer(\n PaymentagentTransferRequest request,\n ) async {\n final PaymentagentTransferReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n PaymentAgentException(baseExceptionModel: baseExceptionModel),\n );\n\n return PaymentagentTransferResponse.fromJson(\n response.paymentagentTransfer,\n response.clientToFullName,\n response.clientToLoginid,\n response.transactionId);\n }", + "methods": " static final BaseAPI _api = Injector()();\n\n /// Payment Agent Transfer.\n ///\n /// This call is available only to accounts that are approved payment agents.\n /// For parameters information refer to [PaymentagentTransferRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future transfer(\n PaymentagentTransferRequest request,\n ) async {\n final PaymentagentTransferReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return PaymentagentTransferResponse.fromJson(\n response.paymentagentTransfer,\n response.clientToFullName,\n response.clientToLoginid,\n response.transactionId);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/paymentagent_transfer_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/paymentagent_transfer_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/paymentagent_withdraw_receive_methods.json b/lib/basic_api/generated/methods/paymentagent_withdraw_receive_methods.json index ffd735469a..179aae739a 100644 --- a/lib/basic_api/generated/methods/paymentagent_withdraw_receive_methods.json +++ b/lib/basic_api/generated/methods/paymentagent_withdraw_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Initiates a withdrawal to an approved payment agent.\n ///\n /// For parameters information refer to [PaymentagentWithdrawRequest].\n /// Throws a [PaymentAgentException] if API response contains an error\n static Future withdraw(\n PaymentagentWithdrawRequest request,\n ) async {\n final PaymentagentWithdrawReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n PaymentAgentException(baseExceptionModel: baseExceptionModel),\n );\n\n return PaymentagentWithdrawResponse.fromJson(response.paymentagentWithdraw,\n response.paymentagentName, response.transactionId);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Initiates a withdrawal to an approved payment agent.\n ///\n /// For parameters information refer to [PaymentagentWithdrawRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future withdraw(\n PaymentagentWithdrawRequest request,\n ) async {\n final PaymentagentWithdrawReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return PaymentagentWithdrawResponse.fromJson(response.paymentagentWithdraw,\n response.paymentagentName, response.transactionId);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/paymentagent_withdraw_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/paymentagent_withdraw_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/payout_currencies_receive_methods.json b/lib/basic_api/generated/methods/payout_currencies_receive_methods.json index 62e48234d2..49182aad7f 100644 --- a/lib/basic_api/generated/methods/payout_currencies_receive_methods.json +++ b/lib/basic_api/generated/methods/payout_currencies_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves a list of available option payout currencies.\n ///\n /// If a user is logged in, only the currencies available for the account will be returned.\n /// Throws a [PayoutCurrencyException] if API response contains a error\n static Future fetchPayoutCurrencies([\n PayoutCurrenciesRequest? request,\n ]) async {\n final PayoutCurrenciesReceive response = await _api.call(\n request: request ?? const PayoutCurrenciesRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n PayoutCurrencyException(baseExceptionModel: baseExceptionModel),\n );\n\n return PayoutCurrenciesResponse.fromJson(response.payoutCurrencies);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves a list of available option payout currencies.\n ///\n /// If a user is logged in, only the currencies available for the account will be returned.\n /// Throws a [BaseAPIException] if API response contains a error\n static Future fetchPayoutCurrencies([\n PayoutCurrenciesRequest? request,\n ]) async {\n final PayoutCurrenciesReceive response = await _api.call(\n request: request ?? const PayoutCurrenciesRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return PayoutCurrenciesResponse.fromJson(response.payoutCurrencies);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/payout_currencies_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/payout_currencies_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/ping_receive_methods.json b/lib/basic_api/generated/methods/ping_receive_methods.json index 5d224f797e..eb588e24af 100644 --- a/lib/basic_api/generated/methods/ping_receive_methods.json +++ b/lib/basic_api/generated/methods/ping_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Requests the ping request to the server. \n /// \n /// Mostly used to test the connection or to keep it alive. \n /// Throws a [PingException] if API response contains an error. \n static Future pingMethodRaw([PingRequest? request]) async { \n final PingReceive response = await _api.call( \n request: request ?? const PingRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n PingException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Requests the ping request to the server. \n /// \n /// Mostly used to test the connection or to keep it alive. \n /// Throws a [PingException] if API response contains an error. \n static Future pingMethod([PingRequest? request]) async { \n final PingReceive response = await pingMethodRaw(request); \n \n return PingResponse.fromJson(response.ping); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Requests the ping request to the server. \n /// \n /// Mostly used to test the connection or to keep it alive. \n /// Throws a [BaseAPIException] if API response contains an error. \n static Future pingMethodRaw([PingRequest? request]) async { \n final PingReceive response = await _api.call( \n request: request ?? const PingRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Requests the ping request to the server. \n /// \n /// Mostly used to test the connection or to keep it alive. \n /// Throws a [BaseAPIException] if API response contains an error. \n static Future pingMethod([PingRequest? request]) async { \n final PingReceive response = await pingMethodRaw(request); \n \n return PingResponse.fromJson(response.ping); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/ping_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/ping_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/portfolio_receive_methods.json b/lib/basic_api/generated/methods/portfolio_receive_methods.json index 8dde2b3e3e..a7ad0b98a5 100644 --- a/lib/basic_api/generated/methods/portfolio_receive_methods.json +++ b/lib/basic_api/generated/methods/portfolio_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the portfolio fo logged-in account\n ///\n /// Throws a [PortfolioException] if API response contains an error\n static Future fetchPortfolio(PortfolioRequest request) async {\n final PortfolioReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n PortfolioException(baseExceptionModel: baseExceptionModel),\n );\n\n return PortfolioResponse.fromJson(response.portfolio);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the portfolio fo logged-in account\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchPortfolio(PortfolioRequest request) async {\n final PortfolioReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return PortfolioResponse.fromJson(response.portfolio);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/portfolio_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/portfolio_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/profit_table_receive_methods.json b/lib/basic_api/generated/methods/profit_table_receive_methods.json index d55634ab78..e6272cee20 100644 --- a/lib/basic_api/generated/methods/profit_table_receive_methods.json +++ b/lib/basic_api/generated/methods/profit_table_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves a summary of account Profit Table, according to given search criteria.\n ///\n /// For parameters information refer to [ProfitTableRequest].\n /// Throws a [ProfitTableException] if API response contains an error\n static Future fetch(ProfitTableRequest request) async {\n final ProfitTableReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ProfitTableException(baseExceptionModel: baseExceptionModel),\n );\n\n return ProfitTableResponse.fromJson(response.profitTable);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves a summary of account Profit Table, according to given search criteria.\n ///\n /// For parameters information refer to [ProfitTableRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetch(ProfitTableRequest request) async {\n final ProfitTableReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ProfitTableResponse.fromJson(response.profitTable);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/profit_table_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/profit_table_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';" } diff --git a/lib/basic_api/generated/methods/proposal_open_contract_receive_methods.json b/lib/basic_api/generated/methods/proposal_open_contract_receive_methods.json index 616dccef5b..e1233d9798 100644 --- a/lib/basic_api/generated/methods/proposal_open_contract_receive_methods.json +++ b/lib/basic_api/generated/methods/proposal_open_contract_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the current spot of the the bought contract specified in [ProposalOpenContractRequest]\n ///\n /// Throws a [ContractOperationException] if API response contains any error\n static Future fetchContractState(\n ProposalOpenContractRequest request,\n ) async {\n final ProposalOpenContractReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return ProposalOpenContractResponse.fromJson(\n response.proposalOpenContract, response.subscription);\n }\n\n /// Subscribes to the bought contract state specified in [ProposalOpenContractRequest]\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n static Stream subscribeContractState(\n ProposalOpenContractRequest request, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: request, comparePredicate: comparePredicate)!\n .map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(\n baseExceptionModel: baseExceptionModel),\n );\n\n return response is ProposalOpenContractReceive\n ? ProposalOpenContractResponse.fromJson(\n response.proposalOpenContract,\n response.subscription,\n )\n : null;\n },\n );\n\n /// Unsubscribes from open contract subscription.\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n Future unsubscribeOpenContract() async {\n if (subscription == null) {\n return null;\n }\n\n final ForgetReceive response =\n await _api.unsubscribe(subscriptionId: subscription!.id);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }\n\n /// Unsubscribes all open contract subscriptions.\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n static Future unsubscribeAllOpenContract() async {\n final ForgetAllReceive response = await _api.unsubscribeAll(\n method: ForgetStreamType.proposalOpenContract,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }\n\n /// Sells this contract.\n ///\n /// [price] is the Minimum price at which to sell the contract,\n /// Default be 0 for 'sell at market'.\n /// Throws a [ContractOperationException] if API response contains an error\n static Future sell(\n {required int contractId, double price = 0}) =>\n SellResponse.sellContract(SellRequest(sell: contractId, price: price));\n\n /// Cancels this contract\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n static Future cancel(int contractId) =>\n CancelResponse.cancelContract(CancelRequest(cancel: contractId));\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the current spot of the the bought contract specified in [ProposalOpenContractRequest]\n ///\n /// Throws a [BaseAPIException] if API response contains any error\n static Future fetchContractState(\n ProposalOpenContractRequest request,\n ) async {\n final ProposalOpenContractReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ProposalOpenContractResponse.fromJson(\n response.proposalOpenContract, response.subscription);\n }\n\n /// Subscribes to the bought contract state specified in [ProposalOpenContractRequest]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Stream subscribeContractState(\n ProposalOpenContractRequest request, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: request, comparePredicate: comparePredicate)!\n .map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(\n baseExceptionModel: baseExceptionModel),\n );\n\n return response is ProposalOpenContractReceive\n ? ProposalOpenContractResponse.fromJson(\n response.proposalOpenContract,\n response.subscription,\n )\n : null;\n },\n );\n\n /// Unsubscribes from open contract subscription.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future unsubscribeOpenContract() async {\n if (subscription == null) {\n return null;\n }\n\n final ForgetReceive response =\n await _api.unsubscribe(subscriptionId: subscription!.id);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }\n\n /// Unsubscribes all open contract subscriptions.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future unsubscribeAllOpenContract() async {\n final ForgetAllReceive response = await _api.unsubscribeAll(\n method: ForgetStreamType.proposalOpenContract,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }\n\n /// Sells this contract.\n ///\n /// [price] is the Minimum price at which to sell the contract,\n /// Default be 0 for 'sell at market'.\n /// Throws a [BaseAPIException] if API response contains an error\n static Future sell(\n {required int contractId, double price = 0}) =>\n SellResponse.sellContract(SellRequest(sell: contractId, price: price));\n\n /// Cancels this contract\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future cancel(int contractId) =>\n CancelResponse.cancelContract(CancelRequest(cancel: contractId));\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/cancel_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/sell_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/cancel_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/proposal_open_contract_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/proposal_open_contract_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/sell_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';" } diff --git a/lib/basic_api/generated/methods/proposal_receive_methods.json b/lib/basic_api/generated/methods/proposal_receive_methods.json index d5b8582ec9..1e05eb285e 100644 --- a/lib/basic_api/generated/methods/proposal_receive_methods.json +++ b/lib/basic_api/generated/methods/proposal_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": " static final BaseAPI _api = Injector()();\n\n /// Gets the price proposal for contract\n ///\n /// For parameters information refer to [ProposalRequest]\n /// Throws a [ContractOperationException] if API response contains an error\n static Future fetchPriceForContract(\n ProposalRequest request,\n ) async {\n final ProposalReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return ProposalResponse.fromJson(response.proposal, response.subscription);\n }\n\n /// Gets the price proposal for contract.\n ///\n /// For parameters information refer to [ProposalRequest]\n /// Throws a [ContractOperationException] if API response contains an error\n static Stream subscribePriceForContract(\n ProposalRequest request, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: request, comparePredicate: comparePredicate)!\n .map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(\n baseExceptionModel: baseExceptionModel),\n );\n\n return response is ProposalReceive\n ? ProposalResponse.fromJson(\n response.proposal,\n response.subscription,\n )\n : null;\n },\n );\n\n /// Unsubscribes from price proposal subscription.\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n Future unsubscribeProposal() async {\n if (subscription == null) {\n return null;\n }\n\n final ForgetReceive response =\n await _api.unsubscribe(subscriptionId: subscription!.id);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }\n\n /// Unsubscribes all proposal subscriptions.\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n static Future unsubscribeAllProposal() async {\n final ForgetAllReceive response =\n await _api.unsubscribeAll(method: ForgetStreamType.proposal);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }\n\n /// Buys this proposal contract with [price] specified.\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n Future buy({double? price}) => BuyResponse.buyMethod(BuyRequest(\n buy: proposal?.id,\n price: price ?? proposal?.askPrice,\n ));\n\n /// Buys this proposal contract with [price] specified and subscribes to it.\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n Stream buyAndSubscribe({double? price}) =>\n BuyResponse.buyAndSubscribe(BuyRequest(\n buy: proposal?.id,\n price: price ?? proposal?.askPrice,\n ));", + "methods": " static final BaseAPI _api = Injector()();\n\n /// Gets the price proposal for contract\n ///\n /// For parameters information refer to [ProposalRequest]\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchPriceForContract(\n ProposalRequest request,\n ) async {\n final ProposalReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ProposalResponse.fromJson(response.proposal, response.subscription);\n }\n\n /// Gets the price proposal for contract.\n ///\n /// For parameters information refer to [ProposalRequest]\n /// Throws a [BaseAPIException] if API response contains an error\n static Stream subscribePriceForContract(\n ProposalRequest request, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: request, comparePredicate: comparePredicate)!\n .map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(\n baseExceptionModel: baseExceptionModel),\n );\n\n return response is ProposalReceive\n ? ProposalResponse.fromJson(\n response.proposal,\n response.subscription,\n )\n : null;\n },\n );\n\n /// Unsubscribes from price proposal subscription.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future unsubscribeProposal() async {\n if (subscription == null) {\n return null;\n }\n\n final ForgetReceive response =\n await _api.unsubscribe(subscriptionId: subscription!.id);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }\n\n /// Unsubscribes all proposal subscriptions.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future unsubscribeAllProposal() async {\n final ForgetAllReceive response =\n await _api.unsubscribeAll(method: ForgetStreamType.proposal);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }\n\n /// Buys this proposal contract with [price] specified.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future buy({double? price}) => BuyResponse.buyMethod(BuyRequest(\n buy: proposal?.id,\n price: price ?? proposal?.askPrice,\n ));\n\n /// Buys this proposal contract with [price] specified and subscribes to it.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Stream buyAndSubscribe({double? price}) =>\n BuyResponse.buyAndSubscribe(BuyRequest(\n buy: proposal?.id,\n price: price ?? proposal?.askPrice,\n ));", "imports": "import 'package:flutter_deriv_api/api/exceptions/contract_operations_exception.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/buy_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/proposal_open_contract_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/buy_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/proposal_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/proposal_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/reality_check_receive_methods.json b/lib/basic_api/generated/methods/reality_check_receive_methods.json index 47ca76c459..2ac2eb3828 100644 --- a/lib/basic_api/generated/methods/reality_check_receive_methods.json +++ b/lib/basic_api/generated/methods/reality_check_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves summary of client's trades and account for the reality check facility.\n ///\n /// A `reality check` means a display of time elapsed since the session began, and associated client profit/loss.\n /// The reality check facility is a regulatory requirement for certain landing companies.\n /// For parameters information refer to [RealityCheckRequest].\n /// Throws a [RealityCheckException] if API response contains an error\n static Future check([\n RealityCheckRequest? request,\n ]) async {\n final RealityCheckReceive response = await _api.call(\n request: request ?? const RealityCheckRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n RealityCheckException(baseExceptionModel: baseExceptionModel),\n );\n\n return RealityCheckResponse.fromJson(response.realityCheck);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves summary of client's trades and account for the reality check facility.\n ///\n /// A `reality check` means a display of time elapsed since the session began, and associated client profit/loss.\n /// The reality check facility is a regulatory requirement for certain landing companies.\n /// For parameters information refer to [RealityCheckRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future check([\n RealityCheckRequest? request,\n ]) async {\n final RealityCheckReceive response = await _api.call(\n request: request ?? const RealityCheckRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return RealityCheckResponse.fromJson(response.realityCheck);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/reality_check_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/reality_check_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/reset_password_receive_methods.json b/lib/basic_api/generated/methods/reset_password_receive_methods.json index 590244ce7b..a36e8a1dc9 100644 --- a/lib/basic_api/generated/methods/reset_password_receive_methods.json +++ b/lib/basic_api/generated/methods/reset_password_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Reset the password of User.\n static Future reset(\n ResetPasswordRequest request,\n ) async {\n final ResetPasswordReceive? response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n UserException(baseExceptionModel: baseExceptionModel),\n );\n\n return ResetPasswordResponse.fromJson(response?.resetPassword);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Reset the password of User.\n static Future reset(\n ResetPasswordRequest request,\n ) async {\n final ResetPasswordReceive? response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ResetPasswordResponse.fromJson(response?.resetPassword);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/reset_password_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/reset_password_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/residence_list_receive_methods.json b/lib/basic_api/generated/methods/residence_list_receive_methods.json index 67fae43764..a9a7757c19 100644 --- a/lib/basic_api/generated/methods/residence_list_receive_methods.json +++ b/lib/basic_api/generated/methods/residence_list_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets Residence list for the given [ResidenceListRequest]\n ///\n /// Throws a [ResidenceException] if API response contains an error\n static Future fetchResidenceList([\n ResidenceListRequest? request,\n ]) async {\n final ResidenceListReceive response = await _api.call(\n request: request ?? const ResidenceListRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ResidenceException(baseExceptionModel: baseExceptionModel),\n );\n\n return ResidenceListResponse.fromJson(response.residenceList);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets Residence list for the given [ResidenceListRequest]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchResidenceList([\n ResidenceListRequest? request,\n ]) async {\n final ResidenceListReceive response = await _api.call(\n request: request ?? const ResidenceListRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ResidenceListResponse.fromJson(response.residenceList);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/residence_list_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/residence_list_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/revoke_oauth_app_receive_methods.json b/lib/basic_api/generated/methods/revoke_oauth_app_receive_methods.json index ae92c49d81..4d21132107 100644 --- a/lib/basic_api/generated/methods/revoke_oauth_app_receive_methods.json +++ b/lib/basic_api/generated/methods/revoke_oauth_app_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Revokes access of a particular app.\n ///\n /// For parameters information refer to [RevokeOauthAppRequest].\n /// Throws an [AppException] if API response contains an error\n static Future revokeOauthApplication(\n RevokeOauthAppRequest request,\n ) async {\n final RevokeOauthAppReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AppException(baseExceptionModel: baseExceptionModel),\n );\n\n return RevokeOauthAppResponse.fromJson(response.revokeOauthApp);\n }\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Revokes access of a particular app.\n ///\n /// For parameters information refer to [RevokeOauthAppRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future revokeOauthApplication(\n RevokeOauthAppRequest request,\n ) async {\n final RevokeOauthAppReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return RevokeOauthAppResponse.fromJson(response.revokeOauthApp);\n }\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/revoke_oauth_app_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/revoke_oauth_app_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/sell_receive_methods.json b/lib/basic_api/generated/methods/sell_receive_methods.json index 6438523295..423c605eba 100644 --- a/lib/basic_api/generated/methods/sell_receive_methods.json +++ b/lib/basic_api/generated/methods/sell_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Sells a contract with parameters specified in [SellRequest].\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n static Future sellContract(SellRequest request) async {\n final SellReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return SellResponse.fromJson(response.sell);\n }\n\n /// tries to sell any expired contracts and returns the number of sold contracts as [SellExpiredContractModel].\n ///\n /// Throws [ContractOperationException] if API response contains an error\n static Future sellExpiredContracts([\n SellExpiredRequest? request,\n ]) async {\n final SellExpiredReceive response = await _api.call(\n request: request ?? const SellExpiredRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return SellExpiredResponse.fromJson(response.sellExpired);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Sells a contract with parameters specified in [SellRequest].\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future sellContract(SellRequest request) async {\n final SellReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return SellResponse.fromJson(response.sell);\n }\n\n /// tries to sell any expired contracts and returns the number of sold contracts as [SellExpiredContractModel].\n ///\n /// Throws [BaseAPIException] if API response contains an error\n static Future sellExpiredContracts([\n SellExpiredRequest? request,\n ]) async {\n final SellExpiredReceive response = await _api.call(\n request: request ?? const SellExpiredRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return SellExpiredResponse.fromJson(response.sellExpired);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/response/sell_expired_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/sell_expired_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/sell_expired_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/sell_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/sell_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/service_token_receive_methods.json b/lib/basic_api/generated/methods/service_token_receive_methods.json index 03f5b226c9..21349e906c 100644 --- a/lib/basic_api/generated/methods/service_token_receive_methods.json +++ b/lib/basic_api/generated/methods/service_token_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Service Token. \n /// \n /// Retrieves the authorization token for the specified service. \n /// For parameters information refer to [ServiceTokenRequest]. \n /// Throws a [APITokenException] if API response contains an error. \n static Future getServiceTokenRaw( \n ServiceTokenRequest request, \n ) async { \n final ServiceTokenReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n APITokenException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Service Token. \n /// \n /// Retrieves the authorization token for the specified service. \n /// For parameters information refer to [ServiceTokenRequest]. \n /// Throws a [APITokenException] if API response contains an error. \n static Future getServiceToken( \n ServiceTokenRequest request, \n ) async { \n final ServiceTokenReceive response = await getServiceTokenRaw(request); \n \n return ServiceTokenResponse.fromJson(response.serviceToken); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Service Token. \n /// \n /// Retrieves the authorization token for the specified service. \n /// For parameters information refer to [ServiceTokenRequest]. \n /// Throws a [BaseAPIException] if API response contains an error. \n static Future getServiceTokenRaw( \n ServiceTokenRequest request, \n ) async { \n final ServiceTokenReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Service Token. \n /// \n /// Retrieves the authorization token for the specified service. \n /// For parameters information refer to [ServiceTokenRequest]. \n /// Throws a [BaseAPIException] if API response contains an error. \n static Future getServiceToken( \n ServiceTokenRequest request, \n ) async { \n final ServiceTokenReceive response = await getServiceTokenRaw(request); \n \n return ServiceTokenResponse.fromJson(response.serviceToken); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/api.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/trading_times_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/trading_times_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/set_account_currency_receive_methods.json b/lib/basic_api/generated/methods/set_account_currency_receive_methods.json index ed9b894863..ed8aa437f2 100644 --- a/lib/basic_api/generated/methods/set_account_currency_receive_methods.json +++ b/lib/basic_api/generated/methods/set_account_currency_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Sets the currency of the account, this will be default currency for your account i.e currency for trading, deposit.\n ///\n /// Please note that account currency can only be set once, and then can never be changed.\n /// For parameters information refer to [SetAccountCurrencyRequest].\n /// Throws an [AccountCurrencyException] if API response contains an error\n static Future setCurrency(\n SetAccountCurrencyRequest request,\n ) async {\n final SetAccountCurrencyReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AccountCurrencyException(baseExceptionModel: baseExceptionModel),\n );\n\n return SetAccountCurrencyResponse.fromJson(response.setAccountCurrency);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Sets the currency of the account, this will be default currency for your account i.e currency for trading, deposit.\n ///\n /// Please note that account currency can only be set once, and then can never be changed.\n /// For parameters information refer to [SetAccountCurrencyRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future setCurrency(\n SetAccountCurrencyRequest request,\n ) async {\n final SetAccountCurrencyReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return SetAccountCurrencyResponse.fromJson(response.setAccountCurrency);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_account_currency_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_account_currency_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/set_financial_assessment_receive_methods.json b/lib/basic_api/generated/methods/set_financial_assessment_receive_methods.json index 7cf299c229..a2322207a9 100644 --- a/lib/basic_api/generated/methods/set_financial_assessment_receive_methods.json +++ b/lib/basic_api/generated/methods/set_financial_assessment_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Sets the financial assessment details based on the client's answers to\n /// analyze whether they possess the experience and knowledge to\n /// understand the risks involved with binary options trading.\n ///\n /// For parameters information refer to [SetFinancialAssessmentRequest].\n /// Throws a [FinancialAssessmentException] if API response contains an error\n static Future setAssessment(\n SetFinancialAssessmentRequest request,\n ) async {\n final SetFinancialAssessmentReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n FinancialAssessmentException(baseExceptionModel: baseExceptionModel),\n );\n\n return SetFinancialAssessmentResponse.fromJson(\n response.setFinancialAssessment);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Sets the financial assessment details based on the client's answers to\n /// analyze whether they possess the experience and knowledge to\n /// understand the risks involved with binary options trading.\n ///\n /// For parameters information refer to [SetFinancialAssessmentRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future setAssessment(\n SetFinancialAssessmentRequest request,\n ) async {\n final SetFinancialAssessmentReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return SetFinancialAssessmentResponse.fromJson(\n response.setFinancialAssessment);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_financial_assessment_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_financial_assessment_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/set_self_exclusion_receive_methods.json b/lib/basic_api/generated/methods/set_self_exclusion_receive_methods.json index cf429427d5..ccc56156df 100644 --- a/lib/basic_api/generated/methods/set_self_exclusion_receive_methods.json +++ b/lib/basic_api/generated/methods/set_self_exclusion_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": " static final BaseAPI _api = Injector()();\n\n /// Sets Self-Exclusion (this call should be used in conjunction with [fetchSelfExclusion])\n ///\n /// For parameters information refer to [SetSelfExclusionRequest].\n /// Throws a [SelfExclusionException] if API response contains an error\n static Future setSelfExclusionMethod(\n SetSelfExclusionRequest request) async {\n final SetSelfExclusionReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n SelfExclusionException(baseExceptionModel: baseExceptionModel),\n );\n\n return SetSelfExclusionResponse.fromJson(response.setSelfExclusion);\n }", + "methods": " static final BaseAPI _api = Injector()();\n\n /// Sets Self-Exclusion (this call should be used in conjunction with [fetchSelfExclusion])\n ///\n /// For parameters information refer to [SetSelfExclusionRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future setSelfExclusionMethod(\n SetSelfExclusionRequest request) async {\n final SetSelfExclusionReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return SetSelfExclusionResponse.fromJson(response.setSelfExclusion);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_self_exclusion_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_self_exclusion_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/set_settings_receive_methods.json b/lib/basic_api/generated/methods/set_settings_receive_methods.json index c59b92b786..d02366eda3 100644 --- a/lib/basic_api/generated/methods/set_settings_receive_methods.json +++ b/lib/basic_api/generated/methods/set_settings_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": " static final BaseAPI _api = Injector()();\n\n /// Changes the user's settings with parameters specified as [SetSettingsRequest]\n ///\n /// Throws an [AccountSettingsException] if API response contains an error\n static Future changeAccountSetting(\n SetSettingsRequest request,\n ) async {\n final SetSettingsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AccountSettingsException(baseExceptionModel: baseExceptionModel),\n );\n\n return SetSettingsResponse(setSettings: response.setSettings ?? 0);\n }", + "methods": " static final BaseAPI _api = Injector()();\n\n /// Changes the user's settings with parameters specified as [SetSettingsRequest]\n ///\n /// Throws an [BaseAPIException] if API response contains an error\n static Future changeAccountSetting(\n SetSettingsRequest request,\n ) async {\n final SetSettingsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return SetSettingsResponse(setSettings: response.setSettings ?? 0);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_settings_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_settings_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/statement_receive_methods.json b/lib/basic_api/generated/methods/statement_receive_methods.json index 9609d1c7db..0f2d283459 100644 --- a/lib/basic_api/generated/methods/statement_receive_methods.json +++ b/lib/basic_api/generated/methods/statement_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves a summary of account transactions, according to given search criteria.\n ///\n /// For parameters information refer to [StatementRequest].\n /// Throws a [StatementException] if API response contains an error\n static Future fetch(StatementRequest request) async {\n final StatementReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n StatementException(baseExceptionModel: baseExceptionModel),\n );\n\n return StatementResponse.fromJson(response.statement);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves a summary of account transactions, according to given search criteria.\n ///\n /// For parameters information refer to [StatementRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetch(StatementRequest request) async {\n final StatementReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return StatementResponse.fromJson(response.statement);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/statement_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/statement_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/states_list_receive_methods.json b/lib/basic_api/generated/methods/states_list_receive_methods.json index 5e6e4eec2c..ed022e9882 100644 --- a/lib/basic_api/generated/methods/states_list_receive_methods.json +++ b/lib/basic_api/generated/methods/states_list_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the list of states for the given [StatesListRequest]\n ///\n /// Throws a [StateException] if API response contains an error\n static Future fetchStatesList(\n StatesListRequest request) async {\n final StatesListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n StateException(baseExceptionModel: baseExceptionModel),\n );\n\n return StatesListResponse.fromJson(response.statesList);\n }\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the list of states for the given [StatesListRequest]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchStatesList(\n StatesListRequest request) async {\n final StatesListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return StatesListResponse.fromJson(response.statesList);\n }\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/states_list_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/states_list_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/ticks_history_receive_methods.json b/lib/basic_api/generated/methods/ticks_history_receive_methods.json index 2152377889..a75cd72a8a 100644 --- a/lib/basic_api/generated/methods/ticks_history_receive_methods.json +++ b/lib/basic_api/generated/methods/ticks_history_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the [TickHistory] for the given [symbol] in [request]\n ///\n /// Throws a [TickException] if API response contains an error\n static Future fetchTickHistory(\n TicksHistoryRequest request,\n ) async {\n final TicksHistoryReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TickException(baseExceptionModel: baseExceptionModel),\n );\n\n return TicksHistoryResponse.fromJson(response.candles, response.history,\n response.pipSize, response.subscription);\n }\n\n /// Gets ticks history and its stream\n ///\n /// Throws [TickException] if API response contains an error\n static Future fetchTicksAndSubscribe(\n TicksHistoryRequest request, {\n RequestCompareFunction? comparePredicate,\n bool subscribe = true,\n }) async {\n if (subscribe) {\n final Stream? responseStream =\n _api.subscribe(request: request, comparePredicate: comparePredicate);\n final Response? firstResponse = await responseStream?.first;\n\n checkException(\n response: firstResponse,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TickException(baseExceptionModel: baseExceptionModel),\n );\n if (firstResponse is TicksHistoryReceive) {\n return TickHistorySubscription(\n tickHistory: TicksHistoryResponse.fromJson(\n firstResponse.candles,\n firstResponse.history,\n firstResponse.pipSize,\n firstResponse.subscription),\n tickStream: responseStream?.map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TickException(baseExceptionModel: baseExceptionModel),\n );\n\n return response is TicksReceive\n ? Tick.fromJson(\n response.tick!,\n subscriptionJson: response.subscription,\n )\n : response is OHLCResponse\n ? OHLC.fromJson(\n response.ohlc!,\n subscriptionJson: response.subscription,\n )\n : null;\n },\n ),\n );\n }\n return null;\n } else {\n return TickHistorySubscription(\n tickHistory: await fetchTickHistory(request),\n );\n }\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the [TickHistory] for the given [symbol] in [request]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchTickHistory(\n TicksHistoryRequest request,\n ) async {\n final TicksHistoryReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TicksHistoryResponse.fromJson(response.candles, response.history,\n response.pipSize, response.subscription);\n }\n\n /// Gets ticks history and its stream\n ///\n /// Throws [BaseAPIException] if API response contains an error\n static Future fetchTicksAndSubscribe(\n TicksHistoryRequest request, {\n RequestCompareFunction? comparePredicate,\n bool subscribe = true,\n }) async {\n if (subscribe) {\n final Stream? responseStream =\n _api.subscribe(request: request, comparePredicate: comparePredicate);\n final Response? firstResponse = await responseStream?.first;\n\n checkException(\n response: firstResponse,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n if (firstResponse is TicksHistoryReceive) {\n return TickHistorySubscription(\n tickHistory: TicksHistoryResponse.fromJson(\n firstResponse.candles,\n firstResponse.history,\n firstResponse.pipSize,\n firstResponse.subscription),\n tickStream: responseStream?.map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response is TicksReceive\n ? Tick.fromJson(\n response.tick!,\n subscriptionJson: response.subscription,\n )\n : response is OHLCResponse\n ? OHLC.fromJson(\n response.ohlc!,\n subscriptionJson: response.subscription,\n )\n : null;\n },\n ),\n );\n }\n return null;\n } else {\n return TickHistorySubscription(\n tickHistory: await fetchTickHistory(request),\n );\n }\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/manually/ohlc_response.dart';\nimport 'package:flutter_deriv_api/api/manually/ohlc_response_result.dart';\nimport 'package:flutter_deriv_api/api/manually/tick.dart';\nimport 'package:flutter_deriv_api/api/manually/tick_base.dart';\nimport 'package:flutter_deriv_api/api/manually/tick_history_subscription.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/ticks_history_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/ticks_history_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/ticks_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/ticks_receive_methods.json b/lib/basic_api/generated/methods/ticks_receive_methods.json index a987bb1b07..20fe0da606 100644 --- a/lib/basic_api/generated/methods/ticks_receive_methods.json +++ b/lib/basic_api/generated/methods/ticks_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Subscribes to a tick for given [TickRequest]\n ///\n /// Throws [TickException] if API response contains an error\n static Stream subscribeTick(\n TicksRequest tickRequest, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: tickRequest, comparePredicate: comparePredicate)!\n .map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TickException(baseExceptionModel: baseExceptionModel),\n );\n\n return response is TicksReceive\n ? TicksResponse.fromJson(\n response.tick,\n response.subscription,\n )\n : null;\n },\n );\n\n /// Unsubscribes all ticks.\n ///\n /// Throws a [TickException] if API response contains an error\n static Future unsubscribeAllTicks() async {\n final ForgetAllReceive response =\n await _api.unsubscribeAll(method: ForgetStreamType.ticks);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TickException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Subscribes to a tick for given [TickRequest]\n ///\n /// Throws [BaseAPIException] if API response contains an error\n static Stream subscribeTick(\n TicksRequest tickRequest, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: tickRequest, comparePredicate: comparePredicate)!\n .map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response is TicksReceive\n ? TicksResponse.fromJson(\n response.tick,\n response.subscription,\n )\n : null;\n },\n );\n\n /// Unsubscribes all ticks.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future unsubscribeAllTicks() async {\n final ForgetAllReceive response =\n await _api.unsubscribeAll(method: ForgetStreamType.ticks);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/ticks_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/ticks_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/tnc_approval_receive_methods.json b/lib/basic_api/generated/methods/tnc_approval_receive_methods.json index c46ca7b649..1ec16c492e 100644 --- a/lib/basic_api/generated/methods/tnc_approval_receive_methods.json +++ b/lib/basic_api/generated/methods/tnc_approval_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Approve the latest version of terms and conditions.\n ///\n /// For parameters information refer to [TncApprovalRequest].\n /// Throws a [UserException] if API response contains an error\n static Future verify(\n TncApprovalRequest request,\n ) async {\n final TncApprovalReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n UserException(baseExceptionModel: baseExceptionModel),\n );\n\n return TncApprovalResponse.fromJson(response.tncApproval);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Approve the latest version of terms and conditions.\n ///\n /// For parameters information refer to [TncApprovalRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future verify(\n TncApprovalRequest request,\n ) async {\n final TncApprovalReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TncApprovalResponse.fromJson(response.tncApproval);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/tnc_approval_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/tnc_approval_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/topup_virtual_receive_methods.json b/lib/basic_api/generated/methods/topup_virtual_receive_methods.json index e599d98e89..be41a59d85 100644 --- a/lib/basic_api/generated/methods/topup_virtual_receive_methods.json +++ b/lib/basic_api/generated/methods/topup_virtual_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Topes up the virtual-money's account balance becomes when it becomes low.\n ///\n /// For parameters information refer to [TopupVirtualRequest].\n /// Throws a [TopUpVirtualException] if API response contains an error\n static Future topUp([\n TopupVirtualRequest? request,\n ]) async {\n final TopupVirtualReceive response = await _api.call(\n request: request ?? const TopupVirtualRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TopUpVirtualException(baseExceptionModel: baseExceptionModel),\n );\n\n return TopupVirtualResponse.fromJson(response.topupVirtual);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Topes up the virtual-money's account balance becomes when it becomes low.\n ///\n /// For parameters information refer to [TopupVirtualRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future topUp([\n TopupVirtualRequest? request,\n ]) async {\n final TopupVirtualReceive response = await _api.call(\n request: request ?? const TopupVirtualRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TopupVirtualResponse.fromJson(response.topupVirtual);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/topup_virtual_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/topup_virtual_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/trading_durations_receive_methods.json b/lib/basic_api/generated/methods/trading_durations_receive_methods.json index d66ddc9629..7542190519 100644 --- a/lib/basic_api/generated/methods/trading_durations_receive_methods.json +++ b/lib/basic_api/generated/methods/trading_durations_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves a list of all available underlyings and the corresponding contract types and trading duration boundaries.\n ///\n /// If the user is logged in, only the assets available for that user's landing company will be returned.\n /// For parameters information refer to [TradingDurationsRequest].\n /// Throws a [TradingException] if API response contains an error\n static Future fetchTradingDurations(\n TradingDurationsRequest request,\n ) async {\n final TradingDurationsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TradingException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingDurationsResponse.fromJson(response.tradingDurations);\n }\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves a list of all available underlyings and the corresponding contract types and trading duration boundaries.\n ///\n /// If the user is logged in, only the assets available for that user's landing company will be returned.\n /// For parameters information refer to [TradingDurationsRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchTradingDurations(\n TradingDurationsRequest request,\n ) async {\n final TradingDurationsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingDurationsResponse.fromJson(response.tradingDurations);\n }\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/trading_durations_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/trading_durations_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/trading_platform_accounts_receive_methods.json b/lib/basic_api/generated/methods/trading_platform_accounts_receive_methods.json index 1e4b46500d..b17a488a9b 100644 --- a/lib/basic_api/generated/methods/trading_platform_accounts_receive_methods.json +++ b/lib/basic_api/generated/methods/trading_platform_accounts_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Trading Platform: Accounts List.\n ///\n /// Get list of Trading Platform accounts for client.\n /// For parameters information refer to [TradingPlatformAccountsRequest].\n /// Throws a [TradingPlatformException] if API response contains an error.\n static Future getAccounts(\n TradingPlatformAccountsRequest request,\n ) async {\n final TradingPlatformAccountsReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TradingPlatformException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingPlatformAccountsResponse.fromJson(\n response.tradingPlatformAccounts,\n );\n }\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Trading Platform: Accounts List.\n ///\n /// Get list of Trading Platform accounts for client.\n /// For parameters information refer to [TradingPlatformAccountsRequest].\n /// Throws a [BaseAPIException] if API response contains an error.\n static Future getAccounts(\n TradingPlatformAccountsRequest request,\n ) async {\n final TradingPlatformAccountsReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingPlatformAccountsResponse.fromJson(\n response.tradingPlatformAccounts,\n );\n }\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/api.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/trading_platform_deposit_receive_methods.json b/lib/basic_api/generated/methods/trading_platform_deposit_receive_methods.json index 14ad129971..6984a43ff7 100644 --- a/lib/basic_api/generated/methods/trading_platform_deposit_receive_methods.json +++ b/lib/basic_api/generated/methods/trading_platform_deposit_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Trading Platform: Deposit.\n ///\n /// Information about deposit transaction, or status of demo account top up.\n /// For parameters information refer to [TradingPlatformDepositRequest].\n /// Throws a [TradingPlatformException] if API response contains an error.\n static Future deposit(\n TradingPlatformDepositRequest request,\n ) async {\n final TradingPlatformDepositReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TradingPlatformException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingPlatformDepositResponse.fromJson(\n response.tradingPlatformDeposit,\n );\n }\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Trading Platform: Deposit.\n ///\n /// Information about deposit transaction, or status of demo account top up.\n /// For parameters information refer to [TradingPlatformDepositRequest].\n /// Throws a [BaseAPIException] if API response contains an error.\n static Future deposit(\n TradingPlatformDepositRequest request,\n ) async {\n final TradingPlatformDepositReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingPlatformDepositResponse.fromJson(\n response.tradingPlatformDeposit,\n );\n }\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/api.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/trading_platform_new_account_receive_methods.json b/lib/basic_api/generated/methods/trading_platform_new_account_receive_methods.json index d6456cb7c8..37225fd692 100644 --- a/lib/basic_api/generated/methods/trading_platform_new_account_receive_methods.json +++ b/lib/basic_api/generated/methods/trading_platform_new_account_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Trading Platform: New Account (request).\n ///\n /// This call creates new Trading account, either demo or real money.\n /// For parameters information refer to [TradingPlatformNewAccountRequest].\n /// Throws a [TradingPlatformException] if API response contains an error.\n static Future create(\n TradingPlatformNewAccountRequest request,\n ) async {\n final TradingPlatformNewAccountReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TradingPlatformException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingPlatformNewAccountResponse.fromJson(\n response.tradingPlatformNewAccount,\n );\n}", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Trading Platform: New Account (request).\n ///\n /// This call creates new Trading account, either demo or real money.\n /// For parameters information refer to [TradingPlatformNewAccountRequest].\n /// Throws a [BaseAPIException] if API response contains an error.\n static Future create(\n TradingPlatformNewAccountRequest request,\n ) async {\n final TradingPlatformNewAccountReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingPlatformNewAccountResponse.fromJson(\n response.tradingPlatformNewAccount,\n );\n}", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/api.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/trading_servers_receive_methods.json b/lib/basic_api/generated/methods/trading_servers_receive_methods.json index 4f54b31644..4ef38ab477 100644 --- a/lib/basic_api/generated/methods/trading_servers_receive_methods.json +++ b/lib/basic_api/generated/methods/trading_servers_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Get the list of servers for platform. Currently, only mt5 is supported\n ///\n /// For parameters information refer to [TradingServersRequest].\n /// Throws a [TradingException] if API response contains an error\n static Future fetchTradingServers(\n TradingServersRequest request,\n ) async {\n final TradingServersReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TradingException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingServersResponse.fromJson(response.tradingServers);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Get the list of servers for platform. Currently, only mt5 is supported\n ///\n /// For parameters information refer to [TradingServersRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchTradingServers(\n TradingServersRequest request,\n ) async {\n final TradingServersReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingServersResponse.fromJson(response.tradingServers);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/trading_servers_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/trading_servers_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/trading_times_receive_methods.json b/lib/basic_api/generated/methods/trading_times_receive_methods.json index 54345f562d..93972a04c9 100644 --- a/lib/basic_api/generated/methods/trading_times_receive_methods.json +++ b/lib/basic_api/generated/methods/trading_times_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Receives a list of market opening times for a given date.\n ///\n /// For parameters information refer to [TradingTimesRequest].\n /// Throws a [TradingException] if API response contains an error\n static Future fetchTradingTimes(\n TradingTimesRequest request,\n ) async {\n final TradingTimesReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TradingException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingTimesResponse.fromJson(response.tradingTimes);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Receives a list of market opening times for a given date.\n ///\n /// For parameters information refer to [TradingTimesRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchTradingTimes(\n TradingTimesRequest request,\n ) async {\n final TradingTimesReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingTimesResponse.fromJson(response.tradingTimes);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/trading_times_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/trading_times_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/transaction_receive_methods.json b/lib/basic_api/generated/methods/transaction_receive_methods.json index 4f6f6118fa..08dd08ca02 100644 --- a/lib/basic_api/generated/methods/transaction_receive_methods.json +++ b/lib/basic_api/generated/methods/transaction_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Subscribes to account's transactions\n ///\n /// Throws a [TransactionsException] if API response contains an error\n static Stream subscribeTransactions({\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(\n request: const TransactionRequest(),\n comparePredicate: comparePredicate,\n )!\n .map((Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TransactionsException(baseExceptionModel: baseExceptionModel),\n );\n\n return response is TransactionReceive\n ? TransactionResponse.fromJson(\n response.transaction,\n response.subscription,\n )\n : null;\n });\n\n /// Unsubscribes from transaction subscription.\n ///\n /// Throws a [TransactionsException] if API response contains an error\n Future unsubscribeTransaction() async {\n if (subscription == null) {\n return null;\n }\n\n final ForgetReceive response =\n await _api.unsubscribe(subscriptionId: subscription!.id);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TransactionsException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }\n\n /// Unsubscribes all transaction subscriptions.\n ///\n /// Throws a [TransactionsException] if API response contains an error\n static Future unsubscribeAllTransaction() async {\n final ForgetAllReceive response =\n await _api.unsubscribeAll(method: ForgetStreamType.transaction);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TransactionsException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Subscribes to account's transactions\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Stream subscribeTransactions({\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(\n request: const TransactionRequest(),\n comparePredicate: comparePredicate,\n )!\n .map((Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response is TransactionReceive\n ? TransactionResponse.fromJson(\n response.transaction,\n response.subscription,\n )\n : null;\n });\n\n /// Unsubscribes from transaction subscription.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future unsubscribeTransaction() async {\n if (subscription == null) {\n return null;\n }\n\n final ForgetReceive response =\n await _api.unsubscribe(subscriptionId: subscription!.id);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }\n\n /// Unsubscribes all transaction subscriptions.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future unsubscribeAllTransaction() async {\n final ForgetAllReceive response =\n await _api.unsubscribeAll(method: ForgetStreamType.transaction);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/transaction_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/transaction_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/transfer_between_accounts_receive_methods.json b/lib/basic_api/generated/methods/transfer_between_accounts_receive_methods.json index b983f5b292..bbb11fcf51 100644 --- a/lib/basic_api/generated/methods/transfer_between_accounts_receive_methods.json +++ b/lib/basic_api/generated/methods/transfer_between_accounts_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// This call allows transfers between accounts held by a given user.\n ///\n /// Transfer funds between your fiat and crypto currency accounts (for a fee).\n /// Please note that account_from should be same as current authorized account.\n /// For parameters information refer to [TransferBetweenAccountsRequest].\n /// Throws a [TransferException] if API response contains an error\n static Future transfer(\n TransferBetweenAccountsRequest request,\n ) async {\n final TransferBetweenAccountsReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TransferException(baseExceptionModel: baseExceptionModel),\n );\n\n return TransferBetweenAccountsResponse.fromJson(\n response.transferBetweenAccounts,\n response.accounts,\n response.clientToFullName,\n response.clientToLoginid,\n response.transactionId);\n }\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// This call allows transfers between accounts held by a given user.\n ///\n /// Transfer funds between your fiat and crypto currency accounts (for a fee).\n /// Please note that account_from should be same as current authorized account.\n /// For parameters information refer to [TransferBetweenAccountsRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future transfer(\n TransferBetweenAccountsRequest request,\n ) async {\n final TransferBetweenAccountsReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TransferBetweenAccountsResponse.fromJson(\n response.transferBetweenAccounts,\n response.accounts,\n response.clientToFullName,\n response.clientToLoginid,\n response.transactionId);\n }\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/transfer_between_accounts_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/transfer_between_accounts_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/verify_email_receive_methods.json b/lib/basic_api/generated/methods/verify_email_receive_methods.json index 323f58da9c..115a828e9b 100644 --- a/lib/basic_api/generated/methods/verify_email_receive_methods.json +++ b/lib/basic_api/generated/methods/verify_email_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Verifies an email address for various purposes.\n ///\n /// The system will send an email to the address containing a security code for verification.\n /// For parameters information refer to [VerifyEmailRequest].\n /// Throws a [UserException] if API response contains an error\n static Future verify(\n VerifyEmailRequest request,\n ) async {\n final VerifyEmailReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n UserException(baseExceptionModel: baseExceptionModel),\n );\n\n return VerifyEmailResponse.fromJson(response.verifyEmail);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Verifies an email address for various purposes.\n ///\n /// The system will send an email to the address containing a security code for verification.\n /// For parameters information refer to [VerifyEmailRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future verify(\n VerifyEmailRequest request,\n ) async {\n final VerifyEmailReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return VerifyEmailResponse.fromJson(response.verifyEmail);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/verify_email_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/verify_email_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/website_status_receive_methods.json b/lib/basic_api/generated/methods/website_status_receive_methods.json index 76c2b5bc7d..91468647d4 100644 --- a/lib/basic_api/generated/methods/website_status_receive_methods.json +++ b/lib/basic_api/generated/methods/website_status_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets Website status. \n /// \n /// For parameters information refer to [WebsiteStatusRequest]. \n /// Throws a [WebsiteStatusException] if API response contains an error. \n static Future fetchWebsiteStatusRaw([ \n WebsiteStatusRequest? request, \n ]) async { \n final WebsiteStatusReceive response = await _api.call( \n request: request ?? const WebsiteStatusRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n WebsiteStatusException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Subscribes to website status. \n /// \n /// Throws a [WebsiteStatusException] if API response contains an error. \n static Stream subscribeWebsiteStatusRaw( \n WebsiteStatusRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n _api \n .subscribe(request: request, comparePredicate: comparePredicate)! \n .map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n WebsiteStatusException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is WebsiteStatusReceive ? response : null; \n }, \n ); \n \n /// Unsubscribes from website status. \n /// \n /// Throws an [WebsiteStatusException] if the API response contains an error. \n Future unsubscribeWebsiteStatusRaw() async { \n if (subscription == null) { \n return null; \n } \n \n final ForgetReceive response = \n await _api.unsubscribe(subscriptionId: subscription!.id); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n WebsiteStatusException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Unsubscribes all website status subscriptions. \n /// \n /// Throws an [WebsiteStatusException] if the API response contains an error. \n static Future unsubscribeAllWebsiteStatusRaw() async { \n final ForgetAllReceive response = \n await _api.unsubscribeAll(method: ForgetStreamType.websiteStatus); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n WebsiteStatusException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Gets Website status. \n /// \n /// Throws an [WebsiteStatusException] if the API response contains an error. \n static Future fetchWebsiteStatus([ \n WebsiteStatusRequest? request, \n ]) async { \n final WebsiteStatusReceive response = await fetchWebsiteStatusRaw(request); \n \n return WebsiteStatusResponse.fromJson( \n response.websiteStatus, \n response.subscription, \n ); \n } \n \n /// Subscribes to website status. \n static Stream subscribeWebsiteStatus( \n WebsiteStatusRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeWebsiteStatusRaw( \n request, \n comparePredicate: comparePredicate, \n ).map( \n (WebsiteStatusReceive? response) => response == null \n ? null \n : WebsiteStatusResponse.fromJson( \n response.websiteStatus, \n response.subscription, \n ), \n ); \n \n /// Unsubscribes from website status. \n /// \n /// Throws an [WebsiteStatusException] if the API response contains an error. \n Future unsubscribeWebsiteStatus() async { \n final ForgetReceive? response = await unsubscribeWebsiteStatusRaw(); \n \n return ForgetResponse.fromJson(response?.forget); \n } \n \n /// Unsubscribes all website status subscriptions. \n /// \n /// Throws an [WebsiteStatusException] if the API response contains an error. \n static Future unsubscribeAllWebsiteStatus() async { \n final ForgetAllReceive response = await unsubscribeAllWebsiteStatusRaw(); \n \n return ForgetAllResponse.fromJson(response.forgetAll); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets Website status. \n /// \n /// For parameters information refer to [WebsiteStatusRequest]. \n /// Throws a [BaseAPIException] if API response contains an error. \n static Future fetchWebsiteStatusRaw([ \n WebsiteStatusRequest? request, \n ]) async { \n final WebsiteStatusReceive response = await _api.call( \n request: request ?? const WebsiteStatusRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Subscribes to website status. \n /// \n /// Throws a [BaseAPIException] if API response contains an error. \n static Stream subscribeWebsiteStatusRaw( \n WebsiteStatusRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n _api \n .subscribe(request: request, comparePredicate: comparePredicate)! \n .map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is WebsiteStatusReceive ? response : null; \n }, \n ); \n \n /// Unsubscribes from website status. \n /// \n /// Throws an [BaseAPIException] if the API response contains an error. \n Future unsubscribeWebsiteStatusRaw() async { \n if (subscription == null) { \n return null; \n } \n \n final ForgetReceive response = \n await _api.unsubscribe(subscriptionId: subscription!.id); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Unsubscribes all website status subscriptions. \n /// \n /// Throws an [BaseAPIException] if the API response contains an error. \n static Future unsubscribeAllWebsiteStatusRaw() async { \n final ForgetAllReceive response = \n await _api.unsubscribeAll(method: ForgetStreamType.websiteStatus); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Gets Website status. \n /// \n /// Throws an [BaseAPIException] if the API response contains an error. \n static Future fetchWebsiteStatus([ \n WebsiteStatusRequest? request, \n ]) async { \n final WebsiteStatusReceive response = await fetchWebsiteStatusRaw(request); \n \n return WebsiteStatusResponse.fromJson( \n response.websiteStatus, \n response.subscription, \n ); \n } \n \n /// Subscribes to website status. \n static Stream subscribeWebsiteStatus( \n WebsiteStatusRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeWebsiteStatusRaw( \n request, \n comparePredicate: comparePredicate, \n ).map( \n (WebsiteStatusReceive? response) => response == null \n ? null \n : WebsiteStatusResponse.fromJson( \n response.websiteStatus, \n response.subscription, \n ), \n ); \n \n /// Unsubscribes from website status. \n /// \n /// Throws an [BaseAPIException] if the API response contains an error. \n Future unsubscribeWebsiteStatus() async { \n final ForgetReceive? response = await unsubscribeWebsiteStatusRaw(); \n \n return ForgetResponse.fromJson(response?.forget); \n } \n \n /// Unsubscribes all website status subscriptions. \n /// \n /// Throws an [BaseAPIException] if the API response contains an error. \n static Future unsubscribeAllWebsiteStatus() async { \n final ForgetAllReceive response = await unsubscribeAllWebsiteStatusRaw(); \n \n return ForgetAllResponse.fromJson(response.forgetAll); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/website_status_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/website_status_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/helpers/miscellaneous_helper.dart b/lib/helpers/miscellaneous_helper.dart index 6d75cf53df..73a7c97323 100644 --- a/lib/helpers/miscellaneous_helper.dart +++ b/lib/helpers/miscellaneous_helper.dart @@ -2,7 +2,7 @@ import 'dart:io'; import 'package:device_info_plus/device_info_plus.dart'; -import 'package:flutter_deriv_api/api/exceptions/api_base_exception.dart'; +import 'package:flutter_deriv_api/api/exceptions/base_api_exception.dart'; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/basic_api/response.dart'; @@ -33,7 +33,7 @@ String? parseWebSocketUrl(String? url, {bool isAuthUrl = false}) { /// Checks for existence of error in [response] and throws exception created by [exceptionCreator] void checkException({ Response? response, - APIBaseException Function({BaseExceptionModel? baseExceptionModel})? + BaseAPIException Function({BaseExceptionModel? baseExceptionModel})? exceptionCreator, }) { if (response?.error != null) { diff --git a/test/api/exceptions/api_base_exception_test.dart b/test/api/exceptions/api_base_exception_test.dart new file mode 100644 index 0000000000..4ff9f125ba --- /dev/null +++ b/test/api/exceptions/api_base_exception_test.dart @@ -0,0 +1,46 @@ +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + group('APIBaseException tests =>', () { + test('should return the correct message.', () { + final BaseExceptionModel baseExceptionModel = + BaseExceptionModel(code: 'BAD_REQUEST', message: 'Bad Request'); + final BaseAPIException exception = + BaseAPIException(baseExceptionModel: baseExceptionModel); + + expect(exception.message, 'Bad Request'); + }); + + test('should return the correct code.', () { + final BaseExceptionModel baseExceptionModel = + BaseExceptionModel(code: 'BAD_REQUEST', message: 'Bad Request'); + final BaseAPIException exception = + BaseAPIException(baseExceptionModel: baseExceptionModel); + + expect(exception.code, 'BAD_REQUEST'); + }); + + test('should return the correct details.', () { + final BaseExceptionModel baseExceptionModel = BaseExceptionModel( + code: 'BAD_REQUEST', + message: 'Bad Request', + details: {'key': 'value'}, + ); + final BaseAPIException exception = + BaseAPIException(baseExceptionModel: baseExceptionModel); + + expect(exception.details, {'key': 'value'}); + }); + + test('should return the correct string representation.', () { + final BaseExceptionModel baseExceptionModel = + BaseExceptionModel(code: 'BAD_REQUEST', message: 'Bad Request'); + final BaseAPIException exception = + BaseAPIException(baseExceptionModel: baseExceptionModel); + final String stringRepresentation = '$exception'; + + expect(stringRepresentation, 'Bad Request'); + }); + }); +} diff --git a/test/helpers/boolean_helper_test.dart b/test/helpers/boolean_helper_test.dart new file mode 100644 index 0000000000..095708e887 --- /dev/null +++ b/test/helpers/boolean_helper_test.dart @@ -0,0 +1,49 @@ +import 'package:test/test.dart'; + +import 'package:flutter_deriv_api/helpers/boolean_helper.dart'; + +void main() { + group('getBool tests =>', () { + test('should return true for 1.', () { + final bool? result = getBool(1); + expect(result, true); + }); + + test('should return true for true.', () { + final bool? result = getBool(true); + expect(result, true); + }); + + test('should return false for 0.', () { + final bool? result = getBool(0); + expect(result, false); + }); + + test('should return false for false.', () { + final bool? result = getBool(false); + expect(result, false); + }); + + test('should return null for null.', () { + final bool? result = getBool(null); + expect(result, null); + }); + }); + + group('getInt tests =>', () { + test('should return 1 for true.', () { + final int? result = getInt(value: true); + expect(result, 1); + }); + + test('should return 0 for false.', () { + final int? result = getInt(value: false); + expect(result, 0); + }); + + test('should return null for null.', () { + final int? result = getInt(); + expect(result, null); + }); + }); +} diff --git a/test/helpers/date_time_helper_test.dart b/test/helpers/date_time_helper_test.dart new file mode 100644 index 0000000000..17b70ec9e5 --- /dev/null +++ b/test/helpers/date_time_helper_test.dart @@ -0,0 +1,120 @@ +// ignore_for_file: avoid_redundant_argument_values + +import 'package:test/test.dart'; + +import 'package:flutter_deriv_api/helpers/date_time_helper.dart'; + +void main() { + group('getCurrentLocalEpoch tests =>', () { + test('should return current epoch time in seconds.', () { + final int result = getCurrentLocalEpoch(); + + expect(result, isA()); + }); + }); + + group('getCurrentServerTime tests =>', () { + test('should return current server time.', () { + const int timeDifference = 3600; + final DateTime result = getCurrentServerTime(timeDifference); + + expect(result, isA()); + }); + }); + + group('getDateTime tests =>', () { + test('should return DateTime from time in seconds.', () { + const int timeInSeconds = 1633459200; + final DateTime? result = getDateTime(timeInSeconds); + + expect(result, isA()); + expect(result?.year, 2021); + expect(result?.month, 10); + expect(result?.day, 5); + expect(result?.hour, 18); + expect(result?.minute, 40); + expect(result?.second, 0); + }); + + test('should return null for null time in seconds.', () { + final DateTime? result = getDateTime(null); + + expect(result, null); + }); + }); + + group('getDateTimeFromString tests =>', () { + test('should return DateTime from string in seconds.', () { + const String timeInSeconds = '1633459200'; + final DateTime? result = getDateTimeFromString(timeInSeconds); + + expect(result, isA()); + expect(result?.year, 2021); + expect(result?.month, 10); + expect(result?.day, 5); + expect(result?.hour, 18); + expect(result?.minute, 40); + expect(result?.second, 0); + }); + + test('should return null for null string.', () { + final DateTime? result = getDateTimeFromString(null); + + expect(result, null); + }); + + test('should return null for invalid string.', () { + final DateTime? result = getDateTimeFromString('invalid'); + + expect(result, null); + }); + }); + + group('getSecondsSinceEpoch tests =>', () { + test('should return seconds since epoch from milliseconds since epoch.', + () { + const int millisecondsSinceEpoch = 1633459200000; + final int result = getSecondsSinceEpoch(millisecondsSinceEpoch); + + expect(result, 1633459200); + }); + }); + + group('getSecondsSinceEpochDateTime tests =>', () { + test('should return seconds since epoch from DateTime object.', () { + final DateTime dateTime = DateTime.utc(2021, 10, 6, 0, 0, 0); + final int? result = getSecondsSinceEpochDateTime(dateTime); + + expect(result, 1633478400); + }); + + test('should return null for null DateTime.', () { + final int? result = getSecondsSinceEpochDateTime(null); + + expect(result, null); + }); + }); + + group('getStringFromDateTime tests =>', () { + test('should return formatted string from DateTime object.', () { + final DateTime dateTime = DateTime.utc(2021, 10, 6); + final String? result = getStringFromDateTime(dateTime); + + expect(result, '2021-10-06'); + }); + + test('should return null for null DateTime.', () { + final String? result = getStringFromDateTime(null); + + expect(result, null); + }); + + test('should return formatted string with custom pattern.', () { + final DateTime dateTime = DateTime.utc(2021, 10, 6); + final String? result = + getStringFromDateTime(dateTime, pattern: 'MM/dd/yyyy'); + + expect(result, '10/06/2021'); + }); + }); +} diff --git a/test/helpers/enum_helper_test.dart b/test/helpers/enum_helper_test.dart new file mode 100644 index 0000000000..9951f1497b --- /dev/null +++ b/test/helpers/enum_helper_test.dart @@ -0,0 +1,208 @@ +import 'package:test/test.dart'; + +import 'package:flutter_deriv_api/api/models/enums.dart'; +import 'package:flutter_deriv_api/helpers/enum_helper.dart'; + +void main() { + group('getEnumName tests =>', () { + test('should return formatted enum name.', () { + final String result = getEnumName('enum_name'); + + expect(result, 'enumName'); + }); + + test('should handle special characters in enum name.', () { + final String result = getEnumName('enum_name_123_&'); + + expect(result, 'enumName123'); + }); + }); + + group('getStringFromEnum tests =>', () { + test('should return string from enum in snake case.', () { + final String result = getStringFromEnum(EnumCase.snakeCase); + + expect(result, 'snake_case'); + }); + + test('should return string from enum in param case.', () { + final String result = + getStringFromEnum(EnumCase.paramCase, enumCase: EnumCase.paramCase); + + expect(result, 'param-case'); + }); + + test('should return string from enum in upper case.', () { + final String result = + getStringFromEnum(EnumCase.upperCase, enumCase: EnumCase.upperCase); + + expect(result, 'UPPERCASE'); + }); + + test('should return empty string for null enum.', () { + final String result = getStringFromEnum(null); + + expect(result, ''); + }); + }); + + group('getEnumFromString tests =>', () { + test('should return enum from string in snake case.', () { + final EnumCase? result = getEnumFromString( + values: EnumCase.values, + name: 'snake_case', + ); + + expect(result, EnumCase.snakeCase); + }); + + test('should return enum from string in param case.', () { + final EnumCase? result = getEnumFromString( + values: EnumCase.values, + name: 'param-case', + enumCase: EnumCase.paramCase, + ); + + expect(result, EnumCase.paramCase); + }); + + test('should return enum from string in upper case.', () { + final EnumCase? result = getEnumFromString( + values: EnumCase.values, + name: 'UPPERCASE', + enumCase: EnumCase.upperCase, + ); + + expect(result, EnumCase.upperCase); + }); + + test('should return null for unknown string.', () { + final EnumCase? result = getEnumFromString( + values: EnumCase.values, + name: 'unknown_case', + ); + expect(result, null); + }); + + test('should return null for null string.', () { + final EnumCase? result = getEnumFromString( + values: EnumCase.values, + name: null, + ); + + expect(result, null); + }); + }); + + group('getStringListFromEnums tests =>', () { + test('should return list of strings from list of enums in snake case.', () { + final List result = getStringListFromEnums( + EnumCase.values, + ); + + expect(result, ['snake_case', 'param_case', 'upper_case']); + }); + + test('should return list of strings from list of enums in param case.', () { + final List result = getStringListFromEnums( + EnumCase.values, + enumCase: EnumCase.paramCase, + ); + + expect(result, ['snake-case', 'param-case', 'upper-case']); + }); + + test('should return list of strings from list of enums in upper case.', () { + final List result = getStringListFromEnums( + EnumCase.values, + enumCase: EnumCase.upperCase, + ); + + expect(result, ['SNAKECASE', 'PARAMCASE', 'UPPERCASE']); + }); + }); + + group('getEnumListFromStrings tests =>', () { + test('should return list of enums from list of strings in snake case.', () { + final List? result = getEnumListFromStrings( + values: EnumCase.values, + names: ['snake_case', 'param-case', 'UPPERCASE'], + ); + + expect(result, [EnumCase.snakeCase, null, null]); + }); + + test('should return list of enums from list of strings in param case.', () { + final List? result = getEnumListFromStrings( + values: EnumCase.values, + names: ['snake-case', 'param-case', 'UPPERCASE'], + enumCase: EnumCase.paramCase, + ); + + expect(result, [EnumCase.snakeCase, EnumCase.paramCase, null]); + }); + + test('should return list of enums from list of strings in upper case.', () { + final List? result = getEnumListFromStrings( + values: EnumCase.values, + names: ['snake_case', 'param_case', 'UPPERCASE'], + enumCase: EnumCase.upperCase, + ); + + expect(result, [null, null, EnumCase.upperCase]); + }); + + test('should return null for unknown strings.', () { + final List? result = getEnumListFromStrings( + values: EnumCase.values, + names: ['unknown_case'], + ); + + expect(result, [null]); + }); + + test('should return null for null strings.', () { + final List? result = getEnumListFromStrings( + values: EnumCase.values, + names: null, + ); + + expect(result, null); + }); + }); + + group('getEnumValueString tests =>', () { + test('should return the enum value string.', () { + final String result = getEnumValueString(EnumCase.snakeCase.toString()); + + expect(result, 'snakeCase'); + }); + }); + + group('EnumConverter tests =>', () { + test('should convert string to AccountRiskClassification enum.', () { + final AccountRiskClassification? result = + 'low'.toAccountRiskClassificationEnum; + + expect(result, AccountRiskClassification.low); + }); + + test('should convert string to VerificationType enum.', () { + final VerificationType? result = 'document'.toVerificationTypeEnum; + + expect(result, VerificationType.document); + }); + + test('should convert string to AccountStatusType enum.', () { + final AccountStatusType? result = 'disabled'.toAccountStatusTypeEnum; + + expect(result, AccountStatusType.disabled); + }); + + test('should convert string to ContractType enum.', () { + final ContractType? result = 'CALLSPREAD'.toContractTypeEnum; + + expect(result, ContractType.callSpread); + }); + }); +} diff --git a/test/helpers/map_helper_test.dart b/test/helpers/map_helper_test.dart new file mode 100644 index 0000000000..df45944991 --- /dev/null +++ b/test/helpers/map_helper_test.dart @@ -0,0 +1,104 @@ +import 'package:flutter_deriv_api/helpers/map_helper.dart'; +import 'package:test/test.dart'; + +void main() { + group('getListFromMap tests =>', () { + test('should return null for null map list.', () { + final List? result = getListFromMap(null); + + expect(result, null); + }); + + test('should return null for empty map list.', () { + final List? result = getListFromMap([]); + + expect(result, null); + }); + + test('should return list of models from map list.', () { + final List> mapList = >[ + {'id': 1, 'name': 'John'}, + {'id': 2, 'name': 'Jane'}, + ]; + + final List? result = getListFromMap( + mapList, + itemToTypeCallback: (dynamic item) => UserModel.fromMap(item), + ); + + expect(result, isNotNull); + expect(result!.length, 2); + expect(result[0], isA()); + expect(result[1], isA()); + expect(result[0]?.id, 1); + expect(result[0]?.name, 'John'); + expect(result[1]?.id, 2); + expect(result[1]?.name, 'Jane'); + }); + + test('should return list of models without callback function.', () { + final List> mapList = >[ + {'id': 1, 'name': 'John'}, + {'id': 2, 'name': 'Jane'}, + ]; + + final List? result = getListFromMap(mapList); + + expect(result, isNotNull); + expect(result!.length, 2); + expect(result[0], {'id': 1, 'name': 'John'}); + expect(result[1], {'id': 2, 'name': 'Jane'}); + }); + }); + + group('getItemFromMap tests =>', () { + test('should return null for null map.', () { + final dynamic result = getItemFromMap(null); + + expect(result, null); + }); + + test('should return model from map.', () { + final Map map = { + 'id': 1, + 'name': 'John' + }; + + final UserModel? result = getItemFromMap( + map, + itemToTypeCallback: (dynamic item) => UserModel.fromMap(item), + ); + + expect(result, isA()); + expect(result?.id, 1); + expect(result?.name, 'John'); + }); + + test('should return map without callback function.', () { + final Map map = { + 'id': 1, + 'name': 'John' + }; + + final Map? result = + getItemFromMap(map, itemToTypeCallback: (dynamic item) => item); + + expect(result, {'id': 1, 'name': 'John'}); + }); + }); +} + +class UserModel { + UserModel({ + required this.id, + required this.name, + }); + + factory UserModel.fromMap(Map map) => UserModel( + id: map['id'], + name: map['name'], + ); + + final int id; + final String name; +} diff --git a/test/helpers/number_helper_test.dart b/test/helpers/number_helper_test.dart new file mode 100644 index 0000000000..a634f6a596 --- /dev/null +++ b/test/helpers/number_helper_test.dart @@ -0,0 +1,212 @@ +import 'package:test/test.dart'; + +import 'package:flutter_deriv_api/helpers/number_helper.dart'; + +void main() { + group('getDecimalDigits tests =>', () { + test('should return 2 for a whole number string.', () { + expect(getDecimalDigits('123'), equals(2)); + }); + + test('should return 2 for a decimal number string.', () { + expect(getDecimalDigits('123.45'), equals(2)); + }); + + test( + 'should return 4 for a decimal number string with more than 2 decimal places.', + () { + expect(getDecimalDigits('123.4567'), equals(4)); + }); + + test('should return 2 for an empty string.', () { + expect(getDecimalDigits(''), equals(2)); + }); + }); + + group('NumberValidator tests =>', () { + test('isANumber should return true for a valid number string.', () { + expect(NumberValidator.isANumber('123'), isTrue); + }); + + test('isANumber should return true for a valid decimal number string.', () { + expect(NumberValidator.isANumber('123.45'), isTrue); + }); + + test('isANumber should return false for an invalid number string.', () { + expect(NumberValidator.isANumber('abc'), isFalse); + }); + + test( + 'isBetweenLimits should return true when the value is within the limits.', + () { + expect( + NumberValidator.isBetweenLimits( + stringValue: '5', + lowerLimit: 1, + upperLimit: 10, + ), + isTrue, + ); + }); + + test( + 'isBetweenLimits should return false when the value is below the lower limit.', + () { + expect( + NumberValidator.isBetweenLimits( + stringValue: '5', + lowerLimit: 10, + upperLimit: 20, + ), + isFalse, + ); + }); + + test( + 'isBetweenLimits should return false when the value is above the upper limit.', + () { + expect( + NumberValidator.isBetweenLimits( + stringValue: '25', + lowerLimit: 10, + upperLimit: 20, + ), + isFalse, + ); + }); + + test( + 'isLessThanLimit should return true when the value is less than the upper limit.', + () { + expect( + NumberValidator.isLessThanLimit(stringValue: '5', upperLimit: 10), + isTrue, + ); + }); + + test( + 'isLessThanLimit should return true when the value is equal to the upper limit.', + () { + expect( + NumberValidator.isLessThanLimit(stringValue: '10', upperLimit: 10), + isTrue, + ); + }); + + test( + 'isLessThanLimit should return false when the value is greater than the upper limit.', + () { + expect( + NumberValidator.isLessThanLimit(stringValue: '15', upperLimit: 10), + isFalse, + ); + }); + + test( + 'isMoreThanLimit should return true when the value is greater than the lower limit.', + () { + expect( + NumberValidator.isMoreThanLimit(stringValue: '5', lowerLimit: 1), + isTrue, + ); + }); + + test( + 'isMoreThanLimit should return true when the value is equal to the lower limit.', + () { + expect( + NumberValidator.isMoreThanLimit(stringValue: '1', lowerLimit: 1), + isTrue, + ); + }); + + test( + 'isMoreThanLimit should return false when the value is less than the lower limit.', + () { + expect( + NumberValidator.isMoreThanLimit(stringValue: '0', lowerLimit: 1), + isFalse, + ); + }); + + test('isAPositiveNumber should return true for a positive number string.', + () { + expect(NumberValidator.isAPositiveNumber('5'), isTrue); + }); + + test('isAPositiveNumber should return false for a negative number string.', + () { + expect(NumberValidator.isAPositiveNumber('-5'), isFalse); + }); + + test('isAPositiveNumber should return false for zero.', () { + expect(NumberValidator.isAPositiveNumber('0'), isFalse); + }); + + test( + 'hasValidPrecision should return true when the decimal number has valid precision.', + () { + expect( + NumberValidator.hasValidPrecision( + stringValue: '1.23', + validDecimalNumber: 2, + ), + isTrue, + ); + }); + + test( + 'hasValidPrecision should return true when the whole number is provided.', + () { + expect( + NumberValidator.hasValidPrecision( + stringValue: '5', + validDecimalNumber: 2, + ), + isTrue, + ); + }); + + test( + 'hasValidPrecision should return false when the decimal number has more decimal places than the valid precision.', + () { + expect( + NumberValidator.hasValidPrecision( + stringValue: '1.2345', + validDecimalNumber: 2, + ), + isFalse, + ); + }); + }); + + group('generateRandomInt tests =>', () { + test('should generate a random int between min and max (inclusive).', () { + final int randomInt = generateRandomInt(min: 1); + + expect(randomInt, greaterThanOrEqualTo(1)); + expect(randomInt, lessThanOrEqualTo(10)); + }); + + test('should generate a random int with default min and max values.', () { + final int randomInt = generateRandomInt(); + + expect(randomInt, greaterThanOrEqualTo(0)); + expect(randomInt, lessThanOrEqualTo(10)); + }); + }); + + group('getDouble tests =>', () { + test('should parse double value from a string.', () { + expect(getDouble('123.45'), equals(123.45)); + }); + + test('should parse double value from a number.', () { + expect(getDouble(123.45), equals(123.45)); + }); + + test('should return null for an invalid value.', () { + expect(getDouble('abc'), isNull); + }); + }); +} diff --git a/test/services/connection/api_manager/exceptions/api_manager_exception_test.dart b/test/services/connection/api_manager/exceptions/api_manager_exception_test.dart new file mode 100644 index 0000000000..21f9671b16 --- /dev/null +++ b/test/services/connection/api_manager/exceptions/api_manager_exception_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; + +import 'package:flutter_deriv_api/services/connection/api_manager/exceptions/api_manager_exception.dart'; + +void main() { + group('APIManagerException tests =>', () { + test( + 'should create an APIManagerException instance with the provided message.', + () { + final APIManagerException exception = + APIManagerException(message: 'Test Exception'); + + expect(exception, isA()); + expect(exception.message, 'Test Exception'); + }); + + test( + 'toString should return a string representation of the APIManagerException.', + () { + final APIManagerException exception = + APIManagerException(message: 'Test Exception'); + + expect(exception.toString(), 'APIManagerException: Test Exception'); + }); + }); +} From 2973132f38364591ddd00e5c7afbdd9754e9f4c3 Mon Sep 17 00:00:00 2001 From: sahani-deriv <125638269+sahani-deriv@users.noreply.github.com> Date: Thu, 10 Aug 2023 16:19:29 +0800 Subject: [PATCH 08/64] MOBC-450/fix_connectivity_issue (#275) - fix connectivity issue --- .../response/p2p_ping_response_result.dart | 2 +- lib/state/connection/connection_cubit.dart | 51 ++++++++++--------- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/lib/api/response/p2p_ping_response_result.dart b/lib/api/response/p2p_ping_response_result.dart index 02d97a4ccb..a82581922a 100644 --- a/lib/api/response/p2p_ping_response_result.dart +++ b/lib/api/response/p2p_ping_response_result.dart @@ -67,7 +67,7 @@ class P2pPingResponse extends P2pPingResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - APIBaseException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/state/connection/connection_cubit.dart b/lib/state/connection/connection_cubit.dart index 4a655bb363..c47d4db6ab 100644 --- a/lib/state/connection/connection_cubit.dart +++ b/lib/state/connection/connection_cubit.dart @@ -32,13 +32,9 @@ class ConnectionCubit extends Cubit { _connectionInformation = connectionInformation; - if (_api is BinaryAPI) { - _setupConnectivityListener(); - } + _connect(_connectionInformation); _startKeepAliveTimer(); - - _connect(_connectionInformation); } final String _key = '${UniqueKey()}'; @@ -74,6 +70,9 @@ class ConnectionCubit extends Cubit { /// Gets app id of websocket. static String get appId => _connectionInformation.appId; + /// Streamsubscription for connectivity. + StreamSubscription? connectivitySubscription; + /// Reconnect to Websocket. Future reconnect({ConnectionInformation? connectionInformation}) async { emit(const ConnectionDisconnectedState()); @@ -122,26 +121,30 @@ class ConnectionCubit extends Cubit { } }, ); + + if (_api is BinaryAPI) { + _setupConnectivityListener(); + } } - void _setupConnectivityListener() => - Connectivity().onConnectivityChanged.listen( - (ConnectivityResult status) async { - final bool isConnectedToNetwork = - status == ConnectivityResult.mobile || - status == ConnectivityResult.wifi; - - if (isConnectedToNetwork) { - final bool isConnected = await _ping(); - - if (!isConnected) { - await reconnect(); - } - } else if (status == ConnectivityResult.none) { - emit(const ConnectionDisconnectedState()); + void _setupConnectivityListener() { + connectivitySubscription ??= Connectivity().onConnectivityChanged.listen( + (ConnectivityResult status) async { + final bool isConnectedToNetwork = status == ConnectivityResult.mobile || + status == ConnectivityResult.wifi; + + if (isConnectedToNetwork) { + final bool isConnected = await _ping(); + + if (!isConnected) { + await reconnect(); } - }, - ); + } else if (status == ConnectivityResult.none) { + emit(const ConnectionDisconnectedState()); + } + }, + ); + } void _startKeepAliveTimer() { if (_connectivityTimer == null || !_connectivityTimer!.isActive) { @@ -154,7 +157,6 @@ class ConnectionCubit extends Cubit { try { final PingResponse response = await PingResponse.pingMethod().timeout(_pingTimeout); - return response.ping == PingEnum.pong; } on Exception catch (_) { return false; @@ -164,7 +166,8 @@ class ConnectionCubit extends Cubit { @override Future close() { _connectivityTimer?.cancel(); - + connectivitySubscription?.cancel(); + connectivitySubscription = null; return super.close(); } } From 83b17b791b1baac42f085f9547bc7f194ad7e737 Mon Sep 17 00:00:00 2001 From: Osama Ghazal <124760982+osama-deriv@users.noreply.github.com> Date: Wed, 6 Sep 2023 15:14:51 +0800 Subject: [PATCH 09/64] add auth endpoint to connection_information.dart class --- .../connection/api_manager/connection_information.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/services/connection/api_manager/connection_information.dart b/lib/services/connection/api_manager/connection_information.dart index 41820801ec..69a808d69a 100644 --- a/lib/services/connection/api_manager/connection_information.dart +++ b/lib/services/connection/api_manager/connection_information.dart @@ -5,6 +5,7 @@ class ConnectionInformation { required this.appId, required this.brand, required this.endpoint, + required this.authEndpoint, this.language = 'en', }); @@ -17,6 +18,9 @@ class ConnectionInformation { /// API endpoint. final String endpoint; + /// Auth endpoint. + final String authEndpoint; + /// API language. final String language; } From f0d83522c15fb25700ffe34780def1831872dbfc Mon Sep 17 00:00:00 2001 From: Osama Ghazal <124760982+osama-deriv@users.noreply.github.com> Date: Wed, 6 Sep 2023 15:29:18 +0800 Subject: [PATCH 10/64] add auth endpoint to connection_cubit.dart --- lib/state/connection/connection_cubit.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/state/connection/connection_cubit.dart b/lib/state/connection/connection_cubit.dart index c47d4db6ab..c2f401161e 100644 --- a/lib/state/connection/connection_cubit.dart +++ b/lib/state/connection/connection_cubit.dart @@ -67,6 +67,9 @@ class ConnectionCubit extends Cubit { /// Gets endpoint of websocket. static String get endpoint => _connectionInformation.endpoint; + /// Gets auth endpoint of websocket. + static String get authEndpoint => _connectionInformation.authEndpoint; + /// Gets app id of websocket. static String get appId => _connectionInformation.appId; From b70287ad30fde430ad584016f336ec5ea51c7e43 Mon Sep 17 00:00:00 2001 From: Hamed Rezaee <57184669+hamed-deriv@users.noreply.github.com> Date: Wed, 6 Sep 2023 17:37:42 +0800 Subject: [PATCH 11/64] hamed/remove_http_client (#280) - remove http client --- .../exceptions/http_client_exception.dart | 21 --------- .../connection/http_client/http_client.dart | 43 ------------------- 2 files changed, 64 deletions(-) delete mode 100644 lib/services/connection/http_client/exceptions/http_client_exception.dart delete mode 100644 lib/services/connection/http_client/http_client.dart diff --git a/lib/services/connection/http_client/exceptions/http_client_exception.dart b/lib/services/connection/http_client/exceptions/http_client_exception.dart deleted file mode 100644 index ce3bd2759a..0000000000 --- a/lib/services/connection/http_client/exceptions/http_client_exception.dart +++ /dev/null @@ -1,21 +0,0 @@ -/// HTTP Client Exception exception class. -class HTTPClientException implements Exception { - /// Initializes http exception. - HTTPClientException({ - required this.statusCode, - required this.message, - required this.errorCode, - }); - - /// Exception message. - final String message; - - /// Http status code. - final int statusCode; - - /// Http error code. - final String? errorCode; - - @override - String toString() => '$statusCode HTTP Error Ocurred: $message'; -} \ No newline at end of file diff --git a/lib/services/connection/http_client/http_client.dart b/lib/services/connection/http_client/http_client.dart deleted file mode 100644 index e3b3bdf92f..0000000000 --- a/lib/services/connection/http_client/http_client.dart +++ /dev/null @@ -1,43 +0,0 @@ -import 'dart:convert' as convert; - -import 'package:flutter_deriv_api/services/connection/http_client/exceptions/http_client_exception.dart'; -import 'package:http/http.dart' as http; - -/// Singleton class for http requests. -class HttpClient { - /// Initializes http client. - factory HttpClient() => _instance; - - HttpClient._internal(); - - static final HttpClient _instance = HttpClient._internal(); - - /// Http get request. - Future get(String url) async => http.get(Uri.parse(url)); - - /// Http post request. - Future> post({ - required String url, - required Map jsonBody, - Map? headers, - }) async { - final String jsonString = convert.jsonEncode(jsonBody); - - final http.Response response = - await http.post(Uri.parse(url), body: jsonString, headers: headers); - - final Map jsonResponse = convert.jsonDecode(response.body); - - if (response.statusCode ~/ 100 != 2) { - throw HTTPClientException( - errorCode: jsonResponse['error_code'], - statusCode: response.statusCode, - message: jsonResponse.containsKey('message') - ? jsonResponse['message'] - : 'Server Error', - ); - } - - return jsonResponse; - } -} \ No newline at end of file From de4a7dd3d18213997bfc150f7ef8d1cfc494e3e7 Mon Sep 17 00:00:00 2001 From: Osama Ghazal <124760982+osama-deriv@users.noreply.github.com> Date: Mon, 11 Sep 2023 12:17:17 +0800 Subject: [PATCH 12/64] fix test --- test/state/connection/connection_bloc_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/state/connection/connection_bloc_test.dart b/test/state/connection/connection_bloc_test.dart index 651094dd51..d4147817a8 100644 --- a/test/state/connection/connection_bloc_test.dart +++ b/test/state/connection/connection_bloc_test.dart @@ -10,7 +10,7 @@ void main() { setUpAll( () { connectionCubit = ConnectionCubit( - ConnectionInformation(appId: '', brand: '', endpoint: ''), + ConnectionInformation(appId: '', brand: '', endpoint: '',authEndpoint: ''), api: MockAPI(), ); }, From c3a2a71084c5dee46c25300b0690d924020fe35b Mon Sep 17 00:00:00 2001 From: ramin-deriv <55975218+ramin-deriv@users.noreply.github.com> Date: Wed, 27 Sep 2023 16:00:19 +0800 Subject: [PATCH 13/64] ramin/update_package_for_wallet (#281) - update package for wallet --- lib/api/models/enums.dart | 5 +- .../response/authorize_response_result.dart | 817 ++---- .../cashier_payments_response_extended.dart | 99 + .../cashier_payments_response_result.dart | 76 +- .../get_account_types_response_extended.dart | 28 + .../get_account_types_response_result.dart | 442 +--- ..._financial_assessment_response_result.dart | 200 +- .../response/get_limits_response_result.dart | 103 +- .../get_settings_response_result.dart | 172 +- ...nding_company_details_response_result.dart | 123 +- .../landing_company_response_result.dart | 2240 ++++++++++++----- .../response/link_wallet_response_result.dart | 6 +- .../mt5_get_settings_response_result.dart | 322 ++- .../new_account_wallet_response_extended.dart | 28 + .../new_account_wallet_response_result.dart | 27 +- .../residence_list_response_result.dart | 152 +- .../service_token_response_result.dart | 139 +- ...ing_platform_accounts_response_result.dart | 107 +- ...latform_asset_listing_response_result.dart | 274 ++ ...rm_available_accounts_response_result.dart | 114 +- ...ding_platform_deposit_response_result.dart | 10 +- ..._platform_new_account_response_result.dart | 56 +- ...tform_password_change_response_result.dart | 6 +- ...atform_password_reset_response_result.dart | 6 +- ...tform_product_listing_response_result.dart | 67 +- ...g_platform_withdrawal_response_result.dart | 12 +- ...sfer_between_accounts_response_result.dart | 53 +- .../wallet_migration_response_extended.dart | 57 + .../wallet_migration_response_result.dart | 417 +++ .../website_status_response_result.dart | 385 ++- .../generated/authorize_receive.dart | 15 +- lib/basic_api/generated/authorize_send.dart | 11 +- .../generated/get_account_types_receive.dart | 15 +- .../generated/get_account_types_send.dart | 19 +- .../generated/get_settings_receive.dart | 15 +- .../generated/get_settings_send.dart | 11 +- .../landing_company_details_send.dart | 19 +- .../generated/landing_company_send.dart | 11 +- .../generated/link_wallet_receive.dart | 15 +- lib/basic_api/generated/link_wallet_send.dart | 11 +- ...latform_asset_listing_receive_methods.json | 4 + .../wallet_migration_receive_methods.json | 4 + .../generated/mt5_new_account_receive.dart | 15 +- .../generated/mt5_new_account_send.dart | 21 +- .../mt5_password_change_receive.dart | 15 +- .../new_account_maltainvest_send.dart | 176 +- .../generated/new_account_real_receive.dart | 15 +- .../generated/new_account_real_send.dart | 21 +- .../new_account_virtual_receive.dart | 15 +- .../generated/new_account_virtual_send.dart | 11 +- .../generated/new_account_wallet_receive.dart | 15 +- .../generated/new_account_wallet_send.dart | 106 +- .../generated/profit_table_send.dart | 17 +- .../generated/set_settings_receive.dart | 15 +- .../generated/set_settings_send.dart | 33 +- .../generated/statement_receive.dart | 15 +- lib/basic_api/generated/statement_send.dart | 17 +- .../generated/trading_durations_receive.dart | 15 +- .../generated/trading_durations_send.dart | 23 +- ...rading_platform_asset_listing_receive.dart | 72 + .../trading_platform_asset_listing_send.dart | 97 + ...latform_investor_password_change_send.dart | 11 +- .../trading_platform_new_account_receive.dart | 15 +- .../trading_platform_new_account_send.dart | 13 +- .../generated/wallet_migration_receive.dart | 61 + .../generated/wallet_migration_send.dart | 52 + .../helper/response_mapper.helper.dart | 9 +- .../connection/api_manager/mock_api.dart | 12 + .../account/get_account_types_response.dart | 153 ++ .../account/new_account_wallet_response.dart | 16 + .../cashier/cashier_payments_response.dart | 27 + .../common/website_status_response.dart | 5 + .../mock_data/wallet_migration_response.dart | 42 + .../get_account_types_test.dart | 75 + .../new_account_wallet_test.dart | 31 + .../wallet_migration_test.dart | 63 + test/api/cashier/cashier_payments_test.dart | 30 + .../common/asset_index/asset_index_test.dart | 3 +- .../common/trading/trading_duration_test.dart | 2 +- test/api/mt5/mt5_account_test.dart | 2 +- 80 files changed, 5146 insertions(+), 2883 deletions(-) create mode 100644 lib/api/response/cashier_payments_response_extended.dart create mode 100644 lib/api/response/get_account_types_response_extended.dart create mode 100644 lib/api/response/new_account_wallet_response_extended.dart create mode 100644 lib/api/response/trading_platform_asset_listing_response_result.dart create mode 100644 lib/api/response/wallet_migration_response_extended.dart create mode 100644 lib/api/response/wallet_migration_response_result.dart create mode 100644 lib/basic_api/generated/methods/trading_platform_asset_listing_receive_methods.json create mode 100644 lib/basic_api/generated/methods/wallet_migration_receive_methods.json create mode 100644 lib/basic_api/generated/trading_platform_asset_listing_receive.dart create mode 100644 lib/basic_api/generated/trading_platform_asset_listing_send.dart create mode 100644 lib/basic_api/generated/wallet_migration_receive.dart create mode 100644 lib/basic_api/generated/wallet_migration_send.dart create mode 100644 lib/services/connection/api_manager/mock_data/account/get_account_types_response.dart create mode 100644 lib/services/connection/api_manager/mock_data/account/new_account_wallet_response.dart create mode 100644 lib/services/connection/api_manager/mock_data/cashier/cashier_payments_response.dart create mode 100644 lib/services/connection/api_manager/mock_data/wallet_migration_response.dart create mode 100644 test/api/account/get_account_types/get_account_types_test.dart create mode 100644 test/api/account/new_account_wallet/new_account_wallet_test.dart create mode 100644 test/api/account/wallet_migration/wallet_migration_test.dart create mode 100644 test/api/cashier/cashier_payments_test.dart diff --git a/lib/api/models/enums.dart b/lib/api/models/enums.dart index 388a6e1a2f..9e5ee5b304 100644 --- a/lib/api/models/enums.dart +++ b/lib/api/models/enums.dart @@ -319,7 +319,10 @@ enum ForgetStreamType { transaction, /// Website status - websiteStatus + websiteStatus, + + /// Cashier payments. + cashierPayments, } /// Contract types diff --git a/lib/api/response/authorize_response_result.dart b/lib/api/response/authorize_response_result.dart index 9e844223e2..555276e7f6 100644 --- a/lib/api/response/authorize_response_result.dart +++ b/lib/api/response/authorize_response_result.dart @@ -25,10 +25,8 @@ abstract class AuthorizeResponseModel { class AuthorizeResponse extends AuthorizeResponseModel { /// Initializes Authorize response class. const AuthorizeResponse({ - Authorize? authorize, - }) : super( - authorize: authorize, - ); + super.authorize, + }); /// Creates an instance from JSON. factory AuthorizeResponse.fromJson( @@ -93,17 +91,41 @@ class AuthorizeResponse extends AuthorizeResponseModel { ); } +/// AccountCategoryEnum mapper. +final Map accountCategoryEnumMapper = + { + "trading": AccountCategoryEnum.trading, + "wallet": AccountCategoryEnum.wallet, +}; + +/// AccountCategory Enum. +enum AccountCategoryEnum { + /// trading. + trading, + + /// wallet. + wallet, +} + /// PlatformEnum mapper. final Map platformEnumMapper = { - "deriv": PlatformEnum.deriv, + "derivez": PlatformEnum.derivez, + "dtrade": PlatformEnum.dtrade, + "dwallet": PlatformEnum.dwallet, "dxtrade": PlatformEnum.dxtrade, "mt5": PlatformEnum.mt5, }; /// Platform Enum. enum PlatformEnum { - /// deriv. - deriv, + /// derivez. + derivez, + + /// dtrade. + dtrade, + + /// dwallet. + dwallet, /// dxtrade. dxtrade, @@ -111,7 +133,6 @@ enum PlatformEnum { /// mt5. mt5, } - /// Authorize model class. abstract class AuthorizeModel { /// Initializes Authorize model class . @@ -125,14 +146,13 @@ abstract class AuthorizeModel { this.isVirtual, this.landingCompanyFullname, this.landingCompanyName, + this.linkedTo, this.localCurrencies, this.loginid, this.preferredLanguage, this.scopes, - this.trading, this.upgradeableLandingCompanies, this.userId, - this.wallet, }); /// List of accounts for current user. @@ -162,6 +182,9 @@ abstract class AuthorizeModel { /// Landing company shortcode the account belongs to. final String? landingCompanyName; + /// Details of the list of Trading accounts linked to the Wallet account. + final List? linkedTo; + /// Currencies in client's residence country final Map? localCurrencies; @@ -174,59 +197,34 @@ abstract class AuthorizeModel { /// Scopes available to the token. final List? scopes; - /// Details of the Trading account. - final AuthorizeTrading? trading; - /// List of landing company shortcodes the account can upgrade to. final List? upgradeableLandingCompanies; /// The internal user ID for this account. final int? userId; - - /// Details of the Wallet account. - final AuthorizeWallet? wallet; } /// Authorize class. class Authorize extends AuthorizeModel { /// Initializes Authorize class. const Authorize({ - List? accountList, - double? balance, - String? country, - String? currency, - String? email, - String? fullname, - bool? isVirtual, - String? landingCompanyFullname, - String? landingCompanyName, - Map? localCurrencies, - String? loginid, - String? preferredLanguage, - List? scopes, - AuthorizeTrading? trading, - List? upgradeableLandingCompanies, - int? userId, - AuthorizeWallet? wallet, - }) : super( - accountList: accountList, - balance: balance, - country: country, - currency: currency, - email: email, - fullname: fullname, - isVirtual: isVirtual, - landingCompanyFullname: landingCompanyFullname, - landingCompanyName: landingCompanyName, - localCurrencies: localCurrencies, - loginid: loginid, - preferredLanguage: preferredLanguage, - scopes: scopes, - trading: trading, - upgradeableLandingCompanies: upgradeableLandingCompanies, - userId: userId, - wallet: wallet, - ); + super.accountList, + super.balance, + super.country, + super.currency, + super.email, + super.fullname, + super.isVirtual, + super.landingCompanyFullname, + super.landingCompanyName, + super.linkedTo, + super.localCurrencies, + super.loginid, + super.preferredLanguage, + super.scopes, + super.upgradeableLandingCompanies, + super.userId, + }); /// Creates an instance from JSON. factory Authorize.fromJson(Map json) => Authorize( @@ -245,6 +243,13 @@ class Authorize extends AuthorizeModel { isVirtual: getBool(json['is_virtual']), landingCompanyFullname: json['landing_company_fullname'], landingCompanyName: json['landing_company_name'], + linkedTo: json['linked_to'] == null + ? null + : List.from( + json['linked_to']?.map( + (dynamic item) => AuthorizeLinkedToItem.fromJson(item), + ), + ), localCurrencies: json['local_currencies'] == null ? null : Map.fromEntries(json[ @@ -263,9 +268,6 @@ class Authorize extends AuthorizeModel { (dynamic item) => item, ), ), - trading: json['trading'] == null - ? null - : AuthorizeTrading.fromJson(json['trading']), upgradeableLandingCompanies: json['upgradeable_landing_companies'] == null ? null @@ -275,9 +277,6 @@ class Authorize extends AuthorizeModel { ), ), userId: json['user_id'], - wallet: json['wallet'] == null - ? null - : AuthorizeWallet.fromJson(json['wallet']), ); /// Converts an instance to JSON. @@ -299,6 +298,13 @@ class Authorize extends AuthorizeModel { resultMap['is_virtual'] = isVirtual; resultMap['landing_company_fullname'] = landingCompanyFullname; resultMap['landing_company_name'] = landingCompanyName; + if (linkedTo != null) { + resultMap['linked_to'] = linkedTo! + .map( + (AuthorizeLinkedToItem item) => item.toJson(), + ) + .toList(); + } resultMap['local_currencies'] = localCurrencies; resultMap['loginid'] = loginid; resultMap['preferred_language'] = preferredLanguage; @@ -309,9 +315,6 @@ class Authorize extends AuthorizeModel { ) .toList(); } - if (trading != null) { - resultMap['trading'] = trading!.toJson(); - } if (upgradeableLandingCompanies != null) { resultMap['upgradeable_landing_companies'] = upgradeableLandingCompanies! .map( @@ -320,9 +323,6 @@ class Authorize extends AuthorizeModel { .toList(); } resultMap['user_id'] = userId; - if (wallet != null) { - resultMap['wallet'] = wallet!.toJson(); - } return resultMap; } @@ -338,14 +338,13 @@ class Authorize extends AuthorizeModel { bool? isVirtual, String? landingCompanyFullname, String? landingCompanyName, + List? linkedTo, Map? localCurrencies, String? loginid, String? preferredLanguage, List? scopes, - AuthorizeTrading? trading, List? upgradeableLandingCompanies, int? userId, - AuthorizeWallet? wallet, }) => Authorize( accountList: accountList ?? this.accountList, @@ -358,22 +357,21 @@ class Authorize extends AuthorizeModel { landingCompanyFullname: landingCompanyFullname ?? this.landingCompanyFullname, landingCompanyName: landingCompanyName ?? this.landingCompanyName, + linkedTo: linkedTo ?? this.linkedTo, localCurrencies: localCurrencies ?? this.localCurrencies, loginid: loginid ?? this.loginid, preferredLanguage: preferredLanguage ?? this.preferredLanguage, scopes: scopes ?? this.scopes, - trading: trading ?? this.trading, upgradeableLandingCompanies: upgradeableLandingCompanies ?? this.upgradeableLandingCompanies, userId: userId ?? this.userId, - wallet: wallet ?? this.wallet, ); } - /// Account list item model class. abstract class AccountListItemModel { /// Initializes Account list item model class . const AccountListItemModel({ + this.accountCategory, this.accountType, this.createdAt, this.currency, @@ -381,11 +379,13 @@ abstract class AccountListItemModel { this.isDisabled, this.isVirtual, this.landingCompanyName, + this.linkedTo, this.loginid, - this.trading, - this.wallet, }); + /// Account category. + final AccountCategoryEnum? accountCategory; + /// Account type. final String? accountType; @@ -407,46 +407,35 @@ abstract class AccountListItemModel { /// Landing company shortcode the account belongs to. final String? landingCompanyName; + /// Details of the list of Trading accounts linked to the Wallet account. + final List? linkedTo; + /// The account ID of specified account. final String? loginid; - - /// Details of the Trading account. - final Trading? trading; - - /// Details of the Wallet account. - final Wallet? wallet; } /// Account list item class. class AccountListItem extends AccountListItemModel { /// Initializes Account list item class. const AccountListItem({ - String? accountType, - DateTime? createdAt, - String? currency, - DateTime? excludedUntil, - bool? isDisabled, - bool? isVirtual, - String? landingCompanyName, - String? loginid, - Trading? trading, - Wallet? wallet, - }) : super( - accountType: accountType, - createdAt: createdAt, - currency: currency, - excludedUntil: excludedUntil, - isDisabled: isDisabled, - isVirtual: isVirtual, - landingCompanyName: landingCompanyName, - loginid: loginid, - trading: trading, - wallet: wallet, - ); + super.accountCategory, + super.accountType, + super.createdAt, + super.currency, + super.excludedUntil, + super.isDisabled, + super.isVirtual, + super.landingCompanyName, + super.linkedTo, + super.loginid, + }); /// Creates an instance from JSON. factory AccountListItem.fromJson(Map json) => AccountListItem( + accountCategory: json['account_category'] == null + ? null + : accountCategoryEnumMapper[json['account_category']], accountType: json['account_type'], createdAt: getDateTime(json['created_at']), currency: json['currency'], @@ -454,16 +443,24 @@ class AccountListItem extends AccountListItemModel { isDisabled: getBool(json['is_disabled']), isVirtual: getBool(json['is_virtual']), landingCompanyName: json['landing_company_name'], + linkedTo: json['linked_to'] == null + ? null + : List.from( + json['linked_to']?.map( + (dynamic item) => LinkedToItem.fromJson(item), + ), + ), loginid: json['loginid'], - trading: - json['trading'] == null ? null : Trading.fromJson(json['trading']), - wallet: json['wallet'] == null ? null : Wallet.fromJson(json['wallet']), ); /// Converts an instance to JSON. Map toJson() { final Map resultMap = {}; + resultMap['account_category'] = accountCategoryEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == accountCategory) + .key; resultMap['account_type'] = accountType; resultMap['created_at'] = getSecondsSinceEpochDateTime(createdAt); resultMap['currency'] = currency; @@ -471,19 +468,21 @@ class AccountListItem extends AccountListItemModel { resultMap['is_disabled'] = isDisabled; resultMap['is_virtual'] = isVirtual; resultMap['landing_company_name'] = landingCompanyName; - resultMap['loginid'] = loginid; - if (trading != null) { - resultMap['trading'] = trading!.toJson(); - } - if (wallet != null) { - resultMap['wallet'] = wallet!.toJson(); + if (linkedTo != null) { + resultMap['linked_to'] = linkedTo! + .map( + (LinkedToItem item) => item.toJson(), + ) + .toList(); } + resultMap['loginid'] = loginid; return resultMap; } /// Creates a copy of instance with given parameters. AccountListItem copyWith({ + AccountCategoryEnum? accountCategory, String? accountType, DateTime? createdAt, String? currency, @@ -491,11 +490,11 @@ class AccountListItem extends AccountListItemModel { bool? isDisabled, bool? isVirtual, String? landingCompanyName, + List? linkedTo, String? loginid, - Trading? trading, - Wallet? wallet, }) => AccountListItem( + accountCategory: accountCategory ?? this.accountCategory, accountType: accountType ?? this.accountType, createdAt: createdAt ?? this.createdAt, currency: currency ?? this.currency, @@ -503,279 +502,91 @@ class AccountListItem extends AccountListItemModel { isDisabled: isDisabled ?? this.isDisabled, isVirtual: isVirtual ?? this.isVirtual, landingCompanyName: landingCompanyName ?? this.landingCompanyName, - loginid: loginid ?? this.loginid, - trading: trading ?? this.trading, - wallet: wallet ?? this.wallet, - ); -} - -/// Trading model class. -abstract class TradingModel { - /// Initializes Trading model class . - const TradingModel({ - this.linkedTo, - }); - - /// Details of the Wallet account linked to the Trading account. - final List? linkedTo; -} - -/// Trading class. -class Trading extends TradingModel { - /// Initializes Trading class. - const Trading({ - List? linkedTo, - }) : super( - linkedTo: linkedTo, - ); - - /// Creates an instance from JSON. - factory Trading.fromJson(Map json) => Trading( - linkedTo: json['linked_to'] == null - ? null - : List.from( - json['linked_to']?.map( - (dynamic item) => LinkedToItem.fromJson(item), - ), - ), - ); - - /// Converts an instance to JSON. - Map toJson() { - final Map resultMap = {}; - - if (linkedTo != null) { - resultMap['linked_to'] = linkedTo! - .map( - (LinkedToItem item) => item.toJson(), - ) - .toList(); - } - - return resultMap; - } - - /// Creates a copy of instance with given parameters. - Trading copyWith({ - List? linkedTo, - }) => - Trading( linkedTo: linkedTo ?? this.linkedTo, + loginid: loginid ?? this.loginid, ); } - /// Linked to item model class. abstract class LinkedToItemModel { /// Initializes Linked to item model class . const LinkedToItemModel({ - this.accountId, - this.balance, - this.currency, - this.paymentMethod, + this.loginid, + this.platform, }); - /// Wallet account ID. - final String? accountId; - - /// Wallet account balance. - final String? balance; - - /// Wallet account currency. - final String? currency; + /// Account ID. + final String? loginid; - /// Wallet account payment method. - final String? paymentMethod; + /// Account platform name. + final PlatformEnum? platform; } /// Linked to item class. class LinkedToItem extends LinkedToItemModel { /// Initializes Linked to item class. const LinkedToItem({ - String? accountId, - String? balance, - String? currency, - String? paymentMethod, - }) : super( - accountId: accountId, - balance: balance, - currency: currency, - paymentMethod: paymentMethod, - ); + super.loginid, + super.platform, + }); /// Creates an instance from JSON. factory LinkedToItem.fromJson(Map json) => LinkedToItem( - accountId: json['account_id'], - balance: json['balance'], - currency: json['currency'], - paymentMethod: json['payment_method'], + loginid: json['loginid'], + platform: json['platform'] == null + ? null + : platformEnumMapper[json['platform']], ); /// Converts an instance to JSON. Map toJson() { final Map resultMap = {}; - resultMap['account_id'] = accountId; - resultMap['balance'] = balance; - resultMap['currency'] = currency; - resultMap['payment_method'] = paymentMethod; + resultMap['loginid'] = loginid; + resultMap['platform'] = platformEnumMapper.entries + .firstWhere( + (MapEntry entry) => entry.value == platform) + .key; return resultMap; } /// Creates a copy of instance with given parameters. LinkedToItem copyWith({ - String? accountId, - String? balance, - String? currency, - String? paymentMethod, + String? loginid, + PlatformEnum? platform, }) => LinkedToItem( - accountId: accountId ?? this.accountId, - balance: balance ?? this.balance, - currency: currency ?? this.currency, - paymentMethod: paymentMethod ?? this.paymentMethod, - ); -} - -/// Wallet model class. -abstract class WalletModel { - /// Initializes Wallet model class . - const WalletModel({ - this.accountId, - this.balance, - this.currency, - this.linkedTo, - this.paymentMethod, - }); - - /// Wallet account ID. - final String? accountId; - - /// Wallet account balance. - final double? balance; - - /// Wallet account currency. - final String? currency; - - /// Details of the list of Trading accounts linked to the Wallet account. - final List? linkedTo; - - /// Wallet account payment method. - final String? paymentMethod; -} - -/// Wallet class. -class Wallet extends WalletModel { - /// Initializes Wallet class. - const Wallet({ - String? accountId, - double? balance, - String? currency, - List? linkedTo, - String? paymentMethod, - }) : super( - accountId: accountId, - balance: balance, - currency: currency, - linkedTo: linkedTo, - paymentMethod: paymentMethod, - ); - - /// Creates an instance from JSON. - factory Wallet.fromJson(Map json) => Wallet( - accountId: json['account_id'], - balance: getDouble(json['balance']), - currency: json['currency'], - linkedTo: json['linked_to'] == null - ? null - : List.from( - json['linked_to']?.map( - (dynamic item) => WalletLinkedToItem.fromJson(item), - ), - ), - paymentMethod: json['payment_method'], - ); - - /// Converts an instance to JSON. - Map toJson() { - final Map resultMap = {}; - - resultMap['account_id'] = accountId; - resultMap['balance'] = balance; - resultMap['currency'] = currency; - if (linkedTo != null) { - resultMap['linked_to'] = linkedTo! - .map( - (WalletLinkedToItem item) => item.toJson(), - ) - .toList(); - } - resultMap['payment_method'] = paymentMethod; - - return resultMap; - } - - /// Creates a copy of instance with given parameters. - Wallet copyWith({ - String? accountId, - double? balance, - String? currency, - List? linkedTo, - String? paymentMethod, - }) => - Wallet( - accountId: accountId ?? this.accountId, - balance: balance ?? this.balance, - currency: currency ?? this.currency, - linkedTo: linkedTo ?? this.linkedTo, - paymentMethod: paymentMethod ?? this.paymentMethod, + loginid: loginid ?? this.loginid, + platform: platform ?? this.platform, ); } - -/// Wallet linked to item model class. -abstract class WalletLinkedToItemModel { - /// Initializes Wallet linked to item model class . - const WalletLinkedToItemModel({ - this.accountId, - this.balance, - this.currency, +/// Authorize linked to item model class. +abstract class AuthorizeLinkedToItemModel { + /// Initializes Authorize linked to item model class . + const AuthorizeLinkedToItemModel({ + this.loginid, this.platform, }); - /// Trading account ID. - final String? accountId; - - /// Trading account balance. - final String? balance; - - /// Trading account currency. - final String? currency; + /// Account ID. + final String? loginid; - /// Trading account platform name. + /// Account platform name. final PlatformEnum? platform; } -/// Wallet linked to item class. -class WalletLinkedToItem extends WalletLinkedToItemModel { - /// Initializes Wallet linked to item class. - const WalletLinkedToItem({ - String? accountId, - String? balance, - String? currency, - PlatformEnum? platform, - }) : super( - accountId: accountId, - balance: balance, - currency: currency, - platform: platform, - ); +/// Authorize linked to item class. +class AuthorizeLinkedToItem extends AuthorizeLinkedToItemModel { + /// Initializes Authorize linked to item class. + const AuthorizeLinkedToItem({ + super.loginid, + super.platform, + }); /// Creates an instance from JSON. - factory WalletLinkedToItem.fromJson(Map json) => - WalletLinkedToItem( - accountId: json['account_id'], - balance: json['balance'], - currency: json['currency'], + factory AuthorizeLinkedToItem.fromJson(Map json) => + AuthorizeLinkedToItem( + loginid: json['loginid'], platform: json['platform'] == null ? null : platformEnumMapper[json['platform']], @@ -785,9 +596,7 @@ class WalletLinkedToItem extends WalletLinkedToItemModel { Map toJson() { final Map resultMap = {}; - resultMap['account_id'] = accountId; - resultMap['balance'] = balance; - resultMap['currency'] = currency; + resultMap['loginid'] = loginid; resultMap['platform'] = platformEnumMapper.entries .firstWhere( (MapEntry entry) => entry.value == platform) @@ -797,20 +606,15 @@ class WalletLinkedToItem extends WalletLinkedToItemModel { } /// Creates a copy of instance with given parameters. - WalletLinkedToItem copyWith({ - String? accountId, - String? balance, - String? currency, + AuthorizeLinkedToItem copyWith({ + String? loginid, PlatformEnum? platform, }) => - WalletLinkedToItem( - accountId: accountId ?? this.accountId, - balance: balance ?? this.balance, - currency: currency ?? this.currency, + AuthorizeLinkedToItem( + loginid: loginid ?? this.loginid, platform: platform ?? this.platform, ); } - /// Local currencies property model class. abstract class LocalCurrenciesPropertyModel { /// Initializes Local currencies property model class . @@ -826,10 +630,8 @@ abstract class LocalCurrenciesPropertyModel { class LocalCurrenciesProperty extends LocalCurrenciesPropertyModel { /// Initializes Local currencies property class. const LocalCurrenciesProperty({ - required int fractionalDigits, - }) : super( - fractionalDigits: fractionalDigits, - ); + required super.fractionalDigits, + }); /// Creates an instance from JSON. factory LocalCurrenciesProperty.fromJson(Map json) => @@ -854,308 +656,3 @@ class LocalCurrenciesProperty extends LocalCurrenciesPropertyModel { fractionalDigits: fractionalDigits ?? this.fractionalDigits, ); } - -/// Authorize trading model class. -abstract class AuthorizeTradingModel { - /// Initializes Authorize trading model class . - const AuthorizeTradingModel({ - this.linkedTo, - }); - - /// Details of the Wallet account linked to the Trading account. - final List? linkedTo; -} - -/// Authorize trading class. -class AuthorizeTrading extends AuthorizeTradingModel { - /// Initializes Authorize trading class. - const AuthorizeTrading({ - List? linkedTo, - }) : super( - linkedTo: linkedTo, - ); - - /// Creates an instance from JSON. - factory AuthorizeTrading.fromJson(Map json) => - AuthorizeTrading( - linkedTo: json['linked_to'] == null - ? null - : List.from( - json['linked_to']?.map( - (dynamic item) => TradingLinkedToItem.fromJson(item), - ), - ), - ); - - /// Converts an instance to JSON. - Map toJson() { - final Map resultMap = {}; - - if (linkedTo != null) { - resultMap['linked_to'] = linkedTo! - .map( - (TradingLinkedToItem item) => item.toJson(), - ) - .toList(); - } - - return resultMap; - } - - /// Creates a copy of instance with given parameters. - AuthorizeTrading copyWith({ - List? linkedTo, - }) => - AuthorizeTrading( - linkedTo: linkedTo ?? this.linkedTo, - ); -} - -/// Trading linked to item model class. -abstract class TradingLinkedToItemModel { - /// Initializes Trading linked to item model class . - const TradingLinkedToItemModel({ - this.accountId, - this.balance, - this.currency, - this.paymentMethod, - }); - - /// Wallet account ID. - final String? accountId; - - /// Wallet account balance. - final String? balance; - - /// Wallet account currency. - final String? currency; - - /// Wallet account payment method. - final String? paymentMethod; -} - -/// Trading linked to item class. -class TradingLinkedToItem extends TradingLinkedToItemModel { - /// Initializes Trading linked to item class. - const TradingLinkedToItem({ - String? accountId, - String? balance, - String? currency, - String? paymentMethod, - }) : super( - accountId: accountId, - balance: balance, - currency: currency, - paymentMethod: paymentMethod, - ); - - /// Creates an instance from JSON. - factory TradingLinkedToItem.fromJson(Map json) => - TradingLinkedToItem( - accountId: json['account_id'], - balance: json['balance'], - currency: json['currency'], - paymentMethod: json['payment_method'], - ); - - /// Converts an instance to JSON. - Map toJson() { - final Map resultMap = {}; - - resultMap['account_id'] = accountId; - resultMap['balance'] = balance; - resultMap['currency'] = currency; - resultMap['payment_method'] = paymentMethod; - - return resultMap; - } - - /// Creates a copy of instance with given parameters. - TradingLinkedToItem copyWith({ - String? accountId, - String? balance, - String? currency, - String? paymentMethod, - }) => - TradingLinkedToItem( - accountId: accountId ?? this.accountId, - balance: balance ?? this.balance, - currency: currency ?? this.currency, - paymentMethod: paymentMethod ?? this.paymentMethod, - ); -} - -/// Authorize wallet model class. -abstract class AuthorizeWalletModel { - /// Initializes Authorize wallet model class . - const AuthorizeWalletModel({ - this.accountId, - this.balance, - this.currency, - this.linkedTo, - this.paymentMethod, - }); - - /// Wallet account ID. - final String? accountId; - - /// Wallet account balance. - final double? balance; - - /// Wallet account currency. - final String? currency; - - /// Details of the list of Trading accounts linked to the Wallet account. - final List? linkedTo; - - /// Wallet account payment method. - final String? paymentMethod; -} - -/// Authorize wallet class. -class AuthorizeWallet extends AuthorizeWalletModel { - /// Initializes Authorize wallet class. - const AuthorizeWallet({ - String? accountId, - double? balance, - String? currency, - List? linkedTo, - String? paymentMethod, - }) : super( - accountId: accountId, - balance: balance, - currency: currency, - linkedTo: linkedTo, - paymentMethod: paymentMethod, - ); - - /// Creates an instance from JSON. - factory AuthorizeWallet.fromJson(Map json) => - AuthorizeWallet( - accountId: json['account_id'], - balance: getDouble(json['balance']), - currency: json['currency'], - linkedTo: json['linked_to'] == null - ? null - : List.from( - json['linked_to']?.map( - (dynamic item) => WalletLinkedToItem8.fromJson(item), - ), - ), - paymentMethod: json['payment_method'], - ); - - /// Converts an instance to JSON. - Map toJson() { - final Map resultMap = {}; - - resultMap['account_id'] = accountId; - resultMap['balance'] = balance; - resultMap['currency'] = currency; - if (linkedTo != null) { - resultMap['linked_to'] = linkedTo! - .map( - (WalletLinkedToItem8 item) => item.toJson(), - ) - .toList(); - } - resultMap['payment_method'] = paymentMethod; - - return resultMap; - } - - /// Creates a copy of instance with given parameters. - AuthorizeWallet copyWith({ - String? accountId, - double? balance, - String? currency, - List? linkedTo, - String? paymentMethod, - }) => - AuthorizeWallet( - accountId: accountId ?? this.accountId, - balance: balance ?? this.balance, - currency: currency ?? this.currency, - linkedTo: linkedTo ?? this.linkedTo, - paymentMethod: paymentMethod ?? this.paymentMethod, - ); -} - -/// Wallet linked to item8 model class. -abstract class WalletLinkedToItem8Model { - /// Initializes Wallet linked to item8 model class . - const WalletLinkedToItem8Model({ - this.accountId, - this.balance, - this.currency, - this.platform, - }); - - /// Trading account ID. - final String? accountId; - - /// Trading account balance. - final String? balance; - - /// Trading account currency. - final String? currency; - - /// Trading account platform name. - final PlatformEnum? platform; -} - -/// Wallet linked to item8 class. -class WalletLinkedToItem8 extends WalletLinkedToItem8Model { - /// Initializes Wallet linked to item8 class. - const WalletLinkedToItem8({ - String? accountId, - String? balance, - String? currency, - PlatformEnum? platform, - }) : super( - accountId: accountId, - balance: balance, - currency: currency, - platform: platform, - ); - - /// Creates an instance from JSON. - factory WalletLinkedToItem8.fromJson(Map json) => - WalletLinkedToItem8( - accountId: json['account_id'], - balance: json['balance'], - currency: json['currency'], - platform: json['platform'] == null - ? null - : platformEnumMapper[json['platform']], - ); - - /// Converts an instance to JSON. - Map toJson() { - final Map resultMap = {}; - - resultMap['account_id'] = accountId; - resultMap['balance'] = balance; - resultMap['currency'] = currency; - resultMap['platform'] = platformEnumMapper.entries - .firstWhere( - (MapEntry entry) => entry.value == platform) - .key; - - return resultMap; - } - - /// Creates a copy of instance with given parameters. - WalletLinkedToItem8 copyWith({ - String? accountId, - String? balance, - String? currency, - PlatformEnum? platform, - }) => - WalletLinkedToItem8( - accountId: accountId ?? this.accountId, - balance: balance ?? this.balance, - currency: currency ?? this.currency, - platform: platform ?? this.platform, - ); -} diff --git a/lib/api/response/cashier_payments_response_extended.dart b/lib/api/response/cashier_payments_response_extended.dart new file mode 100644 index 0000000000..335f3cd5fc --- /dev/null +++ b/lib/api/response/cashier_payments_response_extended.dart @@ -0,0 +1,99 @@ +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/api/models/enums.dart'; +import 'package:flutter_deriv_api/basic_api/generated/api.dart'; +import 'package:flutter_deriv_api/basic_api/response.dart'; +import 'package:flutter_deriv_api/helpers/helpers.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; +import 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart'; + +import 'cashier_payments_response_result.dart'; +import 'forget_all_response_result.dart'; +import 'forget_response_result.dart'; + +/// The extended version of the [CashierPaymentsResponse] class to implement +/// the API call methods. +class CashierPaymentsResponseExtended extends CashierPaymentsResponse { + static final BaseAPI _api = Injector()(); + + /// Fetches the cashier payments. + static Future fetchCashierPayments({ + required CashierPaymentsRequest request, + }) async { + final CashierPaymentsReceive response = await _api.call(request: request); + + checkException( + response: response, + exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => + BaseAPIException(baseExceptionModel: baseExceptionModel), + ); + + return CashierPaymentsResponse.fromJson( + response.cashierPayments, + response.subscription, + ); + } + + /// Subscribes to the bought contract state specified in [ProposalOpenContractRequest] + /// + /// Throws a [BaseAPIException] if API response contains an error + static Stream subscribeCashierPayment( + CashierPaymentsRequest request, { + RequestCompareFunction? comparePredicate, + }) => + _api + .subscribe(request: request, comparePredicate: comparePredicate)! + .map( + (Response response) { + checkException( + response: response, + exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => + BaseAPIException(baseExceptionModel: baseExceptionModel), + ); + + return response is CashierPaymentsReceive + ? CashierPaymentsResponse.fromJson( + response.cashierPayments, + response.subscription, + ) + : null; + }, + ); + + /// Unsubscribes from cashier payments subscription. + /// + /// Throws a [BaseAPIException] if API response contains an error + Future unsubscribeCashierPayments() async { + if (subscription == null) { + return null; + } + + final ForgetReceive response = + await _api.unsubscribe(subscriptionId: subscription!.id); + + checkException( + response: response, + exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => + BaseAPIException(baseExceptionModel: baseExceptionModel), + ); + + return ForgetResponse.fromJson(response.forget); + } + + /// Unsubscribes all open contract subscriptions. + /// + /// Throws a [BaseAPIException] if API response contains an error + static Future unsubscribeAllCashierPayments() async { + final ForgetAllReceive response = await _api.unsubscribeAll( + method: ForgetStreamType.cashierPayments, + ); + + checkException( + response: response, + exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => + BaseAPIException(baseExceptionModel: baseExceptionModel), + ); + + return ForgetAllResponse.fromJson(response.forgetAll); + } +} diff --git a/lib/api/response/cashier_payments_response_result.dart b/lib/api/response/cashier_payments_response_result.dart index 944787f374..5a7266a601 100644 --- a/lib/api/response/cashier_payments_response_result.dart +++ b/lib/api/response/cashier_payments_response_result.dart @@ -23,12 +23,9 @@ abstract class CashierPaymentsResponseModel { class CashierPaymentsResponse extends CashierPaymentsResponseModel { /// Initializes Cashier payments response class. const CashierPaymentsResponse({ - CashierPayments? cashierPayments, - Subscription? subscription, - }) : super( - cashierPayments: cashierPayments, - subscription: subscription, - ); + super.cashierPayments, + super.subscription, + }); /// Creates an instance from JSON. factory CashierPaymentsResponse.fromJson( @@ -80,6 +77,8 @@ final Map statusCodeEnumMapper = "PERFORMING_BLOCKCHAIN_TXN": StatusCodeEnum.performingBlockchainTxn, "PROCESSING": StatusCodeEnum.processing, "REJECTED": StatusCodeEnum.rejected, + "REVERTED": StatusCodeEnum.reverted, + "REVERTING": StatusCodeEnum.reverting, "SENT": StatusCodeEnum.sent, "VERIFIED": StatusCodeEnum.verified, }; @@ -110,6 +109,12 @@ enum StatusCodeEnum { /// REJECTED. rejected, + /// REVERTED. + reverted, + + /// REVERTING. + reverting, + /// SENT. sent, @@ -147,10 +152,8 @@ abstract class CashierPaymentsModel { class CashierPayments extends CashierPaymentsModel { /// Initializes Cashier payments class. const CashierPayments({ - List? crypto, - }) : super( - crypto: crypto, - ); + super.crypto, + }); /// Creates an instance from JSON. factory CashierPayments.fromJson(Map json) => @@ -198,6 +201,7 @@ abstract class CryptoItemModel { required this.addressUrl, required this.addressHash, this.amount, + this.confirmations, this.isValidToCancel, this.submitDate, this.transactionHash, @@ -210,7 +214,7 @@ abstract class CryptoItemModel { /// The status message of the transaction. final String statusMessage; - /// The status code of the transaction. Possible values for **deposit:** `PENDING|CONFIRMED|ERROR`, possible values for **withdrawal:** `LOCKED|VERIFIED|REJECTED|PERFORMING_BLOCKCHAIN_TXN|PROCESSING|SENT|ERROR|CANCELLED`. + /// The status code of the transaction. Possible values for **deposit:** `PENDING|CONFIRMED|ERROR`, possible values for **withdrawal:** `LOCKED|VERIFIED|REJECTED|PERFORMING_BLOCKCHAIN_TXN|PROCESSING|SENT|ERROR|CANCELLED|REVERTING|REVERTED`. final StatusCodeEnum statusCode; /// The unique identifier for the transaction. @@ -225,6 +229,9 @@ abstract class CryptoItemModel { /// [Optional] The transaction amount. Not present when deposit transaction still unconfirmed. final double? amount; + /// [Optional] The number of confirmations for pending deposits or withdrawals + final int? confirmations; + /// [Optional] Boolean value: `true` or `false`, indicating whether the transaction can be cancelled. Only applicable for `withdrawal` transactions. final bool? isValidToCancel; @@ -242,30 +249,19 @@ abstract class CryptoItemModel { class CryptoItem extends CryptoItemModel { /// Initializes Crypto item class. const CryptoItem({ - required String addressHash, - required String addressUrl, - required String id, - required StatusCodeEnum statusCode, - required String statusMessage, - required TransactionTypeEnum transactionType, - double? amount, - bool? isValidToCancel, - DateTime? submitDate, - String? transactionHash, - String? transactionUrl, - }) : super( - addressHash: addressHash, - addressUrl: addressUrl, - id: id, - statusCode: statusCode, - statusMessage: statusMessage, - transactionType: transactionType, - amount: amount, - isValidToCancel: isValidToCancel, - submitDate: submitDate, - transactionHash: transactionHash, - transactionUrl: transactionUrl, - ); + required super.addressHash, + required super.addressUrl, + required super.id, + required super.statusCode, + required super.statusMessage, + required super.transactionType, + super.amount, + super.confirmations, + super.isValidToCancel, + super.submitDate, + super.transactionHash, + super.transactionUrl, + }); /// Creates an instance from JSON. factory CryptoItem.fromJson(Map json) => CryptoItem( @@ -276,6 +272,7 @@ class CryptoItem extends CryptoItemModel { statusMessage: json['status_message'], transactionType: transactionTypeEnumMapper[json['transaction_type']]!, amount: getDouble(json['amount']), + confirmations: json['confirmations'], isValidToCancel: getBool(json['is_valid_to_cancel']), submitDate: getDateTime(json['submit_date']), transactionHash: json['transaction_hash'], @@ -299,6 +296,7 @@ class CryptoItem extends CryptoItemModel { entry.value == transactionType) .key; resultMap['amount'] = amount; + resultMap['confirmations'] = confirmations; resultMap['is_valid_to_cancel'] = isValidToCancel; resultMap['submit_date'] = getSecondsSinceEpochDateTime(submitDate); resultMap['transaction_hash'] = transactionHash; @@ -316,6 +314,7 @@ class CryptoItem extends CryptoItemModel { String? statusMessage, TransactionTypeEnum? transactionType, double? amount, + int? confirmations, bool? isValidToCancel, DateTime? submitDate, String? transactionHash, @@ -329,6 +328,7 @@ class CryptoItem extends CryptoItemModel { statusMessage: statusMessage ?? this.statusMessage, transactionType: transactionType ?? this.transactionType, amount: amount ?? this.amount, + confirmations: confirmations ?? this.confirmations, isValidToCancel: isValidToCancel ?? this.isValidToCancel, submitDate: submitDate ?? this.submitDate, transactionHash: transactionHash ?? this.transactionHash, @@ -350,10 +350,8 @@ abstract class SubscriptionModel { class Subscription extends SubscriptionModel { /// Initializes Subscription class. const Subscription({ - required String id, - }) : super( - id: id, - ); + required super.id, + }); /// Creates an instance from JSON. factory Subscription.fromJson(Map json) => Subscription( diff --git a/lib/api/response/get_account_types_response_extended.dart b/lib/api/response/get_account_types_response_extended.dart new file mode 100644 index 0000000000..6d18f1ead6 --- /dev/null +++ b/lib/api/response/get_account_types_response_extended.dart @@ -0,0 +1,28 @@ +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/api/response/get_account_status_response_result.dart'; +import 'package:flutter_deriv_api/api/response/get_account_types_response_result.dart'; +import 'package:flutter_deriv_api/basic_api/generated/api.dart'; +import 'package:flutter_deriv_api/helpers/helpers.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; + +/// The extended version of the [GetAccountStatusResponse] class to implement +/// the API call methods. +class GetAccountTypesResponseExtended extends GetAccountStatusResponse { + static final BaseAPI _api = Injector()(); + + /// Gets the account types user can register for. + static Future fetchAccountTypes({ + required GetAccountTypesRequest request, + }) async { + final GetAccountTypesReceive response = await _api.call(request: request); + + checkException( + response: response, + exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => + BaseAPIException(baseExceptionModel: baseExceptionModel), + ); + + return GetAccountTypesResponse.fromJson(response.getAccountTypes); + } +} diff --git a/lib/api/response/get_account_types_response_result.dart b/lib/api/response/get_account_types_response_result.dart index 96f3811415..e582c3a1a7 100644 --- a/lib/api/response/get_account_types_response_result.dart +++ b/lib/api/response/get_account_types_response_result.dart @@ -19,10 +19,8 @@ abstract class GetAccountTypesResponseModel { class GetAccountTypesResponse extends GetAccountTypesResponseModel { /// Initializes Get account types response class. const GetAccountTypesResponse({ - GetAccountTypes? getAccountTypes, - }) : super( - getAccountTypes: getAccountTypes, - ); + super.getAccountTypes, + }); /// Creates an instance from JSON. factory GetAccountTypesResponse.fromJson( @@ -59,408 +57,184 @@ abstract class GetAccountTypesModel { const GetAccountTypesModel({ required this.wallet, required this.trading, - this.binary, - this.derivx, - this.mt5, }); - /// Details of the wallet accounts. - final Wallet wallet; - - /// Trading accounts can trade in the Deriv website and apps - final Trading trading; - - /// Traditional accounts of binary.com - final Binary? binary; - - /// The accuonts created for the DerivX platform - final Derivx? derivx; + /// Wallet accounts types that are available to create or link to + final Map wallet; - /// Accounts created for the MT5 platfrom - final Mt5? mt5; + /// Trading account types that are available to create or link to + final Map trading; } /// Get account types class. class GetAccountTypes extends GetAccountTypesModel { /// Initializes Get account types class. const GetAccountTypes({ - required Trading trading, - required Wallet wallet, - Binary? binary, - Derivx? derivx, - Mt5? mt5, - }) : super( - trading: trading, - wallet: wallet, - binary: binary, - derivx: derivx, - mt5: mt5, - ); + required super.trading, + required super.wallet, + }); /// Creates an instance from JSON. factory GetAccountTypes.fromJson(Map json) => GetAccountTypes( - trading: Trading.fromJson(json['trading']), - wallet: Wallet.fromJson(json['wallet']), - binary: json['binary'] == null ? null : Binary.fromJson(json['binary']), - derivx: json['derivx'] == null ? null : Derivx.fromJson(json['derivx']), - mt5: json['mt5'] == null ? null : Mt5.fromJson(json['mt5']), + trading: Map.fromEntries(json['trading'] + .entries + .map>( + (MapEntry entry) => + MapEntry( + entry.key, TradingProperty.fromJson(entry.value)))), + wallet: Map.fromEntries(json['wallet'] + .entries + .map>( + (MapEntry entry) => + MapEntry( + entry.key, WalletProperty.fromJson(entry.value)))), ); /// Converts an instance to JSON. Map toJson() { final Map resultMap = {}; - resultMap['trading'] = trading.toJson(); - - resultMap['wallet'] = wallet.toJson(); - - if (binary != null) { - resultMap['binary'] = binary!.toJson(); - } - if (derivx != null) { - resultMap['derivx'] = derivx!.toJson(); - } - if (mt5 != null) { - resultMap['mt5'] = mt5!.toJson(); - } + resultMap['trading'] = trading; + resultMap['wallet'] = wallet; return resultMap; } /// Creates a copy of instance with given parameters. GetAccountTypes copyWith({ - Trading? trading, - Wallet? wallet, - Binary? binary, - Derivx? derivx, - Mt5? mt5, + Map? trading, + Map? wallet, }) => GetAccountTypes( trading: trading ?? this.trading, wallet: wallet ?? this.wallet, - binary: binary ?? this.binary, - derivx: derivx ?? this.derivx, - mt5: mt5 ?? this.mt5, - ); -} -/// Trading model class. -abstract class TradingModel { - /// Initializes Trading model class . - const TradingModel({ - required this.real, - required this.demo, - }); - - /// Real trading acocounts - final Map real; - - /// Demo trading account - final Map demo; -} - -/// Trading class. -class Trading extends TradingModel { - /// Initializes Trading class. - const Trading({ - required Map demo, - required Map real, - }) : super( - demo: demo, - real: real, - ); - - /// Creates an instance from JSON. - factory Trading.fromJson(Map json) => Trading( - demo: json['demo'], - real: json['real'], - ); - - /// Converts an instance to JSON. - Map toJson() { - final Map resultMap = {}; - - resultMap['demo'] = demo; - resultMap['real'] = real; - - return resultMap; - } - - /// Creates a copy of instance with given parameters. - Trading copyWith({ - Map? demo, - Map? real, - }) => - Trading( - demo: demo ?? this.demo, - real: real ?? this.real, ); } -/// Wallet model class. -abstract class WalletModel { - /// Initializes Wallet model class . - const WalletModel({ - required this.paymentagentClient, - required this.paymentagent, - required this.p2p, - required this.fiat, - required this.demo, - required this.crypto, - required this.affiliate, +/// Trading property model class. +abstract class TradingPropertyModel { + /// Initializes Trading property model class . + const TradingPropertyModel({ + required this.linkableWalletTypes, + required this.linkableToDifferentCurrency, + required this.allowedWalletCurrencies, }); - /// Can receive funds from a payment agent - final Map paymentagentClient; - - /// Can act as a payment agent to other clients - final Map paymentagent; - - /// Can buy/sell using P2P exchanges - final Map p2p; - - /// Can deposit and withdraw through the primary cashier - final Map fiat; + /// Wallet types that this trading account can be linked to. + final List linkableWalletTypes; - /// Demo wallets, linkable to demo accounts only - final Map demo; + /// Can this trading account linked to another currency after opening + final bool linkableToDifferentCurrency; - /// Can deposit and withdraw through the crypto-cashier - final Map crypto; - - /// Can receive affiliate commissions - final Map affiliate; + /// Wallet currencies allowed for this trading account + final List allowedWalletCurrencies; } -/// Wallet class. -class Wallet extends WalletModel { - /// Initializes Wallet class. - const Wallet({ - required Map affiliate, - required Map crypto, - required Map demo, - required Map fiat, - required Map p2p, - required Map paymentagent, - required Map paymentagentClient, - }) : super( - affiliate: affiliate, - crypto: crypto, - demo: demo, - fiat: fiat, - p2p: p2p, - paymentagent: paymentagent, - paymentagentClient: paymentagentClient, - ); - - /// Creates an instance from JSON. - factory Wallet.fromJson(Map json) => Wallet( - affiliate: json['affiliate'], - crypto: json['crypto'], - demo: json['demo'], - fiat: json['fiat'], - p2p: json['p2p'], - paymentagent: json['paymentagent'], - paymentagentClient: json['paymentagent_client'], - ); - - /// Converts an instance to JSON. - Map toJson() { - final Map resultMap = {}; - - resultMap['affiliate'] = affiliate; - resultMap['crypto'] = crypto; - resultMap['demo'] = demo; - resultMap['fiat'] = fiat; - resultMap['p2p'] = p2p; - resultMap['paymentagent'] = paymentagent; - resultMap['paymentagent_client'] = paymentagentClient; - - return resultMap; - } - - /// Creates a copy of instance with given parameters. - Wallet copyWith({ - Map? affiliate, - Map? crypto, - Map? demo, - Map? fiat, - Map? p2p, - Map? paymentagent, - Map? paymentagentClient, - }) => - Wallet( - affiliate: affiliate ?? this.affiliate, - crypto: crypto ?? this.crypto, - demo: demo ?? this.demo, - fiat: fiat ?? this.fiat, - p2p: p2p ?? this.p2p, - paymentagent: paymentagent ?? this.paymentagent, - paymentagentClient: paymentagentClient ?? this.paymentagentClient, - ); -} -/// Binary model class. -abstract class BinaryModel { - /// Initializes Binary model class . - const BinaryModel({ - required this.real, - required this.demo, +/// Trading property class. +class TradingProperty extends TradingPropertyModel { + /// Initializes Trading property class. + const TradingProperty({ + required super.allowedWalletCurrencies, + required super.linkableToDifferentCurrency, + required super.linkableWalletTypes, }); - /// Real acocount - final Map real; - - /// Demo account - final Map demo; -} - -/// Binary class. -class Binary extends BinaryModel { - /// Initializes Binary class. - const Binary({ - required Map demo, - required Map real, - }) : super( - demo: demo, - real: real, - ); - /// Creates an instance from JSON. - factory Binary.fromJson(Map json) => Binary( - demo: json['demo'], - real: json['real'], + factory TradingProperty.fromJson(Map json) => + TradingProperty( + allowedWalletCurrencies: List.from( + json['allowed_wallet_currencies'].map( + (dynamic item) => item, + ), + ), + linkableToDifferentCurrency: + getBool(json['linkable_to_different_currency'])!, + linkableWalletTypes: List.from( + json['linkable_wallet_types'].map( + (dynamic item) => item, + ), + ), ); /// Converts an instance to JSON. Map toJson() { final Map resultMap = {}; - resultMap['demo'] = demo; - resultMap['real'] = real; + resultMap['allowed_wallet_currencies'] = allowedWalletCurrencies + .map( + (String item) => item, + ) + .toList(); - return resultMap; - } - - /// Creates a copy of instance with given parameters. - Binary copyWith({ - Map? demo, - Map? real, - }) => - Binary( - demo: demo ?? this.demo, - real: real ?? this.real, - ); -} -/// Derivx model class. -abstract class DerivxModel { - /// Initializes Derivx model class . - const DerivxModel({ - required this.real, - required this.demo, - }); - - /// Real acocount - final Map real; - - /// Demo account - final Map demo; -} - -/// Derivx class. -class Derivx extends DerivxModel { - /// Initializes Derivx class. - const Derivx({ - required Map demo, - required Map real, - }) : super( - demo: demo, - real: real, - ); - - /// Creates an instance from JSON. - factory Derivx.fromJson(Map json) => Derivx( - demo: json['demo'], - real: json['real'], - ); - - /// Converts an instance to JSON. - Map toJson() { - final Map resultMap = {}; - - resultMap['demo'] = demo; - resultMap['real'] = real; + resultMap['linkable_to_different_currency'] = linkableToDifferentCurrency; + resultMap['linkable_wallet_types'] = linkableWalletTypes + .map( + (String item) => item, + ) + .toList(); return resultMap; } /// Creates a copy of instance with given parameters. - Derivx copyWith({ - Map? demo, - Map? real, + TradingProperty copyWith({ + List? allowedWalletCurrencies, + bool? linkableToDifferentCurrency, + List? linkableWalletTypes, }) => - Derivx( - demo: demo ?? this.demo, - real: real ?? this.real, + TradingProperty( + allowedWalletCurrencies: + allowedWalletCurrencies ?? this.allowedWalletCurrencies, + linkableToDifferentCurrency: + linkableToDifferentCurrency ?? this.linkableToDifferentCurrency, + linkableWalletTypes: linkableWalletTypes ?? this.linkableWalletTypes, ); } -/// Mt5 model class. -abstract class Mt5Model { - /// Initializes Mt5 model class . - const Mt5Model({ - required this.gaming, - required this.financial, - required this.demo, +/// Wallet property model class. +abstract class WalletPropertyModel { + /// Initializes Wallet property model class . + const WalletPropertyModel({ + required this.currencies, }); - /// MT5 trading with synthetic indices - final Map gaming; - - /// MT5 trading with finacial indices - final Map financial; - - /// Demo account - final Map demo; + /// Allowed currencies for creating accounts of this type; used or disallowed currencies are not listed. + final List currencies; } -/// Mt5 class. -class Mt5 extends Mt5Model { - /// Initializes Mt5 class. - const Mt5({ - required Map demo, - required Map financial, - required Map gaming, - }) : super( - demo: demo, - financial: financial, - gaming: gaming, - ); +/// Wallet property class. +class WalletProperty extends WalletPropertyModel { + /// Initializes Wallet property class. + const WalletProperty({ + required super.currencies, + }); /// Creates an instance from JSON. - factory Mt5.fromJson(Map json) => Mt5( - demo: json['demo'], - financial: json['financial'], - gaming: json['gaming'], + factory WalletProperty.fromJson(Map json) => WalletProperty( + currencies: List.from( + json['currencies'].map( + (dynamic item) => item, + ), + ), ); /// Converts an instance to JSON. Map toJson() { final Map resultMap = {}; - resultMap['demo'] = demo; - resultMap['financial'] = financial; - resultMap['gaming'] = gaming; + resultMap['currencies'] = currencies + .map( + (String item) => item, + ) + .toList(); return resultMap; } /// Creates a copy of instance with given parameters. - Mt5 copyWith({ - Map? demo, - Map? financial, - Map? gaming, + WalletProperty copyWith({ + List? currencies, }) => - Mt5( - demo: demo ?? this.demo, - financial: financial ?? this.financial, - gaming: gaming ?? this.gaming, + WalletProperty( + currencies: currencies ?? this.currencies, ); } diff --git a/lib/api/response/get_financial_assessment_response_result.dart b/lib/api/response/get_financial_assessment_response_result.dart index e19869c19e..0829e6d906 100644 --- a/lib/api/response/get_financial_assessment_response_result.dart +++ b/lib/api/response/get_financial_assessment_response_result.dart @@ -26,10 +26,8 @@ class GetFinancialAssessmentResponse extends GetFinancialAssessmentResponseModel { /// Initializes Get financial assessment response class. const GetFinancialAssessmentResponse({ - GetFinancialAssessment? getFinancialAssessment, - }) : super( - getFinancialAssessment: getFinancialAssessment, - ); + super.getFinancialAssessment, + }); /// Creates an instance from JSON. factory GetFinancialAssessmentResponse.fromJson( @@ -84,7 +82,6 @@ class GetFinancialAssessmentResponse getFinancialAssessment ?? this.getFinancialAssessment, ); } - /// Get financial assessment model class. abstract class GetFinancialAssessmentModel { /// Initializes Get financial assessment model class . @@ -92,7 +89,10 @@ abstract class GetFinancialAssessmentModel { this.accountTurnover, this.binaryOptionsTradingExperience, this.binaryOptionsTradingFrequency, + this.cfdExperience, + this.cfdFrequency, this.cfdScore, + this.cfdTradingDefinition, this.cfdTradingExperience, this.cfdTradingFrequency, this.commoditiesTradingExperience, @@ -107,16 +107,23 @@ abstract class GetFinancialAssessmentModel { this.incomeSource, this.indicesTradingExperience, this.indicesTradingFrequency, + this.leverageImpactTrading, + this.leverageTradingHighRiskStopLoss, this.netIncome, this.occupation, this.otherDerivativesTradingExperience, this.otherDerivativesTradingFrequency, this.otherInstrumentsTradingExperience, this.otherInstrumentsTradingFrequency, + this.requiredInitialMargin, + this.riskTolerance, + this.sourceOfExperience, this.sourceOfWealth, this.stocksTradingExperience, this.stocksTradingFrequency, this.totalScore, + this.tradingExperienceFinancialInstruments, + this.tradingFrequencyFinancialInstruments, this.tradingScore, }); @@ -129,9 +136,18 @@ abstract class GetFinancialAssessmentModel { /// Binary options trading frequency final String? binaryOptionsTradingFrequency; + /// How much experience do you have in CFD trading? + final String? cfdExperience; + + /// How many CFD trades have you placed in the past 12 months? + final String? cfdFrequency; + /// CFD Score final int? cfdScore; + /// In your understanding, CFD trading allows you to: + final String? cfdTradingDefinition; + /// CFDs trading experience final String? cfdTradingExperience; @@ -174,6 +190,12 @@ abstract class GetFinancialAssessmentModel { /// Indices trading frequency final String? indicesTradingFrequency; + /// How does leverage affect CFD trading? + final String? leverageImpactTrading; + + /// Leverage trading is high-risk, so it's a good idea to use risk management features such as stop loss. Stop loss allows you to + final String? leverageTradingHighRiskStopLoss; + /// Net Annual Income final String? netIncome; @@ -192,6 +214,15 @@ abstract class GetFinancialAssessmentModel { /// Trading frequency in other financial instruments final String? otherInstrumentsTradingFrequency; + /// When would you be required to pay an initial margin? + final String? requiredInitialMargin; + + /// Do you understand that you could potentially lose 100% of the money you use to trade? + final String? riskTolerance; + + /// How much knowledge and experience do you have in relation to online trading? + final String? sourceOfExperience; + /// Source of wealth final String? sourceOfWealth; @@ -204,6 +235,12 @@ abstract class GetFinancialAssessmentModel { /// Total Score final int? totalScore; + /// How much experience do you have with other financial instruments? + final String? tradingExperienceFinancialInstruments; + + /// How many trades have you placed with other financial instruments in the past 12 months? + final String? tradingFrequencyFinancialInstruments; + /// Trading Experience Score final int? tradingScore; } @@ -212,66 +249,46 @@ abstract class GetFinancialAssessmentModel { class GetFinancialAssessment extends GetFinancialAssessmentModel { /// Initializes Get financial assessment class. const GetFinancialAssessment({ - String? accountTurnover, - String? binaryOptionsTradingExperience, - String? binaryOptionsTradingFrequency, - int? cfdScore, - String? cfdTradingExperience, - String? cfdTradingFrequency, - String? commoditiesTradingExperience, - String? commoditiesTradingFrequency, - String? educationLevel, - String? employmentIndustry, - String? employmentStatus, - String? estimatedWorth, - int? financialInformationScore, - String? forexTradingExperience, - String? forexTradingFrequency, - String? incomeSource, - String? indicesTradingExperience, - String? indicesTradingFrequency, - String? netIncome, - String? occupation, - String? otherDerivativesTradingExperience, - String? otherDerivativesTradingFrequency, - String? otherInstrumentsTradingExperience, - String? otherInstrumentsTradingFrequency, - String? sourceOfWealth, - String? stocksTradingExperience, - String? stocksTradingFrequency, - int? totalScore, - int? tradingScore, - }) : super( - accountTurnover: accountTurnover, - binaryOptionsTradingExperience: binaryOptionsTradingExperience, - binaryOptionsTradingFrequency: binaryOptionsTradingFrequency, - cfdScore: cfdScore, - cfdTradingExperience: cfdTradingExperience, - cfdTradingFrequency: cfdTradingFrequency, - commoditiesTradingExperience: commoditiesTradingExperience, - commoditiesTradingFrequency: commoditiesTradingFrequency, - educationLevel: educationLevel, - employmentIndustry: employmentIndustry, - employmentStatus: employmentStatus, - estimatedWorth: estimatedWorth, - financialInformationScore: financialInformationScore, - forexTradingExperience: forexTradingExperience, - forexTradingFrequency: forexTradingFrequency, - incomeSource: incomeSource, - indicesTradingExperience: indicesTradingExperience, - indicesTradingFrequency: indicesTradingFrequency, - netIncome: netIncome, - occupation: occupation, - otherDerivativesTradingExperience: otherDerivativesTradingExperience, - otherDerivativesTradingFrequency: otherDerivativesTradingFrequency, - otherInstrumentsTradingExperience: otherInstrumentsTradingExperience, - otherInstrumentsTradingFrequency: otherInstrumentsTradingFrequency, - sourceOfWealth: sourceOfWealth, - stocksTradingExperience: stocksTradingExperience, - stocksTradingFrequency: stocksTradingFrequency, - totalScore: totalScore, - tradingScore: tradingScore, - ); + super.accountTurnover, + super.binaryOptionsTradingExperience, + super.binaryOptionsTradingFrequency, + super.cfdExperience, + super.cfdFrequency, + super.cfdScore, + super.cfdTradingDefinition, + super.cfdTradingExperience, + super.cfdTradingFrequency, + super.commoditiesTradingExperience, + super.commoditiesTradingFrequency, + super.educationLevel, + super.employmentIndustry, + super.employmentStatus, + super.estimatedWorth, + super.financialInformationScore, + super.forexTradingExperience, + super.forexTradingFrequency, + super.incomeSource, + super.indicesTradingExperience, + super.indicesTradingFrequency, + super.leverageImpactTrading, + super.leverageTradingHighRiskStopLoss, + super.netIncome, + super.occupation, + super.otherDerivativesTradingExperience, + super.otherDerivativesTradingFrequency, + super.otherInstrumentsTradingExperience, + super.otherInstrumentsTradingFrequency, + super.requiredInitialMargin, + super.riskTolerance, + super.sourceOfExperience, + super.sourceOfWealth, + super.stocksTradingExperience, + super.stocksTradingFrequency, + super.totalScore, + super.tradingExperienceFinancialInstruments, + super.tradingFrequencyFinancialInstruments, + super.tradingScore, + }); /// Creates an instance from JSON. factory GetFinancialAssessment.fromJson(Map json) => @@ -280,7 +297,10 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { binaryOptionsTradingExperience: json['binary_options_trading_experience'], binaryOptionsTradingFrequency: json['binary_options_trading_frequency'], + cfdExperience: json['cfd_experience'], + cfdFrequency: json['cfd_frequency'], cfdScore: json['cfd_score'], + cfdTradingDefinition: json['cfd_trading_definition'], cfdTradingExperience: json['cfd_trading_experience'], cfdTradingFrequency: json['cfd_trading_frequency'], commoditiesTradingExperience: json['commodities_trading_experience'], @@ -295,6 +315,9 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { incomeSource: json['income_source'], indicesTradingExperience: json['indices_trading_experience'], indicesTradingFrequency: json['indices_trading_frequency'], + leverageImpactTrading: json['leverage_impact_trading'], + leverageTradingHighRiskStopLoss: + json['leverage_trading_high_risk_stop_loss'], netIncome: json['net_income'], occupation: json['occupation'], otherDerivativesTradingExperience: @@ -305,10 +328,17 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { json['other_instruments_trading_experience'], otherInstrumentsTradingFrequency: json['other_instruments_trading_frequency'], + requiredInitialMargin: json['required_initial_margin'], + riskTolerance: json['risk_tolerance'], + sourceOfExperience: json['source_of_experience'], sourceOfWealth: json['source_of_wealth'], stocksTradingExperience: json['stocks_trading_experience'], stocksTradingFrequency: json['stocks_trading_frequency'], totalScore: json['total_score'], + tradingExperienceFinancialInstruments: + json['trading_experience_financial_instruments'], + tradingFrequencyFinancialInstruments: + json['trading_frequency_financial_instruments'], tradingScore: json['trading_score'], ); @@ -321,7 +351,10 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { binaryOptionsTradingExperience; resultMap['binary_options_trading_frequency'] = binaryOptionsTradingFrequency; + resultMap['cfd_experience'] = cfdExperience; + resultMap['cfd_frequency'] = cfdFrequency; resultMap['cfd_score'] = cfdScore; + resultMap['cfd_trading_definition'] = cfdTradingDefinition; resultMap['cfd_trading_experience'] = cfdTradingExperience; resultMap['cfd_trading_frequency'] = cfdTradingFrequency; resultMap['commodities_trading_experience'] = commoditiesTradingExperience; @@ -336,6 +369,9 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { resultMap['income_source'] = incomeSource; resultMap['indices_trading_experience'] = indicesTradingExperience; resultMap['indices_trading_frequency'] = indicesTradingFrequency; + resultMap['leverage_impact_trading'] = leverageImpactTrading; + resultMap['leverage_trading_high_risk_stop_loss'] = + leverageTradingHighRiskStopLoss; resultMap['net_income'] = netIncome; resultMap['occupation'] = occupation; resultMap['other_derivatives_trading_experience'] = @@ -346,10 +382,17 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { otherInstrumentsTradingExperience; resultMap['other_instruments_trading_frequency'] = otherInstrumentsTradingFrequency; + resultMap['required_initial_margin'] = requiredInitialMargin; + resultMap['risk_tolerance'] = riskTolerance; + resultMap['source_of_experience'] = sourceOfExperience; resultMap['source_of_wealth'] = sourceOfWealth; resultMap['stocks_trading_experience'] = stocksTradingExperience; resultMap['stocks_trading_frequency'] = stocksTradingFrequency; resultMap['total_score'] = totalScore; + resultMap['trading_experience_financial_instruments'] = + tradingExperienceFinancialInstruments; + resultMap['trading_frequency_financial_instruments'] = + tradingFrequencyFinancialInstruments; resultMap['trading_score'] = tradingScore; return resultMap; @@ -360,7 +403,10 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { String? accountTurnover, String? binaryOptionsTradingExperience, String? binaryOptionsTradingFrequency, + String? cfdExperience, + String? cfdFrequency, int? cfdScore, + String? cfdTradingDefinition, String? cfdTradingExperience, String? cfdTradingFrequency, String? commoditiesTradingExperience, @@ -375,16 +421,23 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { String? incomeSource, String? indicesTradingExperience, String? indicesTradingFrequency, + String? leverageImpactTrading, + String? leverageTradingHighRiskStopLoss, String? netIncome, String? occupation, String? otherDerivativesTradingExperience, String? otherDerivativesTradingFrequency, String? otherInstrumentsTradingExperience, String? otherInstrumentsTradingFrequency, + String? requiredInitialMargin, + String? riskTolerance, + String? sourceOfExperience, String? sourceOfWealth, String? stocksTradingExperience, String? stocksTradingFrequency, int? totalScore, + String? tradingExperienceFinancialInstruments, + String? tradingFrequencyFinancialInstruments, int? tradingScore, }) => GetFinancialAssessment( @@ -393,7 +446,10 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { this.binaryOptionsTradingExperience, binaryOptionsTradingFrequency: binaryOptionsTradingFrequency ?? this.binaryOptionsTradingFrequency, + cfdExperience: cfdExperience ?? this.cfdExperience, + cfdFrequency: cfdFrequency ?? this.cfdFrequency, cfdScore: cfdScore ?? this.cfdScore, + cfdTradingDefinition: cfdTradingDefinition ?? this.cfdTradingDefinition, cfdTradingExperience: cfdTradingExperience ?? this.cfdTradingExperience, cfdTradingFrequency: cfdTradingFrequency ?? this.cfdTradingFrequency, commoditiesTradingExperience: @@ -415,6 +471,10 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { indicesTradingExperience ?? this.indicesTradingExperience, indicesTradingFrequency: indicesTradingFrequency ?? this.indicesTradingFrequency, + leverageImpactTrading: + leverageImpactTrading ?? this.leverageImpactTrading, + leverageTradingHighRiskStopLoss: leverageTradingHighRiskStopLoss ?? + this.leverageTradingHighRiskStopLoss, netIncome: netIncome ?? this.netIncome, occupation: occupation ?? this.occupation, otherDerivativesTradingExperience: otherDerivativesTradingExperience ?? @@ -425,12 +485,22 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { this.otherInstrumentsTradingExperience, otherInstrumentsTradingFrequency: otherInstrumentsTradingFrequency ?? this.otherInstrumentsTradingFrequency, + requiredInitialMargin: + requiredInitialMargin ?? this.requiredInitialMargin, + riskTolerance: riskTolerance ?? this.riskTolerance, + sourceOfExperience: sourceOfExperience ?? this.sourceOfExperience, sourceOfWealth: sourceOfWealth ?? this.sourceOfWealth, stocksTradingExperience: stocksTradingExperience ?? this.stocksTradingExperience, stocksTradingFrequency: stocksTradingFrequency ?? this.stocksTradingFrequency, totalScore: totalScore ?? this.totalScore, + tradingExperienceFinancialInstruments: + tradingExperienceFinancialInstruments ?? + this.tradingExperienceFinancialInstruments, + tradingFrequencyFinancialInstruments: + tradingFrequencyFinancialInstruments ?? + this.tradingFrequencyFinancialInstruments, tradingScore: tradingScore ?? this.tradingScore, ); } diff --git a/lib/api/response/get_limits_response_result.dart b/lib/api/response/get_limits_response_result.dart index b1c4217b4d..98c0e57a60 100644 --- a/lib/api/response/get_limits_response_result.dart +++ b/lib/api/response/get_limits_response_result.dart @@ -25,10 +25,8 @@ abstract class GetLimitsResponseModel { class GetLimitsResponse extends GetLimitsResponseModel { /// Initializes Get limits response class. const GetLimitsResponse({ - GetLimits? getLimits, - }) : super( - getLimits: getLimits, - ); + super.getLimits, + }); /// Creates an instance from JSON. factory GetLimitsResponse.fromJson( @@ -79,12 +77,12 @@ class GetLimitsResponse extends GetLimitsResponseModel { getLimits: getLimits ?? this.getLimits, ); } - /// Get limits model class. abstract class GetLimitsModel { /// Initializes Get limits model class . const GetLimitsModel({ this.accountBalance, + this.dailyCumulativeAmountTransfers, this.dailyTransfers, this.dailyTurnover, this.lifetimeLimit, @@ -103,6 +101,9 @@ abstract class GetLimitsModel { /// Maximum account cash balance final double? accountBalance; + /// Cumulative daily transfer limits + final Map? dailyCumulativeAmountTransfers; + /// Daily transfers final Map? dailyTransfers; @@ -147,40 +148,28 @@ abstract class GetLimitsModel { class GetLimits extends GetLimitsModel { /// Initializes Get limits class. const GetLimits({ - double? accountBalance, - Map? dailyTransfers, - double? dailyTurnover, - double? lifetimeLimit, - Map>? marketSpecific, - int? numOfDays, - double? numOfDaysLimit, - int? openPositions, - double? payout, - PayoutPerSymbol? payoutPerSymbol, - double? payoutPerSymbolAndContractType, - double? remainder, - double? withdrawalForXDaysMonetary, - double? withdrawalSinceInceptionMonetary, - }) : super( - accountBalance: accountBalance, - dailyTransfers: dailyTransfers, - dailyTurnover: dailyTurnover, - lifetimeLimit: lifetimeLimit, - marketSpecific: marketSpecific, - numOfDays: numOfDays, - numOfDaysLimit: numOfDaysLimit, - openPositions: openPositions, - payout: payout, - payoutPerSymbol: payoutPerSymbol, - payoutPerSymbolAndContractType: payoutPerSymbolAndContractType, - remainder: remainder, - withdrawalForXDaysMonetary: withdrawalForXDaysMonetary, - withdrawalSinceInceptionMonetary: withdrawalSinceInceptionMonetary, - ); + super.accountBalance, + super.dailyCumulativeAmountTransfers, + super.dailyTransfers, + super.dailyTurnover, + super.lifetimeLimit, + super.marketSpecific, + super.numOfDays, + super.numOfDaysLimit, + super.openPositions, + super.payout, + super.payoutPerSymbol, + super.payoutPerSymbolAndContractType, + super.remainder, + super.withdrawalForXDaysMonetary, + super.withdrawalSinceInceptionMonetary, + }); /// Creates an instance from JSON. factory GetLimits.fromJson(Map json) => GetLimits( accountBalance: getDouble(json['account_balance']), + dailyCumulativeAmountTransfers: + json['daily_cumulative_amount_transfers'], dailyTransfers: json['daily_transfers'], dailyTurnover: getDouble(json['daily_turnover']), lifetimeLimit: getDouble(json['lifetime_limit']), @@ -220,6 +209,8 @@ class GetLimits extends GetLimitsModel { final Map resultMap = {}; resultMap['account_balance'] = accountBalance; + resultMap['daily_cumulative_amount_transfers'] = + dailyCumulativeAmountTransfers; resultMap['daily_transfers'] = dailyTransfers; resultMap['daily_turnover'] = dailyTurnover; resultMap['lifetime_limit'] = lifetimeLimit; @@ -244,6 +235,7 @@ class GetLimits extends GetLimitsModel { /// Creates a copy of instance with given parameters. GetLimits copyWith({ double? accountBalance, + Map? dailyCumulativeAmountTransfers, Map? dailyTransfers, double? dailyTurnover, double? lifetimeLimit, @@ -260,6 +252,8 @@ class GetLimits extends GetLimitsModel { }) => GetLimits( accountBalance: accountBalance ?? this.accountBalance, + dailyCumulativeAmountTransfers: dailyCumulativeAmountTransfers ?? + this.dailyCumulativeAmountTransfers, dailyTransfers: dailyTransfers ?? this.dailyTransfers, dailyTurnover: dailyTurnover ?? this.dailyTurnover, lifetimeLimit: lifetimeLimit ?? this.lifetimeLimit, @@ -278,7 +272,6 @@ class GetLimits extends GetLimitsModel { this.withdrawalSinceInceptionMonetary, ); } - /// Market specific property item model class. abstract class MarketSpecificPropertyItemModel { /// Initializes Market specific property item model class . @@ -310,18 +303,12 @@ abstract class MarketSpecificPropertyItemModel { class MarketSpecificPropertyItem extends MarketSpecificPropertyItemModel { /// Initializes Market specific property item class. const MarketSpecificPropertyItem({ - String? level, - String? name, - double? payoutLimit, - String? profileName, - double? turnoverLimit, - }) : super( - level: level, - name: name, - payoutLimit: payoutLimit, - profileName: profileName, - turnoverLimit: turnoverLimit, - ); + super.level, + super.name, + super.payoutLimit, + super.profileName, + super.turnoverLimit, + }); /// Creates an instance from JSON. factory MarketSpecificPropertyItem.fromJson(Map json) => @@ -362,7 +349,6 @@ class MarketSpecificPropertyItem extends MarketSpecificPropertyItemModel { turnoverLimit: turnoverLimit ?? this.turnoverLimit, ); } - /// Payout per symbol model class. abstract class PayoutPerSymbolModel { /// Initializes Payout per symbol model class . @@ -382,12 +368,9 @@ abstract class PayoutPerSymbolModel { class PayoutPerSymbol extends PayoutPerSymbolModel { /// Initializes Payout per symbol class. const PayoutPerSymbol({ - double? atm, - NonAtm? nonAtm, - }) : super( - atm: atm, - nonAtm: nonAtm, - ); + super.atm, + super.nonAtm, + }); /// Creates an instance from JSON. factory PayoutPerSymbol.fromJson(Map json) => @@ -419,7 +402,6 @@ class PayoutPerSymbol extends PayoutPerSymbolModel { nonAtm: nonAtm ?? this.nonAtm, ); } - /// Non atm model class. abstract class NonAtmModel { /// Initializes Non atm model class . @@ -439,12 +421,9 @@ abstract class NonAtmModel { class NonAtm extends NonAtmModel { /// Initializes Non atm class. const NonAtm({ - double? lessThanSevenDays, - double? moreThanSevenDays, - }) : super( - lessThanSevenDays: lessThanSevenDays, - moreThanSevenDays: moreThanSevenDays, - ); + super.lessThanSevenDays, + super.moreThanSevenDays, + }); /// Creates an instance from JSON. factory NonAtm.fromJson(Map json) => NonAtm( diff --git a/lib/api/response/get_settings_response_result.dart b/lib/api/response/get_settings_response_result.dart index 4d9fde44a8..1489031c2d 100644 --- a/lib/api/response/get_settings_response_result.dart +++ b/lib/api/response/get_settings_response_result.dart @@ -28,10 +28,8 @@ abstract class GetSettingsResponseModel { class GetSettingsResponse extends GetSettingsResponseModel { /// Initializes Get settings response class. const GetSettingsResponse({ - GetSettings? getSettings, - }) : super( - getSettings: getSettings, - ); + super.getSettings, + }); /// Creates an instance from JSON. factory GetSettingsResponse.fromJson( @@ -132,6 +130,7 @@ class GetSettingsResponse extends GetSettingsResponseModel { allowCopiers: getSettings?.allowCopiers, citizen: getSettings?.citizen, dateOfBirth: getStringFromDateTime(getSettings?.dateOfBirth), + dxtradeUserException: getSettings?.dxtradeUserException, emailConsent: getSettings?.emailConsent, firstName: getSettings?.firstName, lastName: getSettings?.lastName, @@ -157,6 +156,34 @@ class GetSettingsResponse extends GetSettingsResponseModel { ); } +/// EmploymentStatusEnum mapper. +final Map employmentStatusEnumMapper = + { + "Employed": EmploymentStatusEnum.employed, + "Pensioner": EmploymentStatusEnum.pensioner, + "Self-Employed": EmploymentStatusEnum.selfEmployed, + "Student": EmploymentStatusEnum.student, + "Unemployed": EmploymentStatusEnum.unemployed, +}; + +/// EmploymentStatus Enum. +enum EmploymentStatusEnum { + /// Employed. + employed, + + /// Pensioner. + pensioner, + + /// Self-Employed. + selfEmployed, + + /// Student. + student, + + /// Unemployed. + unemployed, +} + /// Get settings model class. abstract class GetSettingsModel { /// Initializes Get settings model class . @@ -170,11 +197,14 @@ abstract class GetSettingsModel { this.allowCopiers, this.citizen, this.clientTncStatus, + this.coolingOffExpirationDate, this.country, this.countryCode, this.dateOfBirth, + this.dxtradeUserException, this.email, this.emailConsent, + this.employmentStatus, this.featureFlag, this.firstName, this.hasSecretAnswer, @@ -221,6 +251,9 @@ abstract class GetSettingsModel { /// Latest terms and conditions version accepted by client final String? clientTncStatus; + /// Cooldown expiration epoch date when a client fails appropriateness tests + final DateTime? coolingOffExpirationDate; + /// User Country (same as residence field) - deprecated final String? country; @@ -230,12 +263,18 @@ abstract class GetSettingsModel { /// Epoch of user's birthday (note: Only available for users who have at least one real account) final DateTime? dateOfBirth; + /// Boolean value `true` or `false`, indicating if user email belong to dxtrade exception list. + final bool? dxtradeUserException; + /// User Email final String? email; /// Boolean value `true` or `false`, indicating permission to use email address for any contact which may include marketing final bool? emailConsent; + /// Employment Status. + final EmploymentStatusEnum? employmentStatus; + /// Contains features that are enabled or disabled for this user final FeatureFlag? featureFlag; @@ -292,70 +331,41 @@ abstract class GetSettingsModel { class GetSettings extends GetSettingsModel { /// Initializes Get settings class. const GetSettings({ - String? accountOpeningReason, - String? addressCity, - String? addressLine1, - String? addressLine2, - String? addressPostcode, - String? addressState, - bool? allowCopiers, - String? citizen, - String? clientTncStatus, - String? country, - String? countryCode, - DateTime? dateOfBirth, - String? email, - bool? emailConsent, - FeatureFlag? featureFlag, - String? firstName, - bool? hasSecretAnswer, - List? immutableFields, - bool? isAuthenticatedPaymentAgent, - String? lastName, - bool? nonPepDeclaration, - String? phone, - String? placeOfBirth, - String? preferredLanguage, - bool? requestProfessionalStatus, - String? residence, - String? salutation, - String? taxIdentificationNumber, - String? taxResidence, - int? tradingHub, - String? userHash, - }) : super( - accountOpeningReason: accountOpeningReason, - addressCity: addressCity, - addressLine1: addressLine1, - addressLine2: addressLine2, - addressPostcode: addressPostcode, - addressState: addressState, - allowCopiers: allowCopiers, - citizen: citizen, - clientTncStatus: clientTncStatus, - country: country, - countryCode: countryCode, - dateOfBirth: dateOfBirth, - email: email, - emailConsent: emailConsent, - featureFlag: featureFlag, - firstName: firstName, - hasSecretAnswer: hasSecretAnswer, - immutableFields: immutableFields, - isAuthenticatedPaymentAgent: isAuthenticatedPaymentAgent, - lastName: lastName, - nonPepDeclaration: nonPepDeclaration, - phone: phone, - placeOfBirth: placeOfBirth, - preferredLanguage: preferredLanguage, - requestProfessionalStatus: requestProfessionalStatus, - residence: residence, - salutation: salutation, - taxIdentificationNumber: taxIdentificationNumber, - taxResidence: taxResidence, - tradingHub: tradingHub, - userHash: userHash, - ); + super.accountOpeningReason, + super.addressCity, + super.addressLine1, + super.addressLine2, + super.addressPostcode, + super.addressState, + super.allowCopiers, + super.citizen, + super.clientTncStatus, + super.coolingOffExpirationDate, + super.country, + super.countryCode, + super.dateOfBirth, + super.dxtradeUserException, + super.email, + super.emailConsent, + super.employmentStatus, + super.featureFlag, + super.firstName, + super.hasSecretAnswer, + super.immutableFields, + super.isAuthenticatedPaymentAgent, + super.lastName, + super.nonPepDeclaration, + super.phone, + super.placeOfBirth, + super.preferredLanguage, + super.requestProfessionalStatus, + super.residence, + super.salutation, + super.taxIdentificationNumber, + super.taxResidence, + super.tradingHub, + super.userHash, + }); /// Creates an instance from JSON. factory GetSettings.fromJson(Map json) => GetSettings( @@ -368,11 +378,17 @@ class GetSettings extends GetSettingsModel { allowCopiers: getBool(json['allow_copiers']), citizen: json['citizen'], clientTncStatus: json['client_tnc_status'], + coolingOffExpirationDate: + getDateTime(json['cooling_off_expiration_date']), country: json['country'], countryCode: json['country_code'], dateOfBirth: getDateTime(json['date_of_birth']), + dxtradeUserException: getBool(json['dxtrade_user_exception']), email: json['email'], emailConsent: getBool(json['email_consent']), + employmentStatus: json['employment_status'] == null + ? null + : employmentStatusEnumMapper[json['employment_status']], featureFlag: json['feature_flag'] == null ? null : FeatureFlag.fromJson(json['feature_flag']), @@ -414,11 +430,18 @@ class GetSettings extends GetSettingsModel { resultMap['allow_copiers'] = allowCopiers; resultMap['citizen'] = citizen; resultMap['client_tnc_status'] = clientTncStatus; + resultMap['cooling_off_expiration_date'] = + getSecondsSinceEpochDateTime(coolingOffExpirationDate); resultMap['country'] = country; resultMap['country_code'] = countryCode; resultMap['date_of_birth'] = getSecondsSinceEpochDateTime(dateOfBirth); + resultMap['dxtrade_user_exception'] = dxtradeUserException; resultMap['email'] = email; resultMap['email_consent'] = emailConsent; + resultMap['employment_status'] = employmentStatusEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == employmentStatus) + .key; if (featureFlag != null) { resultMap['feature_flag'] = featureFlag!.toJson(); } @@ -459,11 +482,14 @@ class GetSettings extends GetSettingsModel { bool? allowCopiers, String? citizen, String? clientTncStatus, + DateTime? coolingOffExpirationDate, String? country, String? countryCode, DateTime? dateOfBirth, + bool? dxtradeUserException, String? email, bool? emailConsent, + EmploymentStatusEnum? employmentStatus, FeatureFlag? featureFlag, String? firstName, bool? hasSecretAnswer, @@ -492,11 +518,15 @@ class GetSettings extends GetSettingsModel { allowCopiers: allowCopiers ?? this.allowCopiers, citizen: citizen ?? this.citizen, clientTncStatus: clientTncStatus ?? this.clientTncStatus, + coolingOffExpirationDate: + coolingOffExpirationDate ?? this.coolingOffExpirationDate, country: country ?? this.country, countryCode: countryCode ?? this.countryCode, dateOfBirth: dateOfBirth ?? this.dateOfBirth, + dxtradeUserException: dxtradeUserException ?? this.dxtradeUserException, email: email ?? this.email, emailConsent: emailConsent ?? this.emailConsent, + employmentStatus: employmentStatus ?? this.employmentStatus, featureFlag: featureFlag ?? this.featureFlag, firstName: firstName ?? this.firstName, hasSecretAnswer: hasSecretAnswer ?? this.hasSecretAnswer, @@ -535,10 +565,8 @@ abstract class FeatureFlagModel { class FeatureFlag extends FeatureFlagModel { /// Initializes Feature flag class. const FeatureFlag({ - bool? wallet, - }) : super( - wallet: wallet, - ); + super.wallet, + }); /// Creates an instance from JSON. factory FeatureFlag.fromJson(Map json) => FeatureFlag( diff --git a/lib/api/response/landing_company_details_response_result.dart b/lib/api/response/landing_company_details_response_result.dart index 78eed6e04b..aa9c3ccce2 100644 --- a/lib/api/response/landing_company_details_response_result.dart +++ b/lib/api/response/landing_company_details_response_result.dart @@ -18,10 +18,8 @@ abstract class LandingCompanyDetailsResponseModel { class LandingCompanyDetailsResponse extends LandingCompanyDetailsResponseModel { /// Initializes Landing company details response class. const LandingCompanyDetailsResponse({ - LandingCompanyDetails? landingCompanyDetails, - }) : super( - landingCompanyDetails: landingCompanyDetails, - ); + super.landingCompanyDetails, + }); /// Creates an instance from JSON. factory LandingCompanyDetailsResponse.fromJson( @@ -70,6 +68,7 @@ abstract class LandingCompanyDetailsModel { this.requirements, this.shortcode, this.supportProfessionalClient, + this.tinNotMandatory, }); /// Landing Company address. @@ -110,40 +109,30 @@ abstract class LandingCompanyDetailsModel { /// Flag that indicates whether the landing company supports professional accounts or not final bool? supportProfessionalClient; + + /// Flag that indicates whether tax identifier number is not mandatory for the current country and landing company. + final bool? tinNotMandatory; } /// Landing company details class. class LandingCompanyDetails extends LandingCompanyDetailsModel { /// Initializes Landing company details class. const LandingCompanyDetails({ - List? address, - Map? changeableFields, - String? country, - CurrencyConfig? currencyConfig, - bool? hasRealityCheck, - List? legalAllowedContractCategories, - List? legalAllowedCurrencies, - List? legalAllowedMarkets, - String? legalDefaultCurrency, - String? name, - Requirements? requirements, - String? shortcode, - bool? supportProfessionalClient, - }) : super( - address: address, - changeableFields: changeableFields, - country: country, - currencyConfig: currencyConfig, - hasRealityCheck: hasRealityCheck, - legalAllowedContractCategories: legalAllowedContractCategories, - legalAllowedCurrencies: legalAllowedCurrencies, - legalAllowedMarkets: legalAllowedMarkets, - legalDefaultCurrency: legalDefaultCurrency, - name: name, - requirements: requirements, - shortcode: shortcode, - supportProfessionalClient: supportProfessionalClient, - ); + super.address, + super.changeableFields, + super.country, + super.currencyConfig, + super.hasRealityCheck, + super.legalAllowedContractCategories, + super.legalAllowedCurrencies, + super.legalAllowedMarkets, + super.legalDefaultCurrency, + super.name, + super.requirements, + super.shortcode, + super.supportProfessionalClient, + super.tinNotMandatory, + }); /// Creates an instance from JSON. factory LandingCompanyDetails.fromJson(Map json) => @@ -190,6 +179,7 @@ class LandingCompanyDetails extends LandingCompanyDetailsModel { : Requirements.fromJson(json['requirements']), shortcode: json['shortcode'], supportProfessionalClient: getBool(json['support_professional_client']), + tinNotMandatory: getBool(json['tin_not_mandatory']), ); /// Converts an instance to JSON. @@ -238,6 +228,7 @@ class LandingCompanyDetails extends LandingCompanyDetailsModel { } resultMap['shortcode'] = shortcode; resultMap['support_professional_client'] = supportProfessionalClient; + resultMap['tin_not_mandatory'] = tinNotMandatory; return resultMap; } @@ -257,6 +248,7 @@ class LandingCompanyDetails extends LandingCompanyDetailsModel { Requirements? requirements, String? shortcode, bool? supportProfessionalClient, + bool? tinNotMandatory, }) => LandingCompanyDetails( address: address ?? this.address, @@ -275,6 +267,7 @@ class LandingCompanyDetails extends LandingCompanyDetailsModel { shortcode: shortcode ?? this.shortcode, supportProfessionalClient: supportProfessionalClient ?? this.supportProfessionalClient, + tinNotMandatory: tinNotMandatory ?? this.tinNotMandatory, ); } /// Currency config model class. @@ -312,20 +305,13 @@ abstract class CurrencyConfigModel { class CurrencyConfig extends CurrencyConfigModel { /// Initializes Currency config class. const CurrencyConfig({ - Map? commodities, - Map? cryptocurrency, - Map? forex, - Map? indices, - Market? market, - Map? syntheticIndex, - }) : super( - commodities: commodities, - cryptocurrency: cryptocurrency, - forex: forex, - indices: indices, - market: market, - syntheticIndex: syntheticIndex, - ); + super.commodities, + super.cryptocurrency, + super.forex, + super.indices, + super.market, + super.syntheticIndex, + }); /// Creates an instance from JSON. factory CurrencyConfig.fromJson(Map json) => CurrencyConfig( @@ -386,10 +372,8 @@ abstract class MarketModel { class Market extends MarketModel { /// Initializes Market class. const Market({ - Currency? currency, - }) : super( - currency: currency, - ); + super.currency, + }); /// Creates an instance from JSON. factory Market.fromJson(Map json) => Market( @@ -436,12 +420,9 @@ abstract class CurrencyModel { class Currency extends CurrencyModel { /// Initializes Currency class. const Currency({ - int? maxPayout, - int? minStake, - }) : super( - maxPayout: maxPayout, - minStake: minStake, - ); + super.maxPayout, + super.minStake, + }); /// Creates an instance from JSON. factory Currency.fromJson(Map json) => Currency( @@ -496,16 +477,11 @@ abstract class RequirementsModel { class Requirements extends RequirementsModel { /// Initializes Requirements class. const Requirements({ - AfterFirstDeposit? afterFirstDeposit, - Compliance? compliance, - List? signup, - List? withdrawal, - }) : super( - afterFirstDeposit: afterFirstDeposit, - compliance: compliance, - signup: signup, - withdrawal: withdrawal, - ); + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); /// Creates an instance from JSON. factory Requirements.fromJson(Map json) => Requirements( @@ -588,10 +564,8 @@ abstract class AfterFirstDepositModel { class AfterFirstDeposit extends AfterFirstDepositModel { /// Initializes After first deposit class. const AfterFirstDeposit({ - List? financialAssessment, - }) : super( - financialAssessment: financialAssessment, - ); + super.financialAssessment, + }); /// Creates an instance from JSON. factory AfterFirstDeposit.fromJson(Map json) => @@ -647,12 +621,9 @@ abstract class ComplianceModel { class Compliance extends ComplianceModel { /// Initializes Compliance class. const Compliance({ - List? mt5, - List? taxInformation, - }) : super( - mt5: mt5, - taxInformation: taxInformation, - ); + super.mt5, + super.taxInformation, + }); /// Creates an instance from JSON. factory Compliance.fromJson(Map json) => Compliance( diff --git a/lib/api/response/landing_company_response_result.dart b/lib/api/response/landing_company_response_result.dart index 2c5434b3b5..009547c9ae 100644 --- a/lib/api/response/landing_company_response_result.dart +++ b/lib/api/response/landing_company_response_result.dart @@ -28,10 +28,8 @@ abstract class LandingCompanyResponseModel { class LandingCompanyResponse extends LandingCompanyResponseModel { /// Initializes Landing company response class. const LandingCompanyResponse({ - LandingCompany? landingCompany, - }) : super( - landingCompany: landingCompany, - ); + super.landingCompany, + }); /// Creates an instance from JSON. factory LandingCompanyResponse.fromJson( @@ -132,7 +130,6 @@ enum StandardEnum { /// none. none, } - /// Landing company model class. abstract class LandingCompanyModel { /// Initializes Landing company model class . @@ -140,6 +137,7 @@ abstract class LandingCompanyModel { this.addressParseable, this.allCompany, this.config, + this.ctrader, this.derivez, this.dxtradeAllCompany, this.dxtradeFinancialCompany, @@ -147,12 +145,12 @@ abstract class LandingCompanyModel { this.financialCompany, this.forbiddenPostcodePattern, this.gamingCompany, - this.gamstopCompany, this.id, this.isIdvSupported, this.lcToOpenMfAccount, this.minimumAge, this.mt5AgeVerification, + this.mtAllCompany, this.mtFinancialCompany, this.mtGamingCompany, this.name, @@ -176,6 +174,9 @@ abstract class LandingCompanyModel { /// Config structure with document types ,taxRequired ,tin format details. final Map? config; + /// Available CTrader accounts. + final Ctrader? ctrader; + /// Available DerivEZ accounts. final Derivez? derivez; @@ -197,9 +198,6 @@ abstract class LandingCompanyModel { /// Landing Company for gaming contracts (Synthetic Indices) final GamingCompany? gamingCompany; - /// Gamestop company details. - final List? gamstopCompany; - /// Country code final String? id; @@ -215,6 +213,9 @@ abstract class LandingCompanyModel { /// Flag to indicate if mt5 age verification detail. final bool? mt5AgeVerification; + /// Landing Company for MT5 standard combined all Synthetic and financial, currently has Financial as subtype. + final MtAllCompany? mtAllCompany; + /// Landing Company for MT5 financial contracts (all except Synthetic Indices), currently divided into Financial STP, Financial (standard) as subtypes. final MtFinancialCompany? mtFinancialCompany; @@ -256,65 +257,36 @@ abstract class LandingCompanyModel { class LandingCompany extends LandingCompanyModel { /// Initializes Landing company class. const LandingCompany({ - bool? addressParseable, - AllCompanyEnum? allCompany, - Map? config, - Derivez? derivez, - DxtradeAllCompany? dxtradeAllCompany, - DxtradeFinancialCompany? dxtradeFinancialCompany, - DxtradeGamingCompany? dxtradeGamingCompany, - FinancialCompany? financialCompany, - String? forbiddenPostcodePattern, - GamingCompany? gamingCompany, - List? gamstopCompany, - String? id, - bool? isIdvSupported, - String? lcToOpenMfAccount, - int? minimumAge, - bool? mt5AgeVerification, - MtFinancialCompany? mtFinancialCompany, - MtGamingCompany? mtGamingCompany, - String? name, - bool? needSetMaxTurnoverLimit, - bool? noProvince, - bool? requireAddressPostcode, - bool? requireAgeVerifiedForSynthetic, - bool? requirePoi, - bool? requireVerificationWhenNotAgeVerified, - bool? skipDepositVerification, - bool? ukgcFundsProtection, - String? virtualCompany, - }) : super( - addressParseable: addressParseable, - allCompany: allCompany, - config: config, - derivez: derivez, - dxtradeAllCompany: dxtradeAllCompany, - dxtradeFinancialCompany: dxtradeFinancialCompany, - dxtradeGamingCompany: dxtradeGamingCompany, - financialCompany: financialCompany, - forbiddenPostcodePattern: forbiddenPostcodePattern, - gamingCompany: gamingCompany, - gamstopCompany: gamstopCompany, - id: id, - isIdvSupported: isIdvSupported, - lcToOpenMfAccount: lcToOpenMfAccount, - minimumAge: minimumAge, - mt5AgeVerification: mt5AgeVerification, - mtFinancialCompany: mtFinancialCompany, - mtGamingCompany: mtGamingCompany, - name: name, - needSetMaxTurnoverLimit: needSetMaxTurnoverLimit, - noProvince: noProvince, - requireAddressPostcode: requireAddressPostcode, - requireAgeVerifiedForSynthetic: requireAgeVerifiedForSynthetic, - requirePoi: requirePoi, - requireVerificationWhenNotAgeVerified: - requireVerificationWhenNotAgeVerified, - skipDepositVerification: skipDepositVerification, - ukgcFundsProtection: ukgcFundsProtection, - virtualCompany: virtualCompany, - ); + super.addressParseable, + super.allCompany, + super.config, + super.ctrader, + super.derivez, + super.dxtradeAllCompany, + super.dxtradeFinancialCompany, + super.dxtradeGamingCompany, + super.financialCompany, + super.forbiddenPostcodePattern, + super.gamingCompany, + super.id, + super.isIdvSupported, + super.lcToOpenMfAccount, + super.minimumAge, + super.mt5AgeVerification, + super.mtAllCompany, + super.mtFinancialCompany, + super.mtGamingCompany, + super.name, + super.needSetMaxTurnoverLimit, + super.noProvince, + super.requireAddressPostcode, + super.requireAgeVerifiedForSynthetic, + super.requirePoi, + super.requireVerificationWhenNotAgeVerified, + super.skipDepositVerification, + super.ukgcFundsProtection, + super.virtualCompany, + }); /// Creates an instance from JSON. factory LandingCompany.fromJson(Map json) => LandingCompany( @@ -323,6 +295,8 @@ class LandingCompany extends LandingCompanyModel { ? null : allCompanyEnumMapper[json['all_company']], config: json['config'], + ctrader: + json['ctrader'] == null ? null : Ctrader.fromJson(json['ctrader']), derivez: json['derivez'] == null ? null : Derivez.fromJson(json['derivez']), dxtradeAllCompany: json['dxtrade_all_company'] == null @@ -342,18 +316,14 @@ class LandingCompany extends LandingCompanyModel { gamingCompany: json['gaming_company'] == null ? null : GamingCompany.fromJson(json['gaming_company']), - gamstopCompany: json['gamstop_company'] == null - ? null - : List.from( - json['gamstop_company']?.map( - (dynamic item) => item, - ), - ), id: json['id'], isIdvSupported: getBool(json['is_idv_supported']), lcToOpenMfAccount: json['lc_to_open_mf_account'], minimumAge: json['minimum_age'], mt5AgeVerification: getBool(json['mt5_age_verification']), + mtAllCompany: json['mt_all_company'] == null + ? null + : MtAllCompany.fromJson(json['mt_all_company']), mtFinancialCompany: json['mt_financial_company'] == null ? null : MtFinancialCompany.fromJson(json['mt_financial_company']), @@ -384,6 +354,9 @@ class LandingCompany extends LandingCompanyModel { entry.value == allCompany) .key; resultMap['config'] = config; + if (ctrader != null) { + resultMap['ctrader'] = ctrader!.toJson(); + } if (derivez != null) { resultMap['derivez'] = derivez!.toJson(); } @@ -404,18 +377,14 @@ class LandingCompany extends LandingCompanyModel { if (gamingCompany != null) { resultMap['gaming_company'] = gamingCompany!.toJson(); } - if (gamstopCompany != null) { - resultMap['gamstop_company'] = gamstopCompany! - .map( - (String item) => item, - ) - .toList(); - } resultMap['id'] = id; resultMap['is_idv_supported'] = isIdvSupported; resultMap['lc_to_open_mf_account'] = lcToOpenMfAccount; resultMap['minimum_age'] = minimumAge; resultMap['mt5_age_verification'] = mt5AgeVerification; + if (mtAllCompany != null) { + resultMap['mt_all_company'] = mtAllCompany!.toJson(); + } if (mtFinancialCompany != null) { resultMap['mt_financial_company'] = mtFinancialCompany!.toJson(); } @@ -443,6 +412,7 @@ class LandingCompany extends LandingCompanyModel { bool? addressParseable, AllCompanyEnum? allCompany, Map? config, + Ctrader? ctrader, Derivez? derivez, DxtradeAllCompany? dxtradeAllCompany, DxtradeFinancialCompany? dxtradeFinancialCompany, @@ -450,12 +420,12 @@ class LandingCompany extends LandingCompanyModel { FinancialCompany? financialCompany, String? forbiddenPostcodePattern, GamingCompany? gamingCompany, - List? gamstopCompany, String? id, bool? isIdvSupported, String? lcToOpenMfAccount, int? minimumAge, bool? mt5AgeVerification, + MtAllCompany? mtAllCompany, MtFinancialCompany? mtFinancialCompany, MtGamingCompany? mtGamingCompany, String? name, @@ -473,6 +443,7 @@ class LandingCompany extends LandingCompanyModel { addressParseable: addressParseable ?? this.addressParseable, allCompany: allCompany ?? this.allCompany, config: config ?? this.config, + ctrader: ctrader ?? this.ctrader, derivez: derivez ?? this.derivez, dxtradeAllCompany: dxtradeAllCompany ?? this.dxtradeAllCompany, dxtradeFinancialCompany: @@ -482,12 +453,12 @@ class LandingCompany extends LandingCompanyModel { forbiddenPostcodePattern: forbiddenPostcodePattern ?? this.forbiddenPostcodePattern, gamingCompany: gamingCompany ?? this.gamingCompany, - gamstopCompany: gamstopCompany ?? this.gamstopCompany, id: id ?? this.id, isIdvSupported: isIdvSupported ?? this.isIdvSupported, lcToOpenMfAccount: lcToOpenMfAccount ?? this.lcToOpenMfAccount, minimumAge: minimumAge ?? this.minimumAge, mt5AgeVerification: mt5AgeVerification ?? this.mt5AgeVerification, + mtAllCompany: mtAllCompany ?? this.mtAllCompany, mtFinancialCompany: mtFinancialCompany ?? this.mtFinancialCompany, mtGamingCompany: mtGamingCompany ?? this.mtGamingCompany, name: name ?? this.name, @@ -508,29 +479,26 @@ class LandingCompany extends LandingCompanyModel { virtualCompany: virtualCompany ?? this.virtualCompany, ); } - -/// Derivez model class. -abstract class DerivezModel { - /// Initializes Derivez model class . - const DerivezModel({ +/// Ctrader model class. +abstract class CtraderModel { + /// Initializes Ctrader model class . + const CtraderModel({ this.all, }); - /// DerivEZ all account types (Synthetic Indices and Financials). + /// CTrader all account types (Synthetic Indices and Financials). final All? all; } -/// Derivez class. -class Derivez extends DerivezModel { - /// Initializes Derivez class. - const Derivez({ - All? all, - }) : super( - all: all, - ); +/// Ctrader class. +class Ctrader extends CtraderModel { + /// Initializes Ctrader class. + const Ctrader({ + super.all, + }); /// Creates an instance from JSON. - factory Derivez.fromJson(Map json) => Derivez( + factory Ctrader.fromJson(Map json) => Ctrader( all: json['all'] == null ? null : All.fromJson(json['all']), ); @@ -546,14 +514,13 @@ class Derivez extends DerivezModel { } /// Creates a copy of instance with given parameters. - Derivez copyWith({ + Ctrader copyWith({ All? all, }) => - Derivez( + Ctrader( all: all ?? this.all, ); } - /// All model class. abstract class AllModel { /// Initializes All model class . @@ -569,10 +536,8 @@ abstract class AllModel { class All extends AllModel { /// Initializes All class. const All({ - StandardEnum? standard, - }) : super( - standard: standard, - ); + super.standard, + }); /// Creates an instance from JSON. factory All.fromJson(Map json) => All( @@ -601,7 +566,93 @@ class All extends AllModel { standard: standard ?? this.standard, ); } +/// Derivez model class. +abstract class DerivezModel { + /// Initializes Derivez model class . + const DerivezModel({ + this.all, + }); + + /// DerivEZ all account types (Synthetic Indices and Financials). + final DerivezAll? all; +} + +/// Derivez class. +class Derivez extends DerivezModel { + /// Initializes Derivez class. + const Derivez({ + super.all, + }); + + /// Creates an instance from JSON. + factory Derivez.fromJson(Map json) => Derivez( + all: json['all'] == null ? null : DerivezAll.fromJson(json['all']), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (all != null) { + resultMap['all'] = all!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + Derivez copyWith({ + DerivezAll? all, + }) => + Derivez( + all: all ?? this.all, + ); +} +/// Derivez all model class. +abstract class DerivezAllModel { + /// Initializes Derivez all model class . + const DerivezAllModel({ + this.standard, + }); + + /// For standard client + final StandardEnum? standard; +} + +/// Derivez all class. +class DerivezAll extends DerivezAllModel { + /// Initializes Derivez all class. + const DerivezAll({ + super.standard, + }); + + /// Creates an instance from JSON. + factory DerivezAll.fromJson(Map json) => DerivezAll( + standard: json['standard'] == null + ? null + : standardEnumMapper[json['standard']], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['standard'] = standardEnumMapper.entries + .firstWhere( + (MapEntry entry) => entry.value == standard) + .key; + + return resultMap; + } + /// Creates a copy of instance with given parameters. + DerivezAll copyWith({ + StandardEnum? standard, + }) => + DerivezAll( + standard: standard ?? this.standard, + ); +} /// Dxtrade all company model class. abstract class DxtradeAllCompanyModel { /// Initializes Dxtrade all company model class . @@ -617,10 +668,8 @@ abstract class DxtradeAllCompanyModel { class DxtradeAllCompany extends DxtradeAllCompanyModel { /// Initializes Dxtrade all company class. const DxtradeAllCompany({ - Standard? standard, - }) : super( - standard: standard, - ); + super.standard, + }); /// Creates an instance from JSON. factory DxtradeAllCompany.fromJson(Map json) => @@ -649,7 +698,6 @@ class DxtradeAllCompany extends DxtradeAllCompanyModel { standard: standard ?? this.standard, ); } - /// Standard model class. abstract class StandardModel { /// Initializes Standard model class . @@ -667,6 +715,7 @@ abstract class StandardModel { this.requirements, this.shortcode, this.supportProfessionalClient, + this.tinNotMandatory, }); /// Landing Company address @@ -707,40 +756,30 @@ abstract class StandardModel { /// Flag that indicates whether the landing company supports professional accounts or not final bool? supportProfessionalClient; + + /// Flag that indicates whether tax identifier number is not mandatory for the current country and landing company. + final bool? tinNotMandatory; } /// Standard class. class Standard extends StandardModel { /// Initializes Standard class. const Standard({ - List? address, - Map? changeableFields, - String? country, - Map? currencyConfig, - bool? hasRealityCheck, - List? legalAllowedContractCategories, - List? legalAllowedCurrencies, - List? legalAllowedMarkets, - String? legalDefaultCurrency, - String? name, - Requirements? requirements, - String? shortcode, - bool? supportProfessionalClient, - }) : super( - address: address, - changeableFields: changeableFields, - country: country, - currencyConfig: currencyConfig, - hasRealityCheck: hasRealityCheck, - legalAllowedContractCategories: legalAllowedContractCategories, - legalAllowedCurrencies: legalAllowedCurrencies, - legalAllowedMarkets: legalAllowedMarkets, - legalDefaultCurrency: legalDefaultCurrency, - name: name, - requirements: requirements, - shortcode: shortcode, - supportProfessionalClient: supportProfessionalClient, - ); + super.address, + super.changeableFields, + super.country, + super.currencyConfig, + super.hasRealityCheck, + super.legalAllowedContractCategories, + super.legalAllowedCurrencies, + super.legalAllowedMarkets, + super.legalDefaultCurrency, + super.name, + super.requirements, + super.shortcode, + super.supportProfessionalClient, + super.tinNotMandatory, + }); /// Creates an instance from JSON. factory Standard.fromJson(Map json) => Standard( @@ -784,6 +823,7 @@ class Standard extends StandardModel { : Requirements.fromJson(json['requirements']), shortcode: json['shortcode'], supportProfessionalClient: getBool(json['support_professional_client']), + tinNotMandatory: getBool(json['tin_not_mandatory']), ); /// Converts an instance to JSON. @@ -830,6 +870,7 @@ class Standard extends StandardModel { } resultMap['shortcode'] = shortcode; resultMap['support_professional_client'] = supportProfessionalClient; + resultMap['tin_not_mandatory'] = tinNotMandatory; return resultMap; } @@ -849,6 +890,7 @@ class Standard extends StandardModel { Requirements? requirements, String? shortcode, bool? supportProfessionalClient, + bool? tinNotMandatory, }) => Standard( address: address ?? this.address, @@ -867,9 +909,9 @@ class Standard extends StandardModel { shortcode: shortcode ?? this.shortcode, supportProfessionalClient: supportProfessionalClient ?? this.supportProfessionalClient, + tinNotMandatory: tinNotMandatory ?? this.tinNotMandatory, ); } - /// Requirements model class. abstract class RequirementsModel { /// Initializes Requirements model class . @@ -897,16 +939,11 @@ abstract class RequirementsModel { class Requirements extends RequirementsModel { /// Initializes Requirements class. const Requirements({ - AfterFirstDeposit? afterFirstDeposit, - Compliance? compliance, - List? signup, - List? withdrawal, - }) : super( - afterFirstDeposit: afterFirstDeposit, - compliance: compliance, - signup: signup, - withdrawal: withdrawal, - ); + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); /// Creates an instance from JSON. factory Requirements.fromJson(Map json) => Requirements( @@ -974,7 +1011,6 @@ class Requirements extends RequirementsModel { withdrawal: withdrawal ?? this.withdrawal, ); } - /// After first deposit model class. abstract class AfterFirstDepositModel { /// Initializes After first deposit model class . @@ -990,10 +1026,8 @@ abstract class AfterFirstDepositModel { class AfterFirstDeposit extends AfterFirstDepositModel { /// Initializes After first deposit class. const AfterFirstDeposit({ - List? financialAssessment, - }) : super( - financialAssessment: financialAssessment, - ); + super.financialAssessment, + }); /// Creates an instance from JSON. factory AfterFirstDeposit.fromJson(Map json) => @@ -1030,7 +1064,6 @@ class AfterFirstDeposit extends AfterFirstDepositModel { financialAssessment: financialAssessment ?? this.financialAssessment, ); } - /// Compliance model class. abstract class ComplianceModel { /// Initializes Compliance model class . @@ -1050,12 +1083,9 @@ abstract class ComplianceModel { class Compliance extends ComplianceModel { /// Initializes Compliance class. const Compliance({ - List? mt5, - List? taxInformation, - }) : super( - mt5: mt5, - taxInformation: taxInformation, - ); + super.mt5, + super.taxInformation, + }); /// Creates an instance from JSON. factory Compliance.fromJson(Map json) => Compliance( @@ -1107,7 +1137,6 @@ class Compliance extends ComplianceModel { taxInformation: taxInformation ?? this.taxInformation, ); } - /// Dxtrade financial company model class. abstract class DxtradeFinancialCompanyModel { /// Initializes Dxtrade financial company model class . @@ -1123,10 +1152,8 @@ abstract class DxtradeFinancialCompanyModel { class DxtradeFinancialCompany extends DxtradeFinancialCompanyModel { /// Initializes Dxtrade financial company class. const DxtradeFinancialCompany({ - DxtradeFinancialCompanyStandard? standard, - }) : super( - standard: standard, - ); + super.standard, + }); /// Creates an instance from JSON. factory DxtradeFinancialCompany.fromJson(Map json) => @@ -1155,7 +1182,6 @@ class DxtradeFinancialCompany extends DxtradeFinancialCompanyModel { standard: standard ?? this.standard, ); } - /// Dxtrade financial company standard model class. abstract class DxtradeFinancialCompanyStandardModel { /// Initializes Dxtrade financial company standard model class . @@ -1173,6 +1199,7 @@ abstract class DxtradeFinancialCompanyStandardModel { this.requirements, this.shortcode, this.supportProfessionalClient, + this.tinNotMandatory, }); /// Landing Company address @@ -1213,6 +1240,9 @@ abstract class DxtradeFinancialCompanyStandardModel { /// Flag that indicates whether the landing company supports professional accounts or not final bool? supportProfessionalClient; + + /// Flag that indicates whether tax identifier number is not mandatory for the current country and landing company. + final bool? tinNotMandatory; } /// Dxtrade financial company standard class. @@ -1220,34 +1250,21 @@ class DxtradeFinancialCompanyStandard extends DxtradeFinancialCompanyStandardModel { /// Initializes Dxtrade financial company standard class. const DxtradeFinancialCompanyStandard({ - List? address, - Map? changeableFields, - String? country, - Map? currencyConfig, - bool? hasRealityCheck, - List? legalAllowedContractCategories, - List? legalAllowedCurrencies, - List? legalAllowedMarkets, - String? legalDefaultCurrency, - String? name, - StandardRequirements? requirements, - String? shortcode, - bool? supportProfessionalClient, - }) : super( - address: address, - changeableFields: changeableFields, - country: country, - currencyConfig: currencyConfig, - hasRealityCheck: hasRealityCheck, - legalAllowedContractCategories: legalAllowedContractCategories, - legalAllowedCurrencies: legalAllowedCurrencies, - legalAllowedMarkets: legalAllowedMarkets, - legalDefaultCurrency: legalDefaultCurrency, - name: name, - requirements: requirements, - shortcode: shortcode, - supportProfessionalClient: supportProfessionalClient, - ); + super.address, + super.changeableFields, + super.country, + super.currencyConfig, + super.hasRealityCheck, + super.legalAllowedContractCategories, + super.legalAllowedCurrencies, + super.legalAllowedMarkets, + super.legalDefaultCurrency, + super.name, + super.requirements, + super.shortcode, + super.supportProfessionalClient, + super.tinNotMandatory, + }); /// Creates an instance from JSON. factory DxtradeFinancialCompanyStandard.fromJson(Map json) => @@ -1292,6 +1309,7 @@ class DxtradeFinancialCompanyStandard : StandardRequirements.fromJson(json['requirements']), shortcode: json['shortcode'], supportProfessionalClient: getBool(json['support_professional_client']), + tinNotMandatory: getBool(json['tin_not_mandatory']), ); /// Converts an instance to JSON. @@ -1338,6 +1356,7 @@ class DxtradeFinancialCompanyStandard } resultMap['shortcode'] = shortcode; resultMap['support_professional_client'] = supportProfessionalClient; + resultMap['tin_not_mandatory'] = tinNotMandatory; return resultMap; } @@ -1357,6 +1376,7 @@ class DxtradeFinancialCompanyStandard StandardRequirements? requirements, String? shortcode, bool? supportProfessionalClient, + bool? tinNotMandatory, }) => DxtradeFinancialCompanyStandard( address: address ?? this.address, @@ -1375,9 +1395,9 @@ class DxtradeFinancialCompanyStandard shortcode: shortcode ?? this.shortcode, supportProfessionalClient: supportProfessionalClient ?? this.supportProfessionalClient, + tinNotMandatory: tinNotMandatory ?? this.tinNotMandatory, ); } - /// Standard requirements model class. abstract class StandardRequirementsModel { /// Initializes Standard requirements model class . @@ -1405,16 +1425,11 @@ abstract class StandardRequirementsModel { class StandardRequirements extends StandardRequirementsModel { /// Initializes Standard requirements class. const StandardRequirements({ - RequirementsAfterFirstDeposit? afterFirstDeposit, - RequirementsCompliance? compliance, - List? signup, - List? withdrawal, - }) : super( - afterFirstDeposit: afterFirstDeposit, - compliance: compliance, - signup: signup, - withdrawal: withdrawal, - ); + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); /// Creates an instance from JSON. factory StandardRequirements.fromJson(Map json) => @@ -1484,7 +1499,6 @@ class StandardRequirements extends StandardRequirementsModel { withdrawal: withdrawal ?? this.withdrawal, ); } - /// Requirements after first deposit model class. abstract class RequirementsAfterFirstDepositModel { /// Initializes Requirements after first deposit model class . @@ -1500,10 +1514,8 @@ abstract class RequirementsAfterFirstDepositModel { class RequirementsAfterFirstDeposit extends RequirementsAfterFirstDepositModel { /// Initializes Requirements after first deposit class. const RequirementsAfterFirstDeposit({ - List? financialAssessment, - }) : super( - financialAssessment: financialAssessment, - ); + super.financialAssessment, + }); /// Creates an instance from JSON. factory RequirementsAfterFirstDeposit.fromJson(Map json) => @@ -1540,7 +1552,6 @@ class RequirementsAfterFirstDeposit extends RequirementsAfterFirstDepositModel { financialAssessment: financialAssessment ?? this.financialAssessment, ); } - /// Requirements compliance model class. abstract class RequirementsComplianceModel { /// Initializes Requirements compliance model class . @@ -1560,12 +1571,9 @@ abstract class RequirementsComplianceModel { class RequirementsCompliance extends RequirementsComplianceModel { /// Initializes Requirements compliance class. const RequirementsCompliance({ - List? mt5, - List? taxInformation, - }) : super( - mt5: mt5, - taxInformation: taxInformation, - ); + super.mt5, + super.taxInformation, + }); /// Creates an instance from JSON. factory RequirementsCompliance.fromJson(Map json) => @@ -1618,7 +1626,6 @@ class RequirementsCompliance extends RequirementsComplianceModel { taxInformation: taxInformation ?? this.taxInformation, ); } - /// Dxtrade gaming company model class. abstract class DxtradeGamingCompanyModel { /// Initializes Dxtrade gaming company model class . @@ -1634,10 +1641,8 @@ abstract class DxtradeGamingCompanyModel { class DxtradeGamingCompany extends DxtradeGamingCompanyModel { /// Initializes Dxtrade gaming company class. const DxtradeGamingCompany({ - DxtradeGamingCompanyStandard? standard, - }) : super( - standard: standard, - ); + super.standard, + }); /// Creates an instance from JSON. factory DxtradeGamingCompany.fromJson(Map json) => @@ -1666,7 +1671,6 @@ class DxtradeGamingCompany extends DxtradeGamingCompanyModel { standard: standard ?? this.standard, ); } - /// Dxtrade gaming company standard model class. abstract class DxtradeGamingCompanyStandardModel { /// Initializes Dxtrade gaming company standard model class . @@ -1684,6 +1688,7 @@ abstract class DxtradeGamingCompanyStandardModel { this.requirements, this.shortcode, this.supportProfessionalClient, + this.tinNotMandatory, }); /// Landing Company address @@ -1717,47 +1722,37 @@ abstract class DxtradeGamingCompanyStandardModel { final String? name; /// Legal requirements for the Landing Company - final StandardRequirements2? requirements; + final StandardRequirements16? requirements; /// Landing Company short code final String? shortcode; /// Flag that indicates whether the landing company supports professional accounts or not final bool? supportProfessionalClient; + + /// Flag that indicates whether tax identifier number is not mandatory for the current country and landing company. + final bool? tinNotMandatory; } /// Dxtrade gaming company standard class. class DxtradeGamingCompanyStandard extends DxtradeGamingCompanyStandardModel { /// Initializes Dxtrade gaming company standard class. const DxtradeGamingCompanyStandard({ - List? address, - Map? changeableFields, - String? country, - Map? currencyConfig, - bool? hasRealityCheck, - List? legalAllowedContractCategories, - List? legalAllowedCurrencies, - List? legalAllowedMarkets, - String? legalDefaultCurrency, - String? name, - StandardRequirements2? requirements, - String? shortcode, - bool? supportProfessionalClient, - }) : super( - address: address, - changeableFields: changeableFields, - country: country, - currencyConfig: currencyConfig, - hasRealityCheck: hasRealityCheck, - legalAllowedContractCategories: legalAllowedContractCategories, - legalAllowedCurrencies: legalAllowedCurrencies, - legalAllowedMarkets: legalAllowedMarkets, - legalDefaultCurrency: legalDefaultCurrency, - name: name, - requirements: requirements, - shortcode: shortcode, - supportProfessionalClient: supportProfessionalClient, - ); + super.address, + super.changeableFields, + super.country, + super.currencyConfig, + super.hasRealityCheck, + super.legalAllowedContractCategories, + super.legalAllowedCurrencies, + super.legalAllowedMarkets, + super.legalDefaultCurrency, + super.name, + super.requirements, + super.shortcode, + super.supportProfessionalClient, + super.tinNotMandatory, + }); /// Creates an instance from JSON. factory DxtradeGamingCompanyStandard.fromJson(Map json) => @@ -1799,9 +1794,10 @@ class DxtradeGamingCompanyStandard extends DxtradeGamingCompanyStandardModel { name: json['name'], requirements: json['requirements'] == null ? null - : StandardRequirements2.fromJson(json['requirements']), + : StandardRequirements16.fromJson(json['requirements']), shortcode: json['shortcode'], supportProfessionalClient: getBool(json['support_professional_client']), + tinNotMandatory: getBool(json['tin_not_mandatory']), ); /// Converts an instance to JSON. @@ -1848,6 +1844,7 @@ class DxtradeGamingCompanyStandard extends DxtradeGamingCompanyStandardModel { } resultMap['shortcode'] = shortcode; resultMap['support_professional_client'] = supportProfessionalClient; + resultMap['tin_not_mandatory'] = tinNotMandatory; return resultMap; } @@ -1864,9 +1861,10 @@ class DxtradeGamingCompanyStandard extends DxtradeGamingCompanyStandardModel { List? legalAllowedMarkets, String? legalDefaultCurrency, String? name, - StandardRequirements2? requirements, + StandardRequirements16? requirements, String? shortcode, bool? supportProfessionalClient, + bool? tinNotMandatory, }) => DxtradeGamingCompanyStandard( address: address ?? this.address, @@ -1885,13 +1883,13 @@ class DxtradeGamingCompanyStandard extends DxtradeGamingCompanyStandardModel { shortcode: shortcode ?? this.shortcode, supportProfessionalClient: supportProfessionalClient ?? this.supportProfessionalClient, + tinNotMandatory: tinNotMandatory ?? this.tinNotMandatory, ); } - -/// Standard requirements2 model class. -abstract class StandardRequirements2Model { - /// Initializes Standard requirements2 model class . - const StandardRequirements2Model({ +/// Standard requirements16 model class. +abstract class StandardRequirements16Model { + /// Initializes Standard requirements16 model class . + const StandardRequirements16Model({ this.afterFirstDeposit, this.compliance, this.signup, @@ -1899,10 +1897,10 @@ abstract class StandardRequirements2Model { }); /// After first deposit requirements - final RequirementsAfterFirstDeposit2? afterFirstDeposit; + final RequirementsAfterFirstDeposit14? afterFirstDeposit; /// Compliance requirements - final RequirementsCompliance2? compliance; + final RequirementsCompliance15? compliance; /// Sign up requirements final List? signup; @@ -1911,31 +1909,26 @@ abstract class StandardRequirements2Model { final List? withdrawal; } -/// Standard requirements2 class. -class StandardRequirements2 extends StandardRequirements2Model { - /// Initializes Standard requirements2 class. - const StandardRequirements2({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, - List? signup, - List? withdrawal, - }) : super( - afterFirstDeposit: afterFirstDeposit, - compliance: compliance, - signup: signup, - withdrawal: withdrawal, - ); +/// Standard requirements16 class. +class StandardRequirements16 extends StandardRequirements16Model { + /// Initializes Standard requirements16 class. + const StandardRequirements16({ + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); /// Creates an instance from JSON. - factory StandardRequirements2.fromJson(Map json) => - StandardRequirements2( + factory StandardRequirements16.fromJson(Map json) => + StandardRequirements16( afterFirstDeposit: json['after_first_deposit'] == null ? null - : RequirementsAfterFirstDeposit2.fromJson( + : RequirementsAfterFirstDeposit14.fromJson( json['after_first_deposit']), compliance: json['compliance'] == null ? null - : RequirementsCompliance2.fromJson(json['compliance']), + : RequirementsCompliance15.fromJson(json['compliance']), signup: json['signup'] == null ? null : List.from( @@ -1981,24 +1974,23 @@ class StandardRequirements2 extends StandardRequirements2Model { } /// Creates a copy of instance with given parameters. - StandardRequirements2 copyWith({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, + StandardRequirements16 copyWith({ + RequirementsAfterFirstDeposit14? afterFirstDeposit, + RequirementsCompliance15? compliance, List? signup, List? withdrawal, }) => - StandardRequirements2( + StandardRequirements16( afterFirstDeposit: afterFirstDeposit ?? this.afterFirstDeposit, compliance: compliance ?? this.compliance, signup: signup ?? this.signup, withdrawal: withdrawal ?? this.withdrawal, ); } - -/// Requirements after first deposit2 model class. -abstract class RequirementsAfterFirstDeposit2Model { - /// Initializes Requirements after first deposit2 model class . - const RequirementsAfterFirstDeposit2Model({ +/// Requirements after first deposit14 model class. +abstract class RequirementsAfterFirstDeposit14Model { + /// Initializes Requirements after first deposit14 model class . + const RequirementsAfterFirstDeposit14Model({ this.financialAssessment, }); @@ -2006,19 +1998,17 @@ abstract class RequirementsAfterFirstDeposit2Model { final List? financialAssessment; } -/// Requirements after first deposit2 class. -class RequirementsAfterFirstDeposit2 - extends RequirementsAfterFirstDeposit2Model { - /// Initializes Requirements after first deposit2 class. - const RequirementsAfterFirstDeposit2({ - List? financialAssessment, - }) : super( - financialAssessment: financialAssessment, - ); +/// Requirements after first deposit14 class. +class RequirementsAfterFirstDeposit14 + extends RequirementsAfterFirstDeposit14Model { + /// Initializes Requirements after first deposit14 class. + const RequirementsAfterFirstDeposit14({ + super.financialAssessment, + }); /// Creates an instance from JSON. - factory RequirementsAfterFirstDeposit2.fromJson(Map json) => - RequirementsAfterFirstDeposit2( + factory RequirementsAfterFirstDeposit14.fromJson(Map json) => + RequirementsAfterFirstDeposit14( financialAssessment: json['financial_assessment'] == null ? null : List.from( @@ -2044,18 +2034,17 @@ class RequirementsAfterFirstDeposit2 } /// Creates a copy of instance with given parameters. - RequirementsAfterFirstDeposit2 copyWith({ + RequirementsAfterFirstDeposit14 copyWith({ List? financialAssessment, }) => - RequirementsAfterFirstDeposit2( + RequirementsAfterFirstDeposit14( financialAssessment: financialAssessment ?? this.financialAssessment, ); } - -/// Requirements compliance2 model class. -abstract class RequirementsCompliance2Model { - /// Initializes Requirements compliance2 model class . - const RequirementsCompliance2Model({ +/// Requirements compliance15 model class. +abstract class RequirementsCompliance15Model { + /// Initializes Requirements compliance15 model class . + const RequirementsCompliance15Model({ this.mt5, this.taxInformation, }); @@ -2067,20 +2056,17 @@ abstract class RequirementsCompliance2Model { final List? taxInformation; } -/// Requirements compliance2 class. -class RequirementsCompliance2 extends RequirementsCompliance2Model { - /// Initializes Requirements compliance2 class. - const RequirementsCompliance2({ - List? mt5, - List? taxInformation, - }) : super( - mt5: mt5, - taxInformation: taxInformation, - ); +/// Requirements compliance15 class. +class RequirementsCompliance15 extends RequirementsCompliance15Model { + /// Initializes Requirements compliance15 class. + const RequirementsCompliance15({ + super.mt5, + super.taxInformation, + }); /// Creates an instance from JSON. - factory RequirementsCompliance2.fromJson(Map json) => - RequirementsCompliance2( + factory RequirementsCompliance15.fromJson(Map json) => + RequirementsCompliance15( mt5: json['mt5'] == null ? null : List.from( @@ -2120,16 +2106,15 @@ class RequirementsCompliance2 extends RequirementsCompliance2Model { } /// Creates a copy of instance with given parameters. - RequirementsCompliance2 copyWith({ + RequirementsCompliance15 copyWith({ List? mt5, List? taxInformation, }) => - RequirementsCompliance2( + RequirementsCompliance15( mt5: mt5 ?? this.mt5, taxInformation: taxInformation ?? this.taxInformation, ); } - /// Financial company model class. abstract class FinancialCompanyModel { /// Initializes Financial company model class . @@ -2147,6 +2132,7 @@ abstract class FinancialCompanyModel { this.requirements, this.shortcode, this.supportProfessionalClient, + this.tinNotMandatory, }); /// Landing Company address @@ -2187,40 +2173,30 @@ abstract class FinancialCompanyModel { /// Flag that indicates whether the landing company supports professional accounts or not final bool? supportProfessionalClient; + + /// Flag that indicates whether tax identifier number is not mandatory for the current country and landing company. + final bool? tinNotMandatory; } /// Financial company class. class FinancialCompany extends FinancialCompanyModel { /// Initializes Financial company class. const FinancialCompany({ - List? address, - Map? changeableFields, - String? country, - Map? currencyConfig, - bool? hasRealityCheck, - List? legalAllowedContractCategories, - List? legalAllowedCurrencies, - List? legalAllowedMarkets, - String? legalDefaultCurrency, - String? name, - FinancialCompanyRequirements? requirements, - String? shortcode, - bool? supportProfessionalClient, - }) : super( - address: address, - changeableFields: changeableFields, - country: country, - currencyConfig: currencyConfig, - hasRealityCheck: hasRealityCheck, - legalAllowedContractCategories: legalAllowedContractCategories, - legalAllowedCurrencies: legalAllowedCurrencies, - legalAllowedMarkets: legalAllowedMarkets, - legalDefaultCurrency: legalDefaultCurrency, - name: name, - requirements: requirements, - shortcode: shortcode, - supportProfessionalClient: supportProfessionalClient, - ); + super.address, + super.changeableFields, + super.country, + super.currencyConfig, + super.hasRealityCheck, + super.legalAllowedContractCategories, + super.legalAllowedCurrencies, + super.legalAllowedMarkets, + super.legalDefaultCurrency, + super.name, + super.requirements, + super.shortcode, + super.supportProfessionalClient, + super.tinNotMandatory, + }); /// Creates an instance from JSON. factory FinancialCompany.fromJson(Map json) => @@ -2265,6 +2241,7 @@ class FinancialCompany extends FinancialCompanyModel { : FinancialCompanyRequirements.fromJson(json['requirements']), shortcode: json['shortcode'], supportProfessionalClient: getBool(json['support_professional_client']), + tinNotMandatory: getBool(json['tin_not_mandatory']), ); /// Converts an instance to JSON. @@ -2311,6 +2288,7 @@ class FinancialCompany extends FinancialCompanyModel { } resultMap['shortcode'] = shortcode; resultMap['support_professional_client'] = supportProfessionalClient; + resultMap['tin_not_mandatory'] = tinNotMandatory; return resultMap; } @@ -2330,6 +2308,7 @@ class FinancialCompany extends FinancialCompanyModel { FinancialCompanyRequirements? requirements, String? shortcode, bool? supportProfessionalClient, + bool? tinNotMandatory, }) => FinancialCompany( address: address ?? this.address, @@ -2348,9 +2327,9 @@ class FinancialCompany extends FinancialCompanyModel { shortcode: shortcode ?? this.shortcode, supportProfessionalClient: supportProfessionalClient ?? this.supportProfessionalClient, + tinNotMandatory: tinNotMandatory ?? this.tinNotMandatory, ); } - /// Financial company requirements model class. abstract class FinancialCompanyRequirementsModel { /// Initializes Financial company requirements model class . @@ -2362,10 +2341,10 @@ abstract class FinancialCompanyRequirementsModel { }); /// After first deposit requirements - final RequirementsAfterFirstDeposit2? afterFirstDeposit; + final RequirementsAfterFirstDeposit19? afterFirstDeposit; /// Compliance requirements - final RequirementsCompliance2? compliance; + final RequirementsCompliance20? compliance; /// Sign up requirements final List? signup; @@ -2378,27 +2357,22 @@ abstract class FinancialCompanyRequirementsModel { class FinancialCompanyRequirements extends FinancialCompanyRequirementsModel { /// Initializes Financial company requirements class. const FinancialCompanyRequirements({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, - List? signup, - List? withdrawal, - }) : super( - afterFirstDeposit: afterFirstDeposit, - compliance: compliance, - signup: signup, - withdrawal: withdrawal, - ); + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); /// Creates an instance from JSON. factory FinancialCompanyRequirements.fromJson(Map json) => FinancialCompanyRequirements( afterFirstDeposit: json['after_first_deposit'] == null ? null - : RequirementsAfterFirstDeposit2.fromJson( + : RequirementsAfterFirstDeposit19.fromJson( json['after_first_deposit']), compliance: json['compliance'] == null ? null - : RequirementsCompliance2.fromJson(json['compliance']), + : RequirementsCompliance20.fromJson(json['compliance']), signup: json['signup'] == null ? null : List.from( @@ -2445,8 +2419,8 @@ class FinancialCompanyRequirements extends FinancialCompanyRequirementsModel { /// Creates a copy of instance with given parameters. FinancialCompanyRequirements copyWith({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, + RequirementsAfterFirstDeposit19? afterFirstDeposit, + RequirementsCompliance20? compliance, List? signup, List? withdrawal, }) => @@ -2457,14 +2431,141 @@ class FinancialCompanyRequirements extends FinancialCompanyRequirementsModel { withdrawal: withdrawal ?? this.withdrawal, ); } +/// Requirements after first deposit19 model class. +abstract class RequirementsAfterFirstDeposit19Model { + /// Initializes Requirements after first deposit19 model class . + const RequirementsAfterFirstDeposit19Model({ + this.financialAssessment, + }); -/// Gaming company model class. -abstract class GamingCompanyModel { - /// Initializes Gaming company model class . - const GamingCompanyModel({ - this.address, - this.changeableFields, - this.country, + /// Financial assessment requirements + final List? financialAssessment; +} + +/// Requirements after first deposit19 class. +class RequirementsAfterFirstDeposit19 + extends RequirementsAfterFirstDeposit19Model { + /// Initializes Requirements after first deposit19 class. + const RequirementsAfterFirstDeposit19({ + super.financialAssessment, + }); + + /// Creates an instance from JSON. + factory RequirementsAfterFirstDeposit19.fromJson(Map json) => + RequirementsAfterFirstDeposit19( + financialAssessment: json['financial_assessment'] == null + ? null + : List.from( + json['financial_assessment']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (financialAssessment != null) { + resultMap['financial_assessment'] = financialAssessment! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + RequirementsAfterFirstDeposit19 copyWith({ + List? financialAssessment, + }) => + RequirementsAfterFirstDeposit19( + financialAssessment: financialAssessment ?? this.financialAssessment, + ); +} +/// Requirements compliance20 model class. +abstract class RequirementsCompliance20Model { + /// Initializes Requirements compliance20 model class . + const RequirementsCompliance20Model({ + this.mt5, + this.taxInformation, + }); + + /// Compliance MT5 requirements + final List? mt5; + + /// Compliance tax information requirements + final List? taxInformation; +} + +/// Requirements compliance20 class. +class RequirementsCompliance20 extends RequirementsCompliance20Model { + /// Initializes Requirements compliance20 class. + const RequirementsCompliance20({ + super.mt5, + super.taxInformation, + }); + + /// Creates an instance from JSON. + factory RequirementsCompliance20.fromJson(Map json) => + RequirementsCompliance20( + mt5: json['mt5'] == null + ? null + : List.from( + json['mt5']?.map( + (dynamic item) => item, + ), + ), + taxInformation: json['tax_information'] == null + ? null + : List.from( + json['tax_information']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (mt5 != null) { + resultMap['mt5'] = mt5! + .map( + (String item) => item, + ) + .toList(); + } + if (taxInformation != null) { + resultMap['tax_information'] = taxInformation! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + RequirementsCompliance20 copyWith({ + List? mt5, + List? taxInformation, + }) => + RequirementsCompliance20( + mt5: mt5 ?? this.mt5, + taxInformation: taxInformation ?? this.taxInformation, + ); +} +/// Gaming company model class. +abstract class GamingCompanyModel { + /// Initializes Gaming company model class . + const GamingCompanyModel({ + this.address, + this.changeableFields, + this.country, this.currencyConfig, this.hasRealityCheck, this.legalAllowedContractCategories, @@ -2475,6 +2576,7 @@ abstract class GamingCompanyModel { this.requirements, this.shortcode, this.supportProfessionalClient, + this.tinNotMandatory, }); /// Landing Company address @@ -2515,12 +2617,127 @@ abstract class GamingCompanyModel { /// Flag that indicates whether the landing company supports professional accounts or not final bool? supportProfessionalClient; + + /// Flag that indicates whether tax identifier number is not mandatory for the current country and landing company. + final bool? tinNotMandatory; } /// Gaming company class. class GamingCompany extends GamingCompanyModel { /// Initializes Gaming company class. const GamingCompany({ + super.address, + super.changeableFields, + super.country, + super.currencyConfig, + super.hasRealityCheck, + super.legalAllowedContractCategories, + super.legalAllowedCurrencies, + super.legalAllowedMarkets, + super.legalDefaultCurrency, + super.name, + super.requirements, + super.shortcode, + super.supportProfessionalClient, + super.tinNotMandatory, + }); + + /// Creates an instance from JSON. + factory GamingCompany.fromJson(Map json) => GamingCompany( + address: json['address'] == null + ? null + : List.from( + json['address']?.map( + (dynamic item) => item, + ), + ), + changeableFields: json['changeable_fields'], + country: json['country'], + currencyConfig: json['currency_config'], + hasRealityCheck: getBool(json['has_reality_check']), + legalAllowedContractCategories: + json['legal_allowed_contract_categories'] == null + ? null + : List.from( + json['legal_allowed_contract_categories']?.map( + (dynamic item) => item, + ), + ), + legalAllowedCurrencies: json['legal_allowed_currencies'] == null + ? null + : List.from( + json['legal_allowed_currencies']?.map( + (dynamic item) => item, + ), + ), + legalAllowedMarkets: json['legal_allowed_markets'] == null + ? null + : List.from( + json['legal_allowed_markets']?.map( + (dynamic item) => item, + ), + ), + legalDefaultCurrency: json['legal_default_currency'], + name: json['name'], + requirements: json['requirements'] == null + ? null + : GamingCompanyRequirements.fromJson(json['requirements']), + shortcode: json['shortcode'], + supportProfessionalClient: getBool(json['support_professional_client']), + tinNotMandatory: getBool(json['tin_not_mandatory']), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (address != null) { + resultMap['address'] = address! + .map( + (String item) => item, + ) + .toList(); + } + resultMap['changeable_fields'] = changeableFields; + resultMap['country'] = country; + resultMap['currency_config'] = currencyConfig; + resultMap['has_reality_check'] = hasRealityCheck; + if (legalAllowedContractCategories != null) { + resultMap['legal_allowed_contract_categories'] = + legalAllowedContractCategories! + .map( + (String item) => item, + ) + .toList(); + } + if (legalAllowedCurrencies != null) { + resultMap['legal_allowed_currencies'] = legalAllowedCurrencies! + .map( + (String item) => item, + ) + .toList(); + } + if (legalAllowedMarkets != null) { + resultMap['legal_allowed_markets'] = legalAllowedMarkets! + .map( + (String item) => item, + ) + .toList(); + } + resultMap['legal_default_currency'] = legalDefaultCurrency; + resultMap['name'] = name; + if (requirements != null) { + resultMap['requirements'] = requirements!.toJson(); + } + resultMap['shortcode'] = shortcode; + resultMap['support_professional_client'] = supportProfessionalClient; + resultMap['tin_not_mandatory'] = tinNotMandatory; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + GamingCompany copyWith({ List? address, Map? changeableFields, String? country, @@ -2534,24 +2751,386 @@ class GamingCompany extends GamingCompanyModel { GamingCompanyRequirements? requirements, String? shortcode, bool? supportProfessionalClient, - }) : super( - address: address, - changeableFields: changeableFields, - country: country, - currencyConfig: currencyConfig, - hasRealityCheck: hasRealityCheck, - legalAllowedContractCategories: legalAllowedContractCategories, - legalAllowedCurrencies: legalAllowedCurrencies, - legalAllowedMarkets: legalAllowedMarkets, - legalDefaultCurrency: legalDefaultCurrency, - name: name, - requirements: requirements, - shortcode: shortcode, - supportProfessionalClient: supportProfessionalClient, - ); + bool? tinNotMandatory, + }) => + GamingCompany( + address: address ?? this.address, + changeableFields: changeableFields ?? this.changeableFields, + country: country ?? this.country, + currencyConfig: currencyConfig ?? this.currencyConfig, + hasRealityCheck: hasRealityCheck ?? this.hasRealityCheck, + legalAllowedContractCategories: legalAllowedContractCategories ?? + this.legalAllowedContractCategories, + legalAllowedCurrencies: + legalAllowedCurrencies ?? this.legalAllowedCurrencies, + legalAllowedMarkets: legalAllowedMarkets ?? this.legalAllowedMarkets, + legalDefaultCurrency: legalDefaultCurrency ?? this.legalDefaultCurrency, + name: name ?? this.name, + requirements: requirements ?? this.requirements, + shortcode: shortcode ?? this.shortcode, + supportProfessionalClient: + supportProfessionalClient ?? this.supportProfessionalClient, + tinNotMandatory: tinNotMandatory ?? this.tinNotMandatory, + ); +} +/// Gaming company requirements model class. +abstract class GamingCompanyRequirementsModel { + /// Initializes Gaming company requirements model class . + const GamingCompanyRequirementsModel({ + this.afterFirstDeposit, + this.compliance, + this.signup, + this.withdrawal, + }); + + /// After first deposit requirements + final RequirementsAfterFirstDeposit23? afterFirstDeposit; + + /// Compliance requirements + final RequirementsCompliance24? compliance; + + /// Sign up requirements + final List? signup; + + /// Withdrawal requirements + final List? withdrawal; +} + +/// Gaming company requirements class. +class GamingCompanyRequirements extends GamingCompanyRequirementsModel { + /// Initializes Gaming company requirements class. + const GamingCompanyRequirements({ + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); + + /// Creates an instance from JSON. + factory GamingCompanyRequirements.fromJson(Map json) => + GamingCompanyRequirements( + afterFirstDeposit: json['after_first_deposit'] == null + ? null + : RequirementsAfterFirstDeposit23.fromJson( + json['after_first_deposit']), + compliance: json['compliance'] == null + ? null + : RequirementsCompliance24.fromJson(json['compliance']), + signup: json['signup'] == null + ? null + : List.from( + json['signup']?.map( + (dynamic item) => item, + ), + ), + withdrawal: json['withdrawal'] == null + ? null + : List.from( + json['withdrawal']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (afterFirstDeposit != null) { + resultMap['after_first_deposit'] = afterFirstDeposit!.toJson(); + } + if (compliance != null) { + resultMap['compliance'] = compliance!.toJson(); + } + if (signup != null) { + resultMap['signup'] = signup! + .map( + (String item) => item, + ) + .toList(); + } + if (withdrawal != null) { + resultMap['withdrawal'] = withdrawal! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + GamingCompanyRequirements copyWith({ + RequirementsAfterFirstDeposit23? afterFirstDeposit, + RequirementsCompliance24? compliance, + List? signup, + List? withdrawal, + }) => + GamingCompanyRequirements( + afterFirstDeposit: afterFirstDeposit ?? this.afterFirstDeposit, + compliance: compliance ?? this.compliance, + signup: signup ?? this.signup, + withdrawal: withdrawal ?? this.withdrawal, + ); +} +/// Requirements after first deposit23 model class. +abstract class RequirementsAfterFirstDeposit23Model { + /// Initializes Requirements after first deposit23 model class . + const RequirementsAfterFirstDeposit23Model({ + this.financialAssessment, + }); + + /// Financial assessment requirements + final List? financialAssessment; +} + +/// Requirements after first deposit23 class. +class RequirementsAfterFirstDeposit23 + extends RequirementsAfterFirstDeposit23Model { + /// Initializes Requirements after first deposit23 class. + const RequirementsAfterFirstDeposit23({ + super.financialAssessment, + }); + + /// Creates an instance from JSON. + factory RequirementsAfterFirstDeposit23.fromJson(Map json) => + RequirementsAfterFirstDeposit23( + financialAssessment: json['financial_assessment'] == null + ? null + : List.from( + json['financial_assessment']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (financialAssessment != null) { + resultMap['financial_assessment'] = financialAssessment! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + RequirementsAfterFirstDeposit23 copyWith({ + List? financialAssessment, + }) => + RequirementsAfterFirstDeposit23( + financialAssessment: financialAssessment ?? this.financialAssessment, + ); +} +/// Requirements compliance24 model class. +abstract class RequirementsCompliance24Model { + /// Initializes Requirements compliance24 model class . + const RequirementsCompliance24Model({ + this.mt5, + this.taxInformation, + }); + + /// Compliance MT5 requirements + final List? mt5; + + /// Compliance tax information requirements + final List? taxInformation; +} + +/// Requirements compliance24 class. +class RequirementsCompliance24 extends RequirementsCompliance24Model { + /// Initializes Requirements compliance24 class. + const RequirementsCompliance24({ + super.mt5, + super.taxInformation, + }); + + /// Creates an instance from JSON. + factory RequirementsCompliance24.fromJson(Map json) => + RequirementsCompliance24( + mt5: json['mt5'] == null + ? null + : List.from( + json['mt5']?.map( + (dynamic item) => item, + ), + ), + taxInformation: json['tax_information'] == null + ? null + : List.from( + json['tax_information']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (mt5 != null) { + resultMap['mt5'] = mt5! + .map( + (String item) => item, + ) + .toList(); + } + if (taxInformation != null) { + resultMap['tax_information'] = taxInformation! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + RequirementsCompliance24 copyWith({ + List? mt5, + List? taxInformation, + }) => + RequirementsCompliance24( + mt5: mt5 ?? this.mt5, + taxInformation: taxInformation ?? this.taxInformation, + ); +} +/// Mt all company model class. +abstract class MtAllCompanyModel { + /// Initializes Mt all company model class . + const MtAllCompanyModel({ + this.swapFree, + }); + + /// Landing Company for MT5 combined all Synthetic and financial + final SwapFree? swapFree; +} + +/// Mt all company class. +class MtAllCompany extends MtAllCompanyModel { + /// Initializes Mt all company class. + const MtAllCompany({ + super.swapFree, + }); + + /// Creates an instance from JSON. + factory MtAllCompany.fromJson(Map json) => MtAllCompany( + swapFree: json['swap_free'] == null + ? null + : SwapFree.fromJson(json['swap_free']), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (swapFree != null) { + resultMap['swap_free'] = swapFree!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + MtAllCompany copyWith({ + SwapFree? swapFree, + }) => + MtAllCompany( + swapFree: swapFree ?? this.swapFree, + ); +} +/// Swap free model class. +abstract class SwapFreeModel { + /// Initializes Swap free model class . + const SwapFreeModel({ + this.address, + this.changeableFields, + this.country, + this.currencyConfig, + this.hasRealityCheck, + this.legalAllowedContractCategories, + this.legalAllowedCurrencies, + this.legalAllowedMarkets, + this.legalDefaultCurrency, + this.name, + this.requirements, + this.shortcode, + this.supportProfessionalClient, + this.tinNotMandatory, + }); + + /// Landing Company address + final List? address; + + /// Special conditions for changing sensitive fields + final Map? changeableFields; + + /// Landing Company country of incorporation + final String? country; + + /// The configuration of each currency. + final Map? currencyConfig; + + /// Flag to indicate whether reality check is applicable for this Landing Company. `true`: applicable, `false`: not applicable. The Reality Check is a feature that gives a summary of the client's trades and account balances on a regular basis throughout his session, and is a regulatory requirement for certain Landing Companies. + final bool? hasRealityCheck; + + /// Allowed contract types + final List? legalAllowedContractCategories; + + /// Allowable currencies + final List? legalAllowedCurrencies; + + /// Allowable markets + final List? legalAllowedMarkets; + + /// Default account currency + final String? legalDefaultCurrency; + + /// Landing Company legal name + final String? name; + + /// Legal requirements for the Landing Company + final SwapFreeRequirements? requirements; + + /// Landing Company short code + final String? shortcode; + + /// Flag that indicates whether the landing company supports professional accounts or not + final bool? supportProfessionalClient; + + /// Flag that indicates whether tax identifier number is not mandatory for the current country and landing company. + final bool? tinNotMandatory; +} + +/// Swap free class. +class SwapFree extends SwapFreeModel { + /// Initializes Swap free class. + const SwapFree({ + super.address, + super.changeableFields, + super.country, + super.currencyConfig, + super.hasRealityCheck, + super.legalAllowedContractCategories, + super.legalAllowedCurrencies, + super.legalAllowedMarkets, + super.legalDefaultCurrency, + super.name, + super.requirements, + super.shortcode, + super.supportProfessionalClient, + super.tinNotMandatory, + }); /// Creates an instance from JSON. - factory GamingCompany.fromJson(Map json) => GamingCompany( + factory SwapFree.fromJson(Map json) => SwapFree( address: json['address'] == null ? null : List.from( @@ -2589,9 +3168,10 @@ class GamingCompany extends GamingCompanyModel { name: json['name'], requirements: json['requirements'] == null ? null - : GamingCompanyRequirements.fromJson(json['requirements']), + : SwapFreeRequirements.fromJson(json['requirements']), shortcode: json['shortcode'], supportProfessionalClient: getBool(json['support_professional_client']), + tinNotMandatory: getBool(json['tin_not_mandatory']), ); /// Converts an instance to JSON. @@ -2638,12 +3218,13 @@ class GamingCompany extends GamingCompanyModel { } resultMap['shortcode'] = shortcode; resultMap['support_professional_client'] = supportProfessionalClient; + resultMap['tin_not_mandatory'] = tinNotMandatory; return resultMap; } /// Creates a copy of instance with given parameters. - GamingCompany copyWith({ + SwapFree copyWith({ List? address, Map? changeableFields, String? country, @@ -2654,11 +3235,12 @@ class GamingCompany extends GamingCompanyModel { List? legalAllowedMarkets, String? legalDefaultCurrency, String? name, - GamingCompanyRequirements? requirements, + SwapFreeRequirements? requirements, String? shortcode, bool? supportProfessionalClient, + bool? tinNotMandatory, }) => - GamingCompany( + SwapFree( address: address ?? this.address, changeableFields: changeableFields ?? this.changeableFields, country: country ?? this.country, @@ -2675,13 +3257,13 @@ class GamingCompany extends GamingCompanyModel { shortcode: shortcode ?? this.shortcode, supportProfessionalClient: supportProfessionalClient ?? this.supportProfessionalClient, + tinNotMandatory: tinNotMandatory ?? this.tinNotMandatory, ); } - -/// Gaming company requirements model class. -abstract class GamingCompanyRequirementsModel { - /// Initializes Gaming company requirements model class . - const GamingCompanyRequirementsModel({ +/// Swap free requirements model class. +abstract class SwapFreeRequirementsModel { + /// Initializes Swap free requirements model class . + const SwapFreeRequirementsModel({ this.afterFirstDeposit, this.compliance, this.signup, @@ -2689,10 +3271,10 @@ abstract class GamingCompanyRequirementsModel { }); /// After first deposit requirements - final RequirementsAfterFirstDeposit2? afterFirstDeposit; + final RequirementsAfterFirstDeposit27? afterFirstDeposit; /// Compliance requirements - final RequirementsCompliance2? compliance; + final RequirementsCompliance28? compliance; /// Sign up requirements final List? signup; @@ -2701,31 +3283,26 @@ abstract class GamingCompanyRequirementsModel { final List? withdrawal; } -/// Gaming company requirements class. -class GamingCompanyRequirements extends GamingCompanyRequirementsModel { - /// Initializes Gaming company requirements class. - const GamingCompanyRequirements({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, - List? signup, - List? withdrawal, - }) : super( - afterFirstDeposit: afterFirstDeposit, - compliance: compliance, - signup: signup, - withdrawal: withdrawal, - ); +/// Swap free requirements class. +class SwapFreeRequirements extends SwapFreeRequirementsModel { + /// Initializes Swap free requirements class. + const SwapFreeRequirements({ + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); /// Creates an instance from JSON. - factory GamingCompanyRequirements.fromJson(Map json) => - GamingCompanyRequirements( + factory SwapFreeRequirements.fromJson(Map json) => + SwapFreeRequirements( afterFirstDeposit: json['after_first_deposit'] == null ? null - : RequirementsAfterFirstDeposit2.fromJson( + : RequirementsAfterFirstDeposit27.fromJson( json['after_first_deposit']), compliance: json['compliance'] == null ? null - : RequirementsCompliance2.fromJson(json['compliance']), + : RequirementsCompliance28.fromJson(json['compliance']), signup: json['signup'] == null ? null : List.from( @@ -2771,20 +3348,147 @@ class GamingCompanyRequirements extends GamingCompanyRequirementsModel { } /// Creates a copy of instance with given parameters. - GamingCompanyRequirements copyWith({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, + SwapFreeRequirements copyWith({ + RequirementsAfterFirstDeposit27? afterFirstDeposit, + RequirementsCompliance28? compliance, List? signup, List? withdrawal, }) => - GamingCompanyRequirements( + SwapFreeRequirements( afterFirstDeposit: afterFirstDeposit ?? this.afterFirstDeposit, compliance: compliance ?? this.compliance, signup: signup ?? this.signup, withdrawal: withdrawal ?? this.withdrawal, ); } +/// Requirements after first deposit27 model class. +abstract class RequirementsAfterFirstDeposit27Model { + /// Initializes Requirements after first deposit27 model class . + const RequirementsAfterFirstDeposit27Model({ + this.financialAssessment, + }); + + /// Financial assessment requirements + final List? financialAssessment; +} + +/// Requirements after first deposit27 class. +class RequirementsAfterFirstDeposit27 + extends RequirementsAfterFirstDeposit27Model { + /// Initializes Requirements after first deposit27 class. + const RequirementsAfterFirstDeposit27({ + super.financialAssessment, + }); + + /// Creates an instance from JSON. + factory RequirementsAfterFirstDeposit27.fromJson(Map json) => + RequirementsAfterFirstDeposit27( + financialAssessment: json['financial_assessment'] == null + ? null + : List.from( + json['financial_assessment']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (financialAssessment != null) { + resultMap['financial_assessment'] = financialAssessment! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + RequirementsAfterFirstDeposit27 copyWith({ + List? financialAssessment, + }) => + RequirementsAfterFirstDeposit27( + financialAssessment: financialAssessment ?? this.financialAssessment, + ); +} +/// Requirements compliance28 model class. +abstract class RequirementsCompliance28Model { + /// Initializes Requirements compliance28 model class . + const RequirementsCompliance28Model({ + this.mt5, + this.taxInformation, + }); + + /// Compliance MT5 requirements + final List? mt5; + + /// Compliance tax information requirements + final List? taxInformation; +} + +/// Requirements compliance28 class. +class RequirementsCompliance28 extends RequirementsCompliance28Model { + /// Initializes Requirements compliance28 class. + const RequirementsCompliance28({ + super.mt5, + super.taxInformation, + }); + + /// Creates an instance from JSON. + factory RequirementsCompliance28.fromJson(Map json) => + RequirementsCompliance28( + mt5: json['mt5'] == null + ? null + : List.from( + json['mt5']?.map( + (dynamic item) => item, + ), + ), + taxInformation: json['tax_information'] == null + ? null + : List.from( + json['tax_information']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (mt5 != null) { + resultMap['mt5'] = mt5! + .map( + (String item) => item, + ) + .toList(); + } + if (taxInformation != null) { + resultMap['tax_information'] = taxInformation! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + /// Creates a copy of instance with given parameters. + RequirementsCompliance28 copyWith({ + List? mt5, + List? taxInformation, + }) => + RequirementsCompliance28( + mt5: mt5 ?? this.mt5, + taxInformation: taxInformation ?? this.taxInformation, + ); +} /// Mt financial company model class. abstract class MtFinancialCompanyModel { /// Initializes Mt financial company model class . @@ -2804,12 +3508,9 @@ abstract class MtFinancialCompanyModel { class MtFinancialCompany extends MtFinancialCompanyModel { /// Initializes Mt financial company class. const MtFinancialCompany({ - Financial? financial, - FinancialStp? financialStp, - }) : super( - financial: financial, - financialStp: financialStp, - ); + super.financial, + super.financialStp, + }); /// Creates an instance from JSON. factory MtFinancialCompany.fromJson(Map json) => @@ -2846,7 +3547,6 @@ class MtFinancialCompany extends MtFinancialCompanyModel { financialStp: financialStp ?? this.financialStp, ); } - /// Financial model class. abstract class FinancialModel { /// Initializes Financial model class . @@ -2864,6 +3564,7 @@ abstract class FinancialModel { this.requirements, this.shortcode, this.supportProfessionalClient, + this.tinNotMandatory, }); /// Landing Company address @@ -2904,40 +3605,30 @@ abstract class FinancialModel { /// Flag that indicates whether the landing company supports professional accounts or not final bool? supportProfessionalClient; + + /// Flag that indicates whether tax identifier number is not mandatory for the current country and landing company. + final bool? tinNotMandatory; } /// Financial class. class Financial extends FinancialModel { /// Initializes Financial class. const Financial({ - List? address, - Map? changeableFields, - String? country, - Map? currencyConfig, - bool? hasRealityCheck, - List? legalAllowedContractCategories, - List? legalAllowedCurrencies, - List? legalAllowedMarkets, - String? legalDefaultCurrency, - String? name, - FinancialRequirements? requirements, - String? shortcode, - bool? supportProfessionalClient, - }) : super( - address: address, - changeableFields: changeableFields, - country: country, - currencyConfig: currencyConfig, - hasRealityCheck: hasRealityCheck, - legalAllowedContractCategories: legalAllowedContractCategories, - legalAllowedCurrencies: legalAllowedCurrencies, - legalAllowedMarkets: legalAllowedMarkets, - legalDefaultCurrency: legalDefaultCurrency, - name: name, - requirements: requirements, - shortcode: shortcode, - supportProfessionalClient: supportProfessionalClient, - ); + super.address, + super.changeableFields, + super.country, + super.currencyConfig, + super.hasRealityCheck, + super.legalAllowedContractCategories, + super.legalAllowedCurrencies, + super.legalAllowedMarkets, + super.legalDefaultCurrency, + super.name, + super.requirements, + super.shortcode, + super.supportProfessionalClient, + super.tinNotMandatory, + }); /// Creates an instance from JSON. factory Financial.fromJson(Map json) => Financial( @@ -2981,6 +3672,7 @@ class Financial extends FinancialModel { : FinancialRequirements.fromJson(json['requirements']), shortcode: json['shortcode'], supportProfessionalClient: getBool(json['support_professional_client']), + tinNotMandatory: getBool(json['tin_not_mandatory']), ); /// Converts an instance to JSON. @@ -3027,6 +3719,7 @@ class Financial extends FinancialModel { } resultMap['shortcode'] = shortcode; resultMap['support_professional_client'] = supportProfessionalClient; + resultMap['tin_not_mandatory'] = tinNotMandatory; return resultMap; } @@ -3046,6 +3739,7 @@ class Financial extends FinancialModel { FinancialRequirements? requirements, String? shortcode, bool? supportProfessionalClient, + bool? tinNotMandatory, }) => Financial( address: address ?? this.address, @@ -3064,9 +3758,9 @@ class Financial extends FinancialModel { shortcode: shortcode ?? this.shortcode, supportProfessionalClient: supportProfessionalClient ?? this.supportProfessionalClient, + tinNotMandatory: tinNotMandatory ?? this.tinNotMandatory, ); } - /// Financial requirements model class. abstract class FinancialRequirementsModel { /// Initializes Financial requirements model class . @@ -3078,10 +3772,10 @@ abstract class FinancialRequirementsModel { }); /// After first deposit requirements - final RequirementsAfterFirstDeposit2? afterFirstDeposit; + final RequirementsAfterFirstDeposit32? afterFirstDeposit; /// Compliance requirements - final RequirementsCompliance2? compliance; + final RequirementsCompliance33? compliance; /// Sign up requirements final List? signup; @@ -3094,27 +3788,22 @@ abstract class FinancialRequirementsModel { class FinancialRequirements extends FinancialRequirementsModel { /// Initializes Financial requirements class. const FinancialRequirements({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, - List? signup, - List? withdrawal, - }) : super( - afterFirstDeposit: afterFirstDeposit, - compliance: compliance, - signup: signup, - withdrawal: withdrawal, - ); + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); /// Creates an instance from JSON. factory FinancialRequirements.fromJson(Map json) => FinancialRequirements( afterFirstDeposit: json['after_first_deposit'] == null ? null - : RequirementsAfterFirstDeposit2.fromJson( + : RequirementsAfterFirstDeposit32.fromJson( json['after_first_deposit']), compliance: json['compliance'] == null ? null - : RequirementsCompliance2.fromJson(json['compliance']), + : RequirementsCompliance33.fromJson(json['compliance']), signup: json['signup'] == null ? null : List.from( @@ -3148,8 +3837,140 @@ class FinancialRequirements extends FinancialRequirementsModel { ) .toList(); } - if (withdrawal != null) { - resultMap['withdrawal'] = withdrawal! + if (withdrawal != null) { + resultMap['withdrawal'] = withdrawal! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + FinancialRequirements copyWith({ + RequirementsAfterFirstDeposit32? afterFirstDeposit, + RequirementsCompliance33? compliance, + List? signup, + List? withdrawal, + }) => + FinancialRequirements( + afterFirstDeposit: afterFirstDeposit ?? this.afterFirstDeposit, + compliance: compliance ?? this.compliance, + signup: signup ?? this.signup, + withdrawal: withdrawal ?? this.withdrawal, + ); +} +/// Requirements after first deposit32 model class. +abstract class RequirementsAfterFirstDeposit32Model { + /// Initializes Requirements after first deposit32 model class . + const RequirementsAfterFirstDeposit32Model({ + this.financialAssessment, + }); + + /// Financial assessment requirements + final List? financialAssessment; +} + +/// Requirements after first deposit32 class. +class RequirementsAfterFirstDeposit32 + extends RequirementsAfterFirstDeposit32Model { + /// Initializes Requirements after first deposit32 class. + const RequirementsAfterFirstDeposit32({ + super.financialAssessment, + }); + + /// Creates an instance from JSON. + factory RequirementsAfterFirstDeposit32.fromJson(Map json) => + RequirementsAfterFirstDeposit32( + financialAssessment: json['financial_assessment'] == null + ? null + : List.from( + json['financial_assessment']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (financialAssessment != null) { + resultMap['financial_assessment'] = financialAssessment! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + RequirementsAfterFirstDeposit32 copyWith({ + List? financialAssessment, + }) => + RequirementsAfterFirstDeposit32( + financialAssessment: financialAssessment ?? this.financialAssessment, + ); +} +/// Requirements compliance33 model class. +abstract class RequirementsCompliance33Model { + /// Initializes Requirements compliance33 model class . + const RequirementsCompliance33Model({ + this.mt5, + this.taxInformation, + }); + + /// Compliance MT5 requirements + final List? mt5; + + /// Compliance tax information requirements + final List? taxInformation; +} + +/// Requirements compliance33 class. +class RequirementsCompliance33 extends RequirementsCompliance33Model { + /// Initializes Requirements compliance33 class. + const RequirementsCompliance33({ + super.mt5, + super.taxInformation, + }); + + /// Creates an instance from JSON. + factory RequirementsCompliance33.fromJson(Map json) => + RequirementsCompliance33( + mt5: json['mt5'] == null + ? null + : List.from( + json['mt5']?.map( + (dynamic item) => item, + ), + ), + taxInformation: json['tax_information'] == null + ? null + : List.from( + json['tax_information']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (mt5 != null) { + resultMap['mt5'] = mt5! + .map( + (String item) => item, + ) + .toList(); + } + if (taxInformation != null) { + resultMap['tax_information'] = taxInformation! .map( (String item) => item, ) @@ -3160,20 +3981,15 @@ class FinancialRequirements extends FinancialRequirementsModel { } /// Creates a copy of instance with given parameters. - FinancialRequirements copyWith({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, - List? signup, - List? withdrawal, + RequirementsCompliance33 copyWith({ + List? mt5, + List? taxInformation, }) => - FinancialRequirements( - afterFirstDeposit: afterFirstDeposit ?? this.afterFirstDeposit, - compliance: compliance ?? this.compliance, - signup: signup ?? this.signup, - withdrawal: withdrawal ?? this.withdrawal, + RequirementsCompliance33( + mt5: mt5 ?? this.mt5, + taxInformation: taxInformation ?? this.taxInformation, ); } - /// Financial stp model class. abstract class FinancialStpModel { /// Initializes Financial stp model class . @@ -3191,6 +4007,7 @@ abstract class FinancialStpModel { this.requirements, this.shortcode, this.supportProfessionalClient, + this.tinNotMandatory, }); /// Landing Company address @@ -3231,40 +4048,30 @@ abstract class FinancialStpModel { /// Flag that indicates whether the landing company supports professional accounts or not final bool? supportProfessionalClient; + + /// Flag that indicates whether tax identifier number is not mandatory for the current country and landing company. + final bool? tinNotMandatory; } /// Financial stp class. class FinancialStp extends FinancialStpModel { /// Initializes Financial stp class. const FinancialStp({ - List? address, - Map? changeableFields, - String? country, - Map? currencyConfig, - bool? hasRealityCheck, - List? legalAllowedContractCategories, - List? legalAllowedCurrencies, - List? legalAllowedMarkets, - String? legalDefaultCurrency, - String? name, - FinancialStpRequirements? requirements, - String? shortcode, - bool? supportProfessionalClient, - }) : super( - address: address, - changeableFields: changeableFields, - country: country, - currencyConfig: currencyConfig, - hasRealityCheck: hasRealityCheck, - legalAllowedContractCategories: legalAllowedContractCategories, - legalAllowedCurrencies: legalAllowedCurrencies, - legalAllowedMarkets: legalAllowedMarkets, - legalDefaultCurrency: legalDefaultCurrency, - name: name, - requirements: requirements, - shortcode: shortcode, - supportProfessionalClient: supportProfessionalClient, - ); + super.address, + super.changeableFields, + super.country, + super.currencyConfig, + super.hasRealityCheck, + super.legalAllowedContractCategories, + super.legalAllowedCurrencies, + super.legalAllowedMarkets, + super.legalDefaultCurrency, + super.name, + super.requirements, + super.shortcode, + super.supportProfessionalClient, + super.tinNotMandatory, + }); /// Creates an instance from JSON. factory FinancialStp.fromJson(Map json) => FinancialStp( @@ -3308,6 +4115,7 @@ class FinancialStp extends FinancialStpModel { : FinancialStpRequirements.fromJson(json['requirements']), shortcode: json['shortcode'], supportProfessionalClient: getBool(json['support_professional_client']), + tinNotMandatory: getBool(json['tin_not_mandatory']), ); /// Converts an instance to JSON. @@ -3354,6 +4162,7 @@ class FinancialStp extends FinancialStpModel { } resultMap['shortcode'] = shortcode; resultMap['support_professional_client'] = supportProfessionalClient; + resultMap['tin_not_mandatory'] = tinNotMandatory; return resultMap; } @@ -3373,6 +4182,7 @@ class FinancialStp extends FinancialStpModel { FinancialStpRequirements? requirements, String? shortcode, bool? supportProfessionalClient, + bool? tinNotMandatory, }) => FinancialStp( address: address ?? this.address, @@ -3391,9 +4201,9 @@ class FinancialStp extends FinancialStpModel { shortcode: shortcode ?? this.shortcode, supportProfessionalClient: supportProfessionalClient ?? this.supportProfessionalClient, + tinNotMandatory: tinNotMandatory ?? this.tinNotMandatory, ); } - /// Financial stp requirements model class. abstract class FinancialStpRequirementsModel { /// Initializes Financial stp requirements model class . @@ -3405,10 +4215,10 @@ abstract class FinancialStpRequirementsModel { }); /// After first deposit requirements - final RequirementsAfterFirstDeposit2? afterFirstDeposit; + final RequirementsAfterFirstDeposit36? afterFirstDeposit; /// Compliance requirements - final RequirementsCompliance2? compliance; + final RequirementsCompliance37? compliance; /// Sign up requirements final List? signup; @@ -3421,27 +4231,22 @@ abstract class FinancialStpRequirementsModel { class FinancialStpRequirements extends FinancialStpRequirementsModel { /// Initializes Financial stp requirements class. const FinancialStpRequirements({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, - List? signup, - List? withdrawal, - }) : super( - afterFirstDeposit: afterFirstDeposit, - compliance: compliance, - signup: signup, - withdrawal: withdrawal, - ); + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); /// Creates an instance from JSON. factory FinancialStpRequirements.fromJson(Map json) => FinancialStpRequirements( afterFirstDeposit: json['after_first_deposit'] == null ? null - : RequirementsAfterFirstDeposit2.fromJson( + : RequirementsAfterFirstDeposit36.fromJson( json['after_first_deposit']), compliance: json['compliance'] == null ? null - : RequirementsCompliance2.fromJson(json['compliance']), + : RequirementsCompliance37.fromJson(json['compliance']), signup: json['signup'] == null ? null : List.from( @@ -3488,8 +4293,8 @@ class FinancialStpRequirements extends FinancialStpRequirementsModel { /// Creates a copy of instance with given parameters. FinancialStpRequirements copyWith({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, + RequirementsAfterFirstDeposit36? afterFirstDeposit, + RequirementsCompliance37? compliance, List? signup, List? withdrawal, }) => @@ -3500,7 +4305,134 @@ class FinancialStpRequirements extends FinancialStpRequirementsModel { withdrawal: withdrawal ?? this.withdrawal, ); } +/// Requirements after first deposit36 model class. +abstract class RequirementsAfterFirstDeposit36Model { + /// Initializes Requirements after first deposit36 model class . + const RequirementsAfterFirstDeposit36Model({ + this.financialAssessment, + }); + + /// Financial assessment requirements + final List? financialAssessment; +} + +/// Requirements after first deposit36 class. +class RequirementsAfterFirstDeposit36 + extends RequirementsAfterFirstDeposit36Model { + /// Initializes Requirements after first deposit36 class. + const RequirementsAfterFirstDeposit36({ + super.financialAssessment, + }); + + /// Creates an instance from JSON. + factory RequirementsAfterFirstDeposit36.fromJson(Map json) => + RequirementsAfterFirstDeposit36( + financialAssessment: json['financial_assessment'] == null + ? null + : List.from( + json['financial_assessment']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (financialAssessment != null) { + resultMap['financial_assessment'] = financialAssessment! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + RequirementsAfterFirstDeposit36 copyWith({ + List? financialAssessment, + }) => + RequirementsAfterFirstDeposit36( + financialAssessment: financialAssessment ?? this.financialAssessment, + ); +} +/// Requirements compliance37 model class. +abstract class RequirementsCompliance37Model { + /// Initializes Requirements compliance37 model class . + const RequirementsCompliance37Model({ + this.mt5, + this.taxInformation, + }); + + /// Compliance MT5 requirements + final List? mt5; + + /// Compliance tax information requirements + final List? taxInformation; +} + +/// Requirements compliance37 class. +class RequirementsCompliance37 extends RequirementsCompliance37Model { + /// Initializes Requirements compliance37 class. + const RequirementsCompliance37({ + super.mt5, + super.taxInformation, + }); + + /// Creates an instance from JSON. + factory RequirementsCompliance37.fromJson(Map json) => + RequirementsCompliance37( + mt5: json['mt5'] == null + ? null + : List.from( + json['mt5']?.map( + (dynamic item) => item, + ), + ), + taxInformation: json['tax_information'] == null + ? null + : List.from( + json['tax_information']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (mt5 != null) { + resultMap['mt5'] = mt5! + .map( + (String item) => item, + ) + .toList(); + } + if (taxInformation != null) { + resultMap['tax_information'] = taxInformation! + .map( + (String item) => item, + ) + .toList(); + } + return resultMap; + } + + /// Creates a copy of instance with given parameters. + RequirementsCompliance37 copyWith({ + List? mt5, + List? taxInformation, + }) => + RequirementsCompliance37( + mt5: mt5 ?? this.mt5, + taxInformation: taxInformation ?? this.taxInformation, + ); +} /// Mt gaming company model class. abstract class MtGamingCompanyModel { /// Initializes Mt gaming company model class . @@ -3516,10 +4448,8 @@ abstract class MtGamingCompanyModel { class MtGamingCompany extends MtGamingCompanyModel { /// Initializes Mt gaming company class. const MtGamingCompany({ - MtGamingCompanyFinancial? financial, - }) : super( - financial: financial, - ); + super.financial, + }); /// Creates an instance from JSON. factory MtGamingCompany.fromJson(Map json) => @@ -3548,7 +4478,6 @@ class MtGamingCompany extends MtGamingCompanyModel { financial: financial ?? this.financial, ); } - /// Mt gaming company financial model class. abstract class MtGamingCompanyFinancialModel { /// Initializes Mt gaming company financial model class . @@ -3566,6 +4495,7 @@ abstract class MtGamingCompanyFinancialModel { this.requirements, this.shortcode, this.supportProfessionalClient, + this.tinNotMandatory, }); /// Landing Company address @@ -3599,47 +4529,37 @@ abstract class MtGamingCompanyFinancialModel { final String? name; /// Legal requirements for the Landing Company - final FinancialRequirements2? requirements; + final FinancialRequirements43? requirements; /// Landing Company short code final String? shortcode; /// Flag that indicates whether the landing company supports professional accounts or not final bool? supportProfessionalClient; + + /// Flag that indicates whether tax identifier number is not mandatory for the current country and landing company. + final bool? tinNotMandatory; } /// Mt gaming company financial class. class MtGamingCompanyFinancial extends MtGamingCompanyFinancialModel { /// Initializes Mt gaming company financial class. const MtGamingCompanyFinancial({ - List? address, - Map? changeableFields, - String? country, - Map? currencyConfig, - bool? hasRealityCheck, - List? legalAllowedContractCategories, - List? legalAllowedCurrencies, - List? legalAllowedMarkets, - String? legalDefaultCurrency, - String? name, - FinancialRequirements2? requirements, - String? shortcode, - bool? supportProfessionalClient, - }) : super( - address: address, - changeableFields: changeableFields, - country: country, - currencyConfig: currencyConfig, - hasRealityCheck: hasRealityCheck, - legalAllowedContractCategories: legalAllowedContractCategories, - legalAllowedCurrencies: legalAllowedCurrencies, - legalAllowedMarkets: legalAllowedMarkets, - legalDefaultCurrency: legalDefaultCurrency, - name: name, - requirements: requirements, - shortcode: shortcode, - supportProfessionalClient: supportProfessionalClient, - ); + super.address, + super.changeableFields, + super.country, + super.currencyConfig, + super.hasRealityCheck, + super.legalAllowedContractCategories, + super.legalAllowedCurrencies, + super.legalAllowedMarkets, + super.legalDefaultCurrency, + super.name, + super.requirements, + super.shortcode, + super.supportProfessionalClient, + super.tinNotMandatory, + }); /// Creates an instance from JSON. factory MtGamingCompanyFinancial.fromJson(Map json) => @@ -3681,9 +4601,10 @@ class MtGamingCompanyFinancial extends MtGamingCompanyFinancialModel { name: json['name'], requirements: json['requirements'] == null ? null - : FinancialRequirements2.fromJson(json['requirements']), + : FinancialRequirements43.fromJson(json['requirements']), shortcode: json['shortcode'], supportProfessionalClient: getBool(json['support_professional_client']), + tinNotMandatory: getBool(json['tin_not_mandatory']), ); /// Converts an instance to JSON. @@ -3730,6 +4651,7 @@ class MtGamingCompanyFinancial extends MtGamingCompanyFinancialModel { } resultMap['shortcode'] = shortcode; resultMap['support_professional_client'] = supportProfessionalClient; + resultMap['tin_not_mandatory'] = tinNotMandatory; return resultMap; } @@ -3746,9 +4668,10 @@ class MtGamingCompanyFinancial extends MtGamingCompanyFinancialModel { List? legalAllowedMarkets, String? legalDefaultCurrency, String? name, - FinancialRequirements2? requirements, + FinancialRequirements43? requirements, String? shortcode, bool? supportProfessionalClient, + bool? tinNotMandatory, }) => MtGamingCompanyFinancial( address: address ?? this.address, @@ -3767,13 +4690,13 @@ class MtGamingCompanyFinancial extends MtGamingCompanyFinancialModel { shortcode: shortcode ?? this.shortcode, supportProfessionalClient: supportProfessionalClient ?? this.supportProfessionalClient, + tinNotMandatory: tinNotMandatory ?? this.tinNotMandatory, ); } - -/// Financial requirements2 model class. -abstract class FinancialRequirements2Model { - /// Initializes Financial requirements2 model class . - const FinancialRequirements2Model({ +/// Financial requirements43 model class. +abstract class FinancialRequirements43Model { + /// Initializes Financial requirements43 model class . + const FinancialRequirements43Model({ this.afterFirstDeposit, this.compliance, this.signup, @@ -3781,10 +4704,10 @@ abstract class FinancialRequirements2Model { }); /// After first deposit requirements - final RequirementsAfterFirstDeposit2? afterFirstDeposit; + final RequirementsAfterFirstDeposit41? afterFirstDeposit; /// Compliance requirements - final RequirementsCompliance2? compliance; + final RequirementsCompliance42? compliance; /// Sign up requirements final List? signup; @@ -3793,31 +4716,26 @@ abstract class FinancialRequirements2Model { final List? withdrawal; } -/// Financial requirements2 class. -class FinancialRequirements2 extends FinancialRequirements2Model { - /// Initializes Financial requirements2 class. - const FinancialRequirements2({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, - List? signup, - List? withdrawal, - }) : super( - afterFirstDeposit: afterFirstDeposit, - compliance: compliance, - signup: signup, - withdrawal: withdrawal, - ); +/// Financial requirements43 class. +class FinancialRequirements43 extends FinancialRequirements43Model { + /// Initializes Financial requirements43 class. + const FinancialRequirements43({ + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); /// Creates an instance from JSON. - factory FinancialRequirements2.fromJson(Map json) => - FinancialRequirements2( + factory FinancialRequirements43.fromJson(Map json) => + FinancialRequirements43( afterFirstDeposit: json['after_first_deposit'] == null ? null - : RequirementsAfterFirstDeposit2.fromJson( + : RequirementsAfterFirstDeposit41.fromJson( json['after_first_deposit']), compliance: json['compliance'] == null ? null - : RequirementsCompliance2.fromJson(json['compliance']), + : RequirementsCompliance42.fromJson(json['compliance']), signup: json['signup'] == null ? null : List.from( @@ -3863,16 +4781,144 @@ class FinancialRequirements2 extends FinancialRequirements2Model { } /// Creates a copy of instance with given parameters. - FinancialRequirements2 copyWith({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, + FinancialRequirements43 copyWith({ + RequirementsAfterFirstDeposit41? afterFirstDeposit, + RequirementsCompliance42? compliance, List? signup, List? withdrawal, }) => - FinancialRequirements2( + FinancialRequirements43( afterFirstDeposit: afterFirstDeposit ?? this.afterFirstDeposit, compliance: compliance ?? this.compliance, signup: signup ?? this.signup, withdrawal: withdrawal ?? this.withdrawal, ); } +/// Requirements after first deposit41 model class. +abstract class RequirementsAfterFirstDeposit41Model { + /// Initializes Requirements after first deposit41 model class . + const RequirementsAfterFirstDeposit41Model({ + this.financialAssessment, + }); + + /// Financial assessment requirements + final List? financialAssessment; +} + +/// Requirements after first deposit41 class. +class RequirementsAfterFirstDeposit41 + extends RequirementsAfterFirstDeposit41Model { + /// Initializes Requirements after first deposit41 class. + const RequirementsAfterFirstDeposit41({ + super.financialAssessment, + }); + + /// Creates an instance from JSON. + factory RequirementsAfterFirstDeposit41.fromJson(Map json) => + RequirementsAfterFirstDeposit41( + financialAssessment: json['financial_assessment'] == null + ? null + : List.from( + json['financial_assessment']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (financialAssessment != null) { + resultMap['financial_assessment'] = financialAssessment! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + RequirementsAfterFirstDeposit41 copyWith({ + List? financialAssessment, + }) => + RequirementsAfterFirstDeposit41( + financialAssessment: financialAssessment ?? this.financialAssessment, + ); +} +/// Requirements compliance42 model class. +abstract class RequirementsCompliance42Model { + /// Initializes Requirements compliance42 model class . + const RequirementsCompliance42Model({ + this.mt5, + this.taxInformation, + }); + + /// Compliance MT5 requirements + final List? mt5; + + /// Compliance tax information requirements + final List? taxInformation; +} + +/// Requirements compliance42 class. +class RequirementsCompliance42 extends RequirementsCompliance42Model { + /// Initializes Requirements compliance42 class. + const RequirementsCompliance42({ + super.mt5, + super.taxInformation, + }); + + /// Creates an instance from JSON. + factory RequirementsCompliance42.fromJson(Map json) => + RequirementsCompliance42( + mt5: json['mt5'] == null + ? null + : List.from( + json['mt5']?.map( + (dynamic item) => item, + ), + ), + taxInformation: json['tax_information'] == null + ? null + : List.from( + json['tax_information']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (mt5 != null) { + resultMap['mt5'] = mt5! + .map( + (String item) => item, + ) + .toList(); + } + if (taxInformation != null) { + resultMap['tax_information'] = taxInformation! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + RequirementsCompliance42 copyWith({ + List? mt5, + List? taxInformation, + }) => + RequirementsCompliance42( + mt5: mt5 ?? this.mt5, + taxInformation: taxInformation ?? this.taxInformation, + ); +} diff --git a/lib/api/response/link_wallet_response_result.dart b/lib/api/response/link_wallet_response_result.dart index 319d0737c3..2517470ee3 100644 --- a/lib/api/response/link_wallet_response_result.dart +++ b/lib/api/response/link_wallet_response_result.dart @@ -19,10 +19,8 @@ abstract class LinkWalletResponseModel { class LinkWalletResponse extends LinkWalletResponseModel { /// Initializes Link wallet response class. const LinkWalletResponse({ - int? linkWallet, - }) : super( - linkWallet: linkWallet, - ); + super.linkWallet, + }); /// Creates an instance from JSON. factory LinkWalletResponse.fromJson( diff --git a/lib/api/response/mt5_get_settings_response_result.dart b/lib/api/response/mt5_get_settings_response_result.dart index 0f4c73534d..5a2dc3d5ef 100644 --- a/lib/api/response/mt5_get_settings_response_result.dart +++ b/lib/api/response/mt5_get_settings_response_result.dart @@ -25,10 +25,8 @@ abstract class Mt5GetSettingsResponseModel { class Mt5GetSettingsResponse extends Mt5GetSettingsResponseModel { /// Initializes Mt5 get settings response class. const Mt5GetSettingsResponse({ - Mt5GetSettings? mt5GetSettings, - }) : super( - mt5GetSettings: mt5GetSettings, - ); + super.mt5GetSettings, + }); /// Creates an instance from JSON. factory Mt5GetSettingsResponse.fromJson( @@ -103,6 +101,7 @@ final Map landingCompanyShortEnumMapper = "labuan": LandingCompanyShortEnum.labuan, "malta": LandingCompanyShortEnum.malta, "maltainvest": LandingCompanyShortEnum.maltainvest, + "seychelles": LandingCompanyShortEnum.seychelles, "svg": LandingCompanyShortEnum.svg, "vanuatu": LandingCompanyShortEnum.vanuatu, }; @@ -121,6 +120,9 @@ enum LandingCompanyShortEnum { /// maltainvest. maltainvest, + /// seychelles. + seychelles, + /// svg. svg, @@ -131,12 +133,16 @@ enum LandingCompanyShortEnum { /// MarketTypeEnum mapper. final Map marketTypeEnumMapper = { + "all": MarketTypeEnum.all, "financial": MarketTypeEnum.financial, "synthetic": MarketTypeEnum.synthetic, }; /// MarketType Enum. enum MarketTypeEnum { + /// all. + all, + /// financial. financial, @@ -144,22 +150,81 @@ enum MarketTypeEnum { synthetic, } +/// EnvironmentEnum mapper. +final Map environmentEnumMapper = + { + "Deriv-Demo": EnvironmentEnum.derivDemo, + "Deriv-Server": EnvironmentEnum.derivServer, + "Deriv-Server-02": EnvironmentEnum.derivServer02, +}; + +/// Environment Enum. +enum EnvironmentEnum { + /// Deriv-Demo. + derivDemo, + + /// Deriv-Server. + derivServer, + + /// Deriv-Server-02. + derivServer02, +} + +/// SubAccountCategoryEnum mapper. +final Map subAccountCategoryEnumMapper = + { + "none": SubAccountCategoryEnum.none, + "ibt": SubAccountCategoryEnum.ibt, + "lim": SubAccountCategoryEnum.lim, + "stp": SubAccountCategoryEnum.stp, + "swap_free": SubAccountCategoryEnum.swapFree, + "swap_free_high_risk": SubAccountCategoryEnum.swapFreeHighRisk, +}; + +/// SubAccountCategory Enum. +enum SubAccountCategoryEnum { + /// none. + none, + + /// ibt. + ibt, + + /// lim. + lim, + + /// stp. + stp, + + /// swap_free. + swapFree, + + /// swap_free_high_risk. + swapFreeHighRisk, +} + /// SubAccountTypeEnum mapper. final Map subAccountTypeEnumMapper = { + "derivez": SubAccountTypeEnum.derivez, "financial": SubAccountTypeEnum.financial, "financial_stp": SubAccountTypeEnum.financialStp, + "standard": SubAccountTypeEnum.standard, }; /// SubAccountType Enum. enum SubAccountTypeEnum { + /// derivez. + derivez, + /// financial. financial, /// financial_stp. financialStp, -} + /// standard. + standard, +} /// Mt5 get settings model class. abstract class Mt5GetSettingsModel { /// Initializes Mt5 get settings model class . @@ -171,6 +236,7 @@ abstract class Mt5GetSettingsModel { this.company, this.country, this.currency, + this.displayBalance, this.email, this.group, this.landingCompanyShort, @@ -180,7 +246,10 @@ abstract class Mt5GetSettingsModel { this.name, this.phone, this.phonePassword, + this.server, + this.serverInfo, this.state, + this.subAccountCategory, this.subAccountType, this.zipCode, }); @@ -191,8 +260,8 @@ abstract class Mt5GetSettingsModel { /// The address of the user. The maximum length of the address is 128 characters. final String? address; - /// Account balance. - final String? balance; + /// Balance of the Trading account. + final double? balance; /// User's city of residence. final String? city; @@ -206,6 +275,9 @@ abstract class Mt5GetSettingsModel { /// MT5 account currency (`USD` or `EUR`) that depends on the MT5 company (`vanuatu`, `svg`, `malta`). final String? currency; + /// Account balance, formatted to appropriate decimal places. + final String? displayBalance; + /// Email address. final String? email; @@ -233,9 +305,18 @@ abstract class Mt5GetSettingsModel { /// The user's phone password. final String? phonePassword; + /// Trade server name of the MT5 account. + final String? server; + + /// Trade server information. + final ServerInfo? serverInfo; + /// User's state (region) of residence. final String? state; + /// Sub account category. + final SubAccountCategoryEnum? subAccountCategory; + /// Sub account type final SubAccountTypeEnum? subAccountType; @@ -247,46 +328,30 @@ abstract class Mt5GetSettingsModel { class Mt5GetSettings extends Mt5GetSettingsModel { /// Initializes Mt5 get settings class. const Mt5GetSettings({ - AccountTypeEnum? accountType, - String? address, - String? balance, - String? city, - String? company, - String? country, - String? currency, - String? email, - String? group, - LandingCompanyShortEnum? landingCompanyShort, - double? leverage, - String? login, - MarketTypeEnum? marketType, - String? name, - String? phone, - String? phonePassword, - String? state, - SubAccountTypeEnum? subAccountType, - String? zipCode, - }) : super( - accountType: accountType, - address: address, - balance: balance, - city: city, - company: company, - country: country, - currency: currency, - email: email, - group: group, - landingCompanyShort: landingCompanyShort, - leverage: leverage, - login: login, - marketType: marketType, - name: name, - phone: phone, - phonePassword: phonePassword, - state: state, - subAccountType: subAccountType, - zipCode: zipCode, - ); + super.accountType, + super.address, + super.balance, + super.city, + super.company, + super.country, + super.currency, + super.displayBalance, + super.email, + super.group, + super.landingCompanyShort, + super.leverage, + super.login, + super.marketType, + super.name, + super.phone, + super.phonePassword, + super.server, + super.serverInfo, + super.state, + super.subAccountCategory, + super.subAccountType, + super.zipCode, + }); /// Creates an instance from JSON. factory Mt5GetSettings.fromJson(Map json) => Mt5GetSettings( @@ -294,11 +359,12 @@ class Mt5GetSettings extends Mt5GetSettingsModel { ? null : accountTypeEnumMapper[json['account_type']], address: json['address'], - balance: json['balance'], + balance: getDouble(json['balance']), city: json['city'], company: json['company'], country: json['country'], currency: json['currency'], + displayBalance: json['display_balance'], email: json['email'], group: json['group'], landingCompanyShort: json['landing_company_short'] == null @@ -312,7 +378,14 @@ class Mt5GetSettings extends Mt5GetSettingsModel { name: json['name'], phone: json['phone'], phonePassword: json['phonePassword'], + server: json['server'], + serverInfo: json['server_info'] == null + ? null + : ServerInfo.fromJson(json['server_info']), state: json['state'], + subAccountCategory: json['sub_account_category'] == null + ? null + : subAccountCategoryEnumMapper[json['sub_account_category']], subAccountType: json['sub_account_type'] == null ? null : subAccountTypeEnumMapper[json['sub_account_type']], @@ -333,6 +406,7 @@ class Mt5GetSettings extends Mt5GetSettingsModel { resultMap['company'] = company; resultMap['country'] = country; resultMap['currency'] = currency; + resultMap['display_balance'] = displayBalance; resultMap['email'] = email; resultMap['group'] = group; resultMap['landing_company_short'] = landingCompanyShortEnumMapper.entries @@ -348,7 +422,15 @@ class Mt5GetSettings extends Mt5GetSettingsModel { resultMap['name'] = name; resultMap['phone'] = phone; resultMap['phonePassword'] = phonePassword; + resultMap['server'] = server; + if (serverInfo != null) { + resultMap['server_info'] = serverInfo!.toJson(); + } resultMap['state'] = state; + resultMap['sub_account_category'] = subAccountCategoryEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == subAccountCategory) + .key; resultMap['sub_account_type'] = subAccountTypeEnumMapper.entries .firstWhere((MapEntry entry) => entry.value == subAccountType) @@ -362,11 +444,12 @@ class Mt5GetSettings extends Mt5GetSettingsModel { Mt5GetSettings copyWith({ AccountTypeEnum? accountType, String? address, - String? balance, + double? balance, String? city, String? company, String? country, String? currency, + String? displayBalance, String? email, String? group, LandingCompanyShortEnum? landingCompanyShort, @@ -376,7 +459,10 @@ class Mt5GetSettings extends Mt5GetSettingsModel { String? name, String? phone, String? phonePassword, + String? server, + ServerInfo? serverInfo, String? state, + SubAccountCategoryEnum? subAccountCategory, SubAccountTypeEnum? subAccountType, String? zipCode, }) => @@ -388,6 +474,7 @@ class Mt5GetSettings extends Mt5GetSettingsModel { company: company ?? this.company, country: country ?? this.country, currency: currency ?? this.currency, + displayBalance: displayBalance ?? this.displayBalance, email: email ?? this.email, group: group ?? this.group, landingCompanyShort: landingCompanyShort ?? this.landingCompanyShort, @@ -397,8 +484,145 @@ class Mt5GetSettings extends Mt5GetSettingsModel { name: name ?? this.name, phone: phone ?? this.phone, phonePassword: phonePassword ?? this.phonePassword, + server: server ?? this.server, + serverInfo: serverInfo ?? this.serverInfo, state: state ?? this.state, + subAccountCategory: subAccountCategory ?? this.subAccountCategory, subAccountType: subAccountType ?? this.subAccountType, zipCode: zipCode ?? this.zipCode, ); } +/// Server info model class. +abstract class ServerInfoModel { + /// Initializes Server info model class . + const ServerInfoModel({ + this.environment, + this.geolocation, + this.id, + }); + + /// The environment. E.g. Deriv-Server. + final EnvironmentEnum? environment; + + /// Geographical location of the server. + final Geolocation? geolocation; + + /// Server id. + final String? id; +} + +/// Server info class. +class ServerInfo extends ServerInfoModel { + /// Initializes Server info class. + const ServerInfo({ + super.environment, + super.geolocation, + super.id, + }); + + /// Creates an instance from JSON. + factory ServerInfo.fromJson(Map json) => ServerInfo( + environment: json['environment'] == null + ? null + : environmentEnumMapper[json['environment']], + geolocation: json['geolocation'] == null + ? null + : Geolocation.fromJson(json['geolocation']), + id: json['id'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['environment'] = environmentEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == environment) + .key; + if (geolocation != null) { + resultMap['geolocation'] = geolocation!.toJson(); + } + resultMap['id'] = id; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + ServerInfo copyWith({ + EnvironmentEnum? environment, + Geolocation? geolocation, + String? id, + }) => + ServerInfo( + environment: environment ?? this.environment, + geolocation: geolocation ?? this.geolocation, + id: id ?? this.id, + ); +} +/// Geolocation model class. +abstract class GeolocationModel { + /// Initializes Geolocation model class . + const GeolocationModel({ + this.group, + this.location, + this.region, + this.sequence, + }); + + /// Internal server grouping. + final String? group; + + /// Server location. + final String? location; + + /// Server region. + final String? region; + + /// Server sequence. + final int? sequence; +} + +/// Geolocation class. +class Geolocation extends GeolocationModel { + /// Initializes Geolocation class. + const Geolocation({ + super.group, + super.location, + super.region, + super.sequence, + }); + + /// Creates an instance from JSON. + factory Geolocation.fromJson(Map json) => Geolocation( + group: json['group'], + location: json['location'], + region: json['region'], + sequence: json['sequence'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['group'] = group; + resultMap['location'] = location; + resultMap['region'] = region; + resultMap['sequence'] = sequence; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + Geolocation copyWith({ + String? group, + String? location, + String? region, + int? sequence, + }) => + Geolocation( + group: group ?? this.group, + location: location ?? this.location, + region: region ?? this.region, + sequence: sequence ?? this.sequence, + ); +} diff --git a/lib/api/response/new_account_wallet_response_extended.dart b/lib/api/response/new_account_wallet_response_extended.dart new file mode 100644 index 0000000000..0a4d1fb073 --- /dev/null +++ b/lib/api/response/new_account_wallet_response_extended.dart @@ -0,0 +1,28 @@ +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/basic_api/generated/api.dart'; +import 'package:flutter_deriv_api/helpers/helpers.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; + +import 'new_account_wallet_response_result.dart'; + +/// The extended version of the [NewAccountWalletResponse] class to implement +/// the API call methods. +class NewAccountWalletResponseExtended extends NewAccountWalletResponse { + static final BaseAPI _api = Injector()(); + + /// Creates a new wallet account. + static Future createNewWalletAccount({ + required NewAccountWalletRequest request, + }) async { + final NewAccountWalletReceive response = await _api.call(request: request); + + checkException( + response: response, + exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => + BaseAPIException(baseExceptionModel: baseExceptionModel), + ); + + return NewAccountWalletResponse.fromJson(response.newAccountWallet); + } +} diff --git a/lib/api/response/new_account_wallet_response_result.dart b/lib/api/response/new_account_wallet_response_result.dart index cffea611f3..bab5e442bb 100644 --- a/lib/api/response/new_account_wallet_response_result.dart +++ b/lib/api/response/new_account_wallet_response_result.dart @@ -19,10 +19,8 @@ abstract class NewAccountWalletResponseModel { class NewAccountWalletResponse extends NewAccountWalletResponseModel { /// Initializes New account wallet response class. const NewAccountWalletResponse({ - NewAccountWallet? newAccountWallet, - }) : super( - newAccountWallet: newAccountWallet, - ); + super.newAccountWallet, + }); /// Creates an instance from JSON. factory NewAccountWalletResponse.fromJson( @@ -88,20 +86,13 @@ abstract class NewAccountWalletModel { class NewAccountWallet extends NewAccountWalletModel { /// Initializes New account wallet class. const NewAccountWallet({ - required String clientId, - required String landingCompany, - required String oauthToken, - String? currency, - String? landingCompanyShort, - String? landingCompanyShortcode, - }) : super( - clientId: clientId, - landingCompany: landingCompany, - oauthToken: oauthToken, - currency: currency, - landingCompanyShort: landingCompanyShort, - landingCompanyShortcode: landingCompanyShortcode, - ); + required super.clientId, + required super.landingCompany, + required super.oauthToken, + super.currency, + super.landingCompanyShort, + super.landingCompanyShortcode, + }); /// Creates an instance from JSON. factory NewAccountWallet.fromJson(Map json) => diff --git a/lib/api/response/residence_list_response_result.dart b/lib/api/response/residence_list_response_result.dart index d581630799..81bd209701 100644 --- a/lib/api/response/residence_list_response_result.dart +++ b/lib/api/response/residence_list_response_result.dart @@ -25,10 +25,8 @@ abstract class ResidenceListResponseModel { class ResidenceListResponse extends ResidenceListResponseModel { /// Initializes Residence list response class. const ResidenceListResponse({ - List? residenceList, - }) : super( - residenceList: residenceList, - ); + super.residenceList, + }); /// Creates an instance from JSON. factory ResidenceListResponse.fromJson( @@ -88,7 +86,6 @@ class ResidenceListResponse extends ResidenceListResponseModel { residenceList: residenceList ?? this.residenceList, ); } - /// Residence list item model class. abstract class ResidenceListItemModel { /// Initializes Residence list item model class . @@ -128,22 +125,14 @@ abstract class ResidenceListItemModel { class ResidenceListItem extends ResidenceListItemModel { /// Initializes Residence list item class. const ResidenceListItem({ - String? disabled, - Identity? identity, - String? phoneIdd, - String? selected, - String? text, - List? tinFormat, - String? value, - }) : super( - disabled: disabled, - identity: identity, - phoneIdd: phoneIdd, - selected: selected, - text: text, - tinFormat: tinFormat, - value: value, - ); + super.disabled, + super.identity, + super.phoneIdd, + super.selected, + super.text, + super.tinFormat, + super.value, + }); /// Creates an instance from JSON. factory ResidenceListItem.fromJson(Map json) => @@ -208,7 +197,6 @@ class ResidenceListItem extends ResidenceListItemModel { value: value ?? this.value, ); } - /// Identity model class. abstract class IdentityModel { /// Initializes Identity model class . @@ -224,10 +212,8 @@ abstract class IdentityModel { class Identity extends IdentityModel { /// Initializes Identity class. const Identity({ - Services? services, - }) : super( - services: services, - ); + super.services, + }); /// Creates an instance from JSON. factory Identity.fromJson(Map json) => Identity( @@ -255,7 +241,6 @@ class Identity extends IdentityModel { services: services ?? this.services, ); } - /// Services model class. abstract class ServicesModel { /// Initializes Services model class . @@ -275,12 +260,9 @@ abstract class ServicesModel { class Services extends ServicesModel { /// Initializes Services class. const Services({ - Idv? idv, - Onfido? onfido, - }) : super( - idv: idv, - onfido: onfido, - ); + super.idv, + super.onfido, + }); /// Creates an instance from JSON. factory Services.fromJson(Map json) => Services( @@ -312,7 +294,6 @@ class Services extends ServicesModel { onfido: onfido ?? this.onfido, ); } - /// Idv model class. abstract class IdvModel { /// Initializes Idv model class . @@ -336,14 +317,10 @@ abstract class IdvModel { class Idv extends IdvModel { /// Initializes Idv class. const Idv({ - Map? documentsSupported, - bool? hasVisualSample, - bool? isCountrySupported, - }) : super( - documentsSupported: documentsSupported, - hasVisualSample: hasVisualSample, - isCountrySupported: isCountrySupported, - ); + super.documentsSupported, + super.hasVisualSample, + super.isCountrySupported, + }); /// Creates an instance from JSON. factory Idv.fromJson(Map json) => Idv( @@ -383,15 +360,18 @@ class Idv extends IdvModel { isCountrySupported: isCountrySupported ?? this.isCountrySupported, ); } - /// Documents supported property model class. abstract class DocumentsSupportedPropertyModel { /// Initializes Documents supported property model class . const DocumentsSupportedPropertyModel({ + this.additional, this.displayName, this.format, }); + /// [Optional] Additional input required from the user + final Additional? additional; + /// The localized display name final String? displayName; @@ -403,16 +383,17 @@ abstract class DocumentsSupportedPropertyModel { class DocumentsSupportedProperty extends DocumentsSupportedPropertyModel { /// Initializes Documents supported property class. const DocumentsSupportedProperty({ - String? displayName, - String? format, - }) : super( - displayName: displayName, - format: format, - ); + super.additional, + super.displayName, + super.format, + }); /// Creates an instance from JSON. factory DocumentsSupportedProperty.fromJson(Map json) => DocumentsSupportedProperty( + additional: json['additional'] == null + ? null + : Additional.fromJson(json['additional']), displayName: json['display_name'], format: json['format'], ); @@ -421,6 +402,9 @@ class DocumentsSupportedProperty extends DocumentsSupportedPropertyModel { Map toJson() { final Map resultMap = {}; + if (additional != null) { + resultMap['additional'] = additional!.toJson(); + } resultMap['display_name'] = displayName; resultMap['format'] = format; @@ -429,15 +413,65 @@ class DocumentsSupportedProperty extends DocumentsSupportedPropertyModel { /// Creates a copy of instance with given parameters. DocumentsSupportedProperty copyWith({ + Additional? additional, String? displayName, String? format, }) => DocumentsSupportedProperty( + additional: additional ?? this.additional, displayName: displayName ?? this.displayName, format: format ?? this.format, ); } +/// Additional model class. +abstract class AdditionalModel { + /// Initializes Additional model class . + const AdditionalModel({ + this.displayName, + this.format, + }); + /// The localized display name + final String? displayName; + + /// [Optional] Regex pattern to validate documents + final String? format; +} + +/// Additional class. +class Additional extends AdditionalModel { + /// Initializes Additional class. + const Additional({ + super.displayName, + super.format, + }); + + /// Creates an instance from JSON. + factory Additional.fromJson(Map json) => Additional( + displayName: json['display_name'], + format: json['format'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['display_name'] = displayName; + resultMap['format'] = format; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + Additional copyWith({ + String? displayName, + String? format, + }) => + Additional( + displayName: displayName ?? this.displayName, + format: format ?? this.format, + ); +} /// Onfido model class. abstract class OnfidoModel { /// Initializes Onfido model class . @@ -458,13 +492,9 @@ abstract class OnfidoModel { class Onfido extends OnfidoModel { /// Initializes Onfido class. const Onfido({ - Map? - documentsSupported, - bool? isCountrySupported, - }) : super( - documentsSupported: documentsSupported, - isCountrySupported: isCountrySupported, - ); + super.documentsSupported, + super.isCountrySupported, + }); /// Creates an instance from JSON. factory Onfido.fromJson(Map json) => Onfido( @@ -503,7 +533,6 @@ class Onfido extends OnfidoModel { isCountrySupported: isCountrySupported ?? this.isCountrySupported, ); } - /// Documents supported documents supported property model class. abstract class DocumentsSupportedDocumentsSupportedPropertyModel { /// Initializes Documents supported documents supported property model class . @@ -524,12 +553,9 @@ class DocumentsSupportedDocumentsSupportedProperty extends DocumentsSupportedDocumentsSupportedPropertyModel { /// Initializes Documents supported documents supported property class. const DocumentsSupportedDocumentsSupportedProperty({ - String? displayName, - String? format, - }) : super( - displayName: displayName, - format: format, - ); + super.displayName, + super.format, + }); /// Creates an instance from JSON. factory DocumentsSupportedDocumentsSupportedProperty.fromJson( diff --git a/lib/api/response/service_token_response_result.dart b/lib/api/response/service_token_response_result.dart index d11b839196..89450d7139 100644 --- a/lib/api/response/service_token_response_result.dart +++ b/lib/api/response/service_token_response_result.dart @@ -26,10 +26,8 @@ abstract class ServiceTokenResponseModel { class ServiceTokenResponse extends ServiceTokenResponseModel { /// Initializes Service token response class. const ServiceTokenResponse({ - ServiceToken? serviceToken, - }) : super( - serviceToken: serviceToken, - ); + super.serviceToken, + }); /// Creates an instance from JSON. factory ServiceTokenResponse.fromJson( @@ -94,12 +92,12 @@ class ServiceTokenResponse extends ServiceTokenResponseModel { serviceToken: serviceToken ?? this.serviceToken, ); } - /// Service token model class. abstract class ServiceTokenModel { /// Initializes Service token model class . const ServiceTokenModel({ this.banxa, + this.ctrader, this.dxtrade, this.onfido, this.pandats, @@ -110,13 +108,16 @@ abstract class ServiceTokenModel { /// Banxa order data. final Banxa? banxa; + /// CTrader data. + final Ctrader? ctrader; + /// Deriv X data. final Dxtrade? dxtrade; /// Onfido data. final Onfido? onfido; - /// pandats data. + /// Deriv EZ data. final Pandats? pandats; /// Sendbird data. @@ -130,24 +131,20 @@ abstract class ServiceTokenModel { class ServiceToken extends ServiceTokenModel { /// Initializes Service token class. const ServiceToken({ - Banxa? banxa, - Dxtrade? dxtrade, - Onfido? onfido, - Pandats? pandats, - Sendbird? sendbird, - Wyre? wyre, - }) : super( - banxa: banxa, - dxtrade: dxtrade, - onfido: onfido, - pandats: pandats, - sendbird: sendbird, - wyre: wyre, - ); + super.banxa, + super.ctrader, + super.dxtrade, + super.onfido, + super.pandats, + super.sendbird, + super.wyre, + }); /// Creates an instance from JSON. factory ServiceToken.fromJson(Map json) => ServiceToken( banxa: json['banxa'] == null ? null : Banxa.fromJson(json['banxa']), + ctrader: + json['ctrader'] == null ? null : Ctrader.fromJson(json['ctrader']), dxtrade: json['dxtrade'] == null ? null : Dxtrade.fromJson(json['dxtrade']), onfido: json['onfido'] == null ? null : Onfido.fromJson(json['onfido']), @@ -166,6 +163,9 @@ class ServiceToken extends ServiceTokenModel { if (banxa != null) { resultMap['banxa'] = banxa!.toJson(); } + if (ctrader != null) { + resultMap['ctrader'] = ctrader!.toJson(); + } if (dxtrade != null) { resultMap['dxtrade'] = dxtrade!.toJson(); } @@ -188,6 +188,7 @@ class ServiceToken extends ServiceTokenModel { /// Creates a copy of instance with given parameters. ServiceToken copyWith({ Banxa? banxa, + Ctrader? ctrader, Dxtrade? dxtrade, Onfido? onfido, Pandats? pandats, @@ -196,6 +197,7 @@ class ServiceToken extends ServiceTokenModel { }) => ServiceToken( banxa: banxa ?? this.banxa, + ctrader: ctrader ?? this.ctrader, dxtrade: dxtrade ?? this.dxtrade, onfido: onfido ?? this.onfido, pandats: pandats ?? this.pandats, @@ -203,7 +205,6 @@ class ServiceToken extends ServiceTokenModel { wyre: wyre ?? this.wyre, ); } - /// Banxa model class. abstract class BanxaModel { /// Initializes Banxa model class . @@ -227,14 +228,10 @@ abstract class BanxaModel { class Banxa extends BanxaModel { /// Initializes Banxa class. const Banxa({ - String? token, - String? url, - String? urlIframe, - }) : super( - token: token, - url: url, - urlIframe: urlIframe, - ); + super.token, + super.url, + super.urlIframe, + }); /// Creates an instance from JSON. factory Banxa.fromJson(Map json) => Banxa( @@ -266,7 +263,46 @@ class Banxa extends BanxaModel { urlIframe: urlIframe ?? this.urlIframe, ); } +/// Ctrader model class. +abstract class CtraderModel { + /// Initializes Ctrader model class . + const CtraderModel({ + this.token, + }); + + /// CTrader One Time token + final String? token; +} + +/// Ctrader class. +class Ctrader extends CtraderModel { + /// Initializes Ctrader class. + const Ctrader({ + super.token, + }); + + /// Creates an instance from JSON. + factory Ctrader.fromJson(Map json) => Ctrader( + token: json['token'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['token'] = token; + return resultMap; + } + + /// Creates a copy of instance with given parameters. + Ctrader copyWith({ + String? token, + }) => + Ctrader( + token: token ?? this.token, + ); +} /// Dxtrade model class. abstract class DxtradeModel { /// Initializes Dxtrade model class . @@ -282,10 +318,8 @@ abstract class DxtradeModel { class Dxtrade extends DxtradeModel { /// Initializes Dxtrade class. const Dxtrade({ - String? token, - }) : super( - token: token, - ); + super.token, + }); /// Creates an instance from JSON. factory Dxtrade.fromJson(Map json) => Dxtrade( @@ -309,7 +343,6 @@ class Dxtrade extends DxtradeModel { token: token ?? this.token, ); } - /// Onfido model class. abstract class OnfidoModel { /// Initializes Onfido model class . @@ -325,10 +358,8 @@ abstract class OnfidoModel { class Onfido extends OnfidoModel { /// Initializes Onfido class. const Onfido({ - String? token, - }) : super( - token: token, - ); + super.token, + }); /// Creates an instance from JSON. factory Onfido.fromJson(Map json) => Onfido( @@ -352,7 +383,6 @@ class Onfido extends OnfidoModel { token: token ?? this.token, ); } - /// Pandats model class. abstract class PandatsModel { /// Initializes Pandats model class . @@ -360,7 +390,7 @@ abstract class PandatsModel { this.token, }); - /// Pandats token. + /// Deriv EZ SSO token final String? token; } @@ -368,10 +398,8 @@ abstract class PandatsModel { class Pandats extends PandatsModel { /// Initializes Pandats class. const Pandats({ - String? token, - }) : super( - token: token, - ); + super.token, + }); /// Creates an instance from JSON. factory Pandats.fromJson(Map json) => Pandats( @@ -395,7 +423,6 @@ class Pandats extends PandatsModel { token: token ?? this.token, ); } - /// Sendbird model class. abstract class SendbirdModel { /// Initializes Sendbird model class . @@ -419,14 +446,10 @@ abstract class SendbirdModel { class Sendbird extends SendbirdModel { /// Initializes Sendbird class. const Sendbird({ - String? appId, - DateTime? expiryTime, - String? token, - }) : super( - appId: appId, - expiryTime: expiryTime, - token: token, - ); + super.appId, + super.expiryTime, + super.token, + }); /// Creates an instance from JSON. factory Sendbird.fromJson(Map json) => Sendbird( @@ -458,7 +481,6 @@ class Sendbird extends SendbirdModel { token: token ?? this.token, ); } - /// Wyre model class. abstract class WyreModel { /// Initializes Wyre model class . @@ -478,12 +500,9 @@ abstract class WyreModel { class Wyre extends WyreModel { /// Initializes Wyre class. const Wyre({ - String? token, - String? url, - }) : super( - token: token, - url: url, - ); + super.token, + super.url, + }); /// Creates an instance from JSON. factory Wyre.fromJson(Map json) => Wyre( diff --git a/lib/api/response/trading_platform_accounts_response_result.dart b/lib/api/response/trading_platform_accounts_response_result.dart index 806ddd905c..a73ddb45c2 100644 --- a/lib/api/response/trading_platform_accounts_response_result.dart +++ b/lib/api/response/trading_platform_accounts_response_result.dart @@ -24,10 +24,8 @@ class TradingPlatformAccountsResponse extends TradingPlatformAccountsResponseModel { /// Initializes Trading platform accounts response class. const TradingPlatformAccountsResponse({ - List? tradingPlatformAccounts, - }) : super( - tradingPlatformAccounts: tradingPlatformAccounts, - ); + super.tradingPlatformAccounts, + }); /// Creates an instance from JSON. factory TradingPlatformAccountsResponse.fromJson( @@ -168,6 +166,7 @@ enum MarketTypeEnum { final Map platformEnumMapper = { "dxtrade": PlatformEnum.dxtrade, "mt5": PlatformEnum.mt5, + "ctrader": PlatformEnum.ctrader, }; /// Platform Enum. @@ -177,6 +176,9 @@ enum PlatformEnum { /// mt5. mt5, + + /// ctrader. + ctrader, } /// EnvironmentEnum mapper. @@ -204,6 +206,7 @@ final Map subAccountTypeEnumMapper = { "financial": SubAccountTypeEnum.financial, "financial_stp": SubAccountTypeEnum.financialStp, + "swap_free": SubAccountTypeEnum.swapFree, }; /// SubAccountType Enum. @@ -213,8 +216,10 @@ enum SubAccountTypeEnum { /// financial_stp. financialStp, -} + /// swap_free. + swapFree, +} /// Trading platform accounts item model class. abstract class TradingPlatformAccountsItemModel { /// Initializes Trading platform accounts item model class . @@ -298,44 +303,25 @@ abstract class TradingPlatformAccountsItemModel { class TradingPlatformAccountsItem extends TradingPlatformAccountsItemModel { /// Initializes Trading platform accounts item class. const TradingPlatformAccountsItem({ - String? accountId, - AccountTypeEnum? accountType, - double? balance, - String? country, - String? currency, - String? displayBalance, - String? email, - int? enabled, - String? group, - LandingCompanyShortEnum? landingCompanyShort, - double? leverage, - String? login, - MarketTypeEnum? marketType, - String? name, - PlatformEnum? platform, - String? server, - ServerInfo? serverInfo, - SubAccountTypeEnum? subAccountType, - }) : super( - accountId: accountId, - accountType: accountType, - balance: balance, - country: country, - currency: currency, - displayBalance: displayBalance, - email: email, - enabled: enabled, - group: group, - landingCompanyShort: landingCompanyShort, - leverage: leverage, - login: login, - marketType: marketType, - name: name, - platform: platform, - server: server, - serverInfo: serverInfo, - subAccountType: subAccountType, - ); + super.accountId, + super.accountType, + super.balance, + super.country, + super.currency, + super.displayBalance, + super.email, + super.enabled, + super.group, + super.landingCompanyShort, + super.leverage, + super.login, + super.marketType, + super.name, + super.platform, + super.server, + super.serverInfo, + super.subAccountType, + }); /// Creates an instance from JSON. factory TradingPlatformAccountsItem.fromJson(Map json) => @@ -457,7 +443,6 @@ class TradingPlatformAccountsItem extends TradingPlatformAccountsItemModel { subAccountType: subAccountType ?? this.subAccountType, ); } - /// Server info model class. abstract class ServerInfoModel { /// Initializes Server info model class . @@ -481,14 +466,10 @@ abstract class ServerInfoModel { class ServerInfo extends ServerInfoModel { /// Initializes Server info class. const ServerInfo({ - EnvironmentEnum? environment, - Geolocation? geolocation, - String? id, - }) : super( - environment: environment, - geolocation: geolocation, - id: id, - ); + super.environment, + super.geolocation, + super.id, + }); /// Creates an instance from JSON. factory ServerInfo.fromJson(Map json) => ServerInfo( @@ -529,7 +510,6 @@ class ServerInfo extends ServerInfoModel { id: id ?? this.id, ); } - /// Geolocation model class. abstract class GeolocationModel { /// Initializes Geolocation model class . @@ -543,13 +523,13 @@ abstract class GeolocationModel { /// Internal server grouping. final String? group; - /// Sever location. + /// Server location. final String? location; - /// Sever region. + /// Server region. final String? region; - /// Sever sequence. + /// Server sequence. final int? sequence; } @@ -557,16 +537,11 @@ abstract class GeolocationModel { class Geolocation extends GeolocationModel { /// Initializes Geolocation class. const Geolocation({ - String? group, - String? location, - String? region, - int? sequence, - }) : super( - group: group, - location: location, - region: region, - sequence: sequence, - ); + super.group, + super.location, + super.region, + super.sequence, + }); /// Creates an instance from JSON. factory Geolocation.fromJson(Map json) => Geolocation( diff --git a/lib/api/response/trading_platform_asset_listing_response_result.dart b/lib/api/response/trading_platform_asset_listing_response_result.dart new file mode 100644 index 0000000000..2f5f36c8cd --- /dev/null +++ b/lib/api/response/trading_platform_asset_listing_response_result.dart @@ -0,0 +1,274 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Trading platform asset listing response model class. +abstract class TradingPlatformAssetListingResponseModel { + /// Initializes Trading platform asset listing response model class . + const TradingPlatformAssetListingResponseModel({ + this.tradingPlatformAssetListing, + this.subscription, + }); + + /// Containing Trading asset objects. + final Map? + tradingPlatformAssetListing; + + /// For subscription requests only. + final Subscription? subscription; +} + +/// Trading platform asset listing response class. +class TradingPlatformAssetListingResponse + extends TradingPlatformAssetListingResponseModel { + /// Initializes Trading platform asset listing response class. + const TradingPlatformAssetListingResponse({ + super.tradingPlatformAssetListing, + super.subscription, + }); + + /// Creates an instance from JSON. + factory TradingPlatformAssetListingResponse.fromJson( + dynamic tradingPlatformAssetListingJson, + dynamic subscriptionJson, + ) => + TradingPlatformAssetListingResponse( + tradingPlatformAssetListing: tradingPlatformAssetListingJson == null + ? null + : Map.fromEntries( + tradingPlatformAssetListingJson.entries.map< + MapEntry>( + (MapEntry entry) => + MapEntry( + entry.key, + TradingPlatformAssetListingProperty.fromJson( + entry.value)))), + subscription: subscriptionJson == null + ? null + : Subscription.fromJson(subscriptionJson), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['trading_platform_asset_listing'] = tradingPlatformAssetListing; + if (subscription != null) { + resultMap['subscription'] = subscription!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + TradingPlatformAssetListingResponse copyWith({ + Map? + tradingPlatformAssetListing, + Subscription? subscription, + }) => + TradingPlatformAssetListingResponse( + tradingPlatformAssetListing: + tradingPlatformAssetListing ?? this.tradingPlatformAssetListing, + subscription: subscription ?? this.subscription, + ); +} +/// Trading platform asset listing property model class. +abstract class TradingPlatformAssetListingPropertyModel { + /// Initializes Trading platform asset listing property model class . + const TradingPlatformAssetListingPropertyModel({ + this.assets, + }); + + /// MT5 assets. + final List? assets; +} + +/// Trading platform asset listing property class. +class TradingPlatformAssetListingProperty + extends TradingPlatformAssetListingPropertyModel { + /// Initializes Trading platform asset listing property class. + const TradingPlatformAssetListingProperty({ + super.assets, + }); + + /// Creates an instance from JSON. + factory TradingPlatformAssetListingProperty.fromJson( + Map json) => + TradingPlatformAssetListingProperty( + assets: json['assets'] == null + ? null + : List.from( + json['assets']?.map( + (dynamic item) => AssetsItem.fromJson(item), + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (assets != null) { + resultMap['assets'] = assets! + .map( + (AssetsItem item) => item.toJson(), + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + TradingPlatformAssetListingProperty copyWith({ + List? assets, + }) => + TradingPlatformAssetListingProperty( + assets: assets ?? this.assets, + ); +} +/// Assets item model class. +abstract class AssetsItemModel { + /// Initializes Assets item model class . + const AssetsItemModel({ + this.ask, + this.bid, + this.dayPercentageChange, + this.displayOrder, + this.market, + this.shortcode, + this.spread, + this.symbol, + }); + + /// Ask price of asset. + final double? ask; + + /// Bid price of asset. + final double? bid; + + /// 1 day percentage change of price. + final String? dayPercentageChange; + + /// Display order of asset. + final double? displayOrder; + + /// Market type of asset. + final String? market; + + /// The asset shortcode. + final String? shortcode; + + /// Spread of asset. + final double? spread; + + /// Asset symbol. + final String? symbol; +} + +/// Assets item class. +class AssetsItem extends AssetsItemModel { + /// Initializes Assets item class. + const AssetsItem({ + super.ask, + super.bid, + super.dayPercentageChange, + super.displayOrder, + super.market, + super.shortcode, + super.spread, + super.symbol, + }); + + /// Creates an instance from JSON. + factory AssetsItem.fromJson(Map json) => AssetsItem( + ask: getDouble(json['ask']), + bid: getDouble(json['bid']), + dayPercentageChange: json['day_percentage_change'], + displayOrder: getDouble(json['display_order']), + market: json['market'], + shortcode: json['shortcode'], + spread: getDouble(json['spread']), + symbol: json['symbol'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['ask'] = ask; + resultMap['bid'] = bid; + resultMap['day_percentage_change'] = dayPercentageChange; + resultMap['display_order'] = displayOrder; + resultMap['market'] = market; + resultMap['shortcode'] = shortcode; + resultMap['spread'] = spread; + resultMap['symbol'] = symbol; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + AssetsItem copyWith({ + double? ask, + double? bid, + String? dayPercentageChange, + double? displayOrder, + String? market, + String? shortcode, + double? spread, + String? symbol, + }) => + AssetsItem( + ask: ask ?? this.ask, + bid: bid ?? this.bid, + dayPercentageChange: dayPercentageChange ?? this.dayPercentageChange, + displayOrder: displayOrder ?? this.displayOrder, + market: market ?? this.market, + shortcode: shortcode ?? this.shortcode, + spread: spread ?? this.spread, + symbol: symbol ?? this.symbol, + ); +} +/// Subscription model class. +abstract class SubscriptionModel { + /// Initializes Subscription model class . + const SubscriptionModel({ + required this.id, + }); + + /// A per-connection unique identifier. Can be passed to the `forget` API call to unsubscribe. + final String id; +} + +/// Subscription class. +class Subscription extends SubscriptionModel { + /// Initializes Subscription class. + const Subscription({ + required super.id, + }); + + /// Creates an instance from JSON. + factory Subscription.fromJson(Map json) => Subscription( + id: json['id'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['id'] = id; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + Subscription copyWith({ + String? id, + }) => + Subscription( + id: id ?? this.id, + ); +} diff --git a/lib/api/response/trading_platform_available_accounts_response_result.dart b/lib/api/response/trading_platform_available_accounts_response_result.dart index a1a4afc9f2..57817492b9 100644 --- a/lib/api/response/trading_platform_available_accounts_response_result.dart +++ b/lib/api/response/trading_platform_available_accounts_response_result.dart @@ -21,11 +21,8 @@ class TradingPlatformAvailableAccountsResponse extends TradingPlatformAvailableAccountsResponseModel { /// Initializes Trading platform available accounts response class. const TradingPlatformAvailableAccountsResponse({ - List? - tradingPlatformAvailableAccounts, - }) : super( - tradingPlatformAvailableAccounts: tradingPlatformAvailableAccounts, - ); + super.tradingPlatformAvailableAccounts, + }); /// Creates an instance from JSON. factory TradingPlatformAvailableAccountsResponse.fromJson( @@ -70,11 +67,30 @@ class TradingPlatformAvailableAccountsResponse ); } +/// LinkableLandingCompaniesItemEnum mapper. +final Map + linkableLandingCompaniesItemEnumMapper = + { + "svg": LinkableLandingCompaniesItemEnum.svg, + "maltainvest": LinkableLandingCompaniesItemEnum.maltainvest, +}; + +/// LinkableLandingCompaniesItem Enum. +enum LinkableLandingCompaniesItemEnum { + /// svg. + svg, + + /// maltainvest. + maltainvest, +} + /// MarketTypeEnum mapper. final Map marketTypeEnumMapper = { "financial": MarketTypeEnum.financial, + "synthetic": MarketTypeEnum.synthetic, "gaming": MarketTypeEnum.gaming, + "all": MarketTypeEnum.all, }; /// MarketType Enum. @@ -82,14 +98,21 @@ enum MarketTypeEnum { /// financial. financial, + /// synthetic. + synthetic, + /// gaming. gaming, + + /// all. + all, } /// SubAccountTypeEnum mapper. final Map subAccountTypeEnumMapper = { "standard": SubAccountTypeEnum.standard, + "swap_free": SubAccountTypeEnum.swapFree, "stp": SubAccountTypeEnum.stp, }; @@ -98,6 +121,9 @@ enum SubAccountTypeEnum { /// standard. standard, + /// swap_free. + swapFree, + /// stp. stp, } @@ -105,6 +131,7 @@ enum SubAccountTypeEnum { abstract class TradingPlatformAvailableAccountsItemModel { /// Initializes Trading platform available accounts item model class . const TradingPlatformAvailableAccountsItemModel({ + this.linkableLandingCompanies, this.marketType, this.name, this.requirements, @@ -112,6 +139,9 @@ abstract class TradingPlatformAvailableAccountsItemModel { this.subAccountType, }); + /// A list of Deriv landing companies that can work with this account type + final List? linkableLandingCompanies; + /// The type of market tradable by this account final MarketTypeEnum? marketType; @@ -133,23 +163,27 @@ class TradingPlatformAvailableAccountsItem extends TradingPlatformAvailableAccountsItemModel { /// Initializes Trading platform available accounts item class. const TradingPlatformAvailableAccountsItem({ - MarketTypeEnum? marketType, - String? name, - Requirements? requirements, - String? shortcode, - SubAccountTypeEnum? subAccountType, - }) : super( - marketType: marketType, - name: name, - requirements: requirements, - shortcode: shortcode, - subAccountType: subAccountType, - ); + super.linkableLandingCompanies, + super.marketType, + super.name, + super.requirements, + super.shortcode, + super.subAccountType, + }); /// Creates an instance from JSON. factory TradingPlatformAvailableAccountsItem.fromJson( Map json) => TradingPlatformAvailableAccountsItem( + linkableLandingCompanies: json['linkable_landing_companies'] == null + ? null + : List.from( + json['linkable_landing_companies']?.map( + (dynamic item) => item == null + ? null + : linkableLandingCompaniesItemEnumMapper[item], + ), + ), marketType: json['market_type'] == null ? null : marketTypeEnumMapper[json['market_type']], @@ -167,6 +201,19 @@ class TradingPlatformAvailableAccountsItem Map toJson() { final Map resultMap = {}; + if (linkableLandingCompanies != null) { + resultMap['linkable_landing_companies'] = linkableLandingCompanies! + .map( + (LinkableLandingCompaniesItemEnum item) => + linkableLandingCompaniesItemEnumMapper.entries + .firstWhere( + (MapEntry + entry) => + entry.value == item) + .key, + ) + .toList(); + } resultMap['market_type'] = marketTypeEnumMapper.entries .firstWhere((MapEntry entry) => entry.value == marketType) @@ -186,6 +233,7 @@ class TradingPlatformAvailableAccountsItem /// Creates a copy of instance with given parameters. TradingPlatformAvailableAccountsItem copyWith({ + List? linkableLandingCompanies, MarketTypeEnum? marketType, String? name, Requirements? requirements, @@ -193,6 +241,8 @@ class TradingPlatformAvailableAccountsItem SubAccountTypeEnum? subAccountType, }) => TradingPlatformAvailableAccountsItem( + linkableLandingCompanies: + linkableLandingCompanies ?? this.linkableLandingCompanies, marketType: marketType ?? this.marketType, name: name ?? this.name, requirements: requirements ?? this.requirements, @@ -227,16 +277,11 @@ abstract class RequirementsModel { class Requirements extends RequirementsModel { /// Initializes Requirements class. const Requirements({ - AfterFirstDeposit? afterFirstDeposit, - Compliance? compliance, - List? signup, - List? withdrawal, - }) : super( - afterFirstDeposit: afterFirstDeposit, - compliance: compliance, - signup: signup, - withdrawal: withdrawal, - ); + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); /// Creates an instance from JSON. factory Requirements.fromJson(Map json) => Requirements( @@ -319,10 +364,8 @@ abstract class AfterFirstDepositModel { class AfterFirstDeposit extends AfterFirstDepositModel { /// Initializes After first deposit class. const AfterFirstDeposit({ - List? financialAssessment, - }) : super( - financialAssessment: financialAssessment, - ); + super.financialAssessment, + }); /// Creates an instance from JSON. factory AfterFirstDeposit.fromJson(Map json) => @@ -378,12 +421,9 @@ abstract class ComplianceModel { class Compliance extends ComplianceModel { /// Initializes Compliance class. const Compliance({ - List? mt5, - List? taxInformation, - }) : super( - mt5: mt5, - taxInformation: taxInformation, - ); + super.mt5, + super.taxInformation, + }); /// Creates an instance from JSON. factory Compliance.fromJson(Map json) => Compliance( diff --git a/lib/api/response/trading_platform_deposit_response_result.dart b/lib/api/response/trading_platform_deposit_response_result.dart index f01ad48e0d..685817be5c 100644 --- a/lib/api/response/trading_platform_deposit_response_result.dart +++ b/lib/api/response/trading_platform_deposit_response_result.dart @@ -16,7 +16,7 @@ abstract class TradingPlatformDepositResponseModel { }); /// Information about deposit transaction, or status of demo account top up. - final dynamic tradingPlatformDeposit; + final Map? tradingPlatformDeposit; } /// Trading platform deposit response class. @@ -24,10 +24,8 @@ class TradingPlatformDepositResponse extends TradingPlatformDepositResponseModel { /// Initializes Trading platform deposit response class. const TradingPlatformDepositResponse({ - dynamic tradingPlatformDeposit, - }) : super( - tradingPlatformDeposit: tradingPlatformDeposit, - ); + super.tradingPlatformDeposit, + }); /// Creates an instance from JSON. factory TradingPlatformDepositResponse.fromJson( @@ -72,7 +70,7 @@ class TradingPlatformDepositResponse /// Creates a copy of instance with given parameters. TradingPlatformDepositResponse copyWith({ - dynamic tradingPlatformDeposit, + Map? tradingPlatformDeposit, }) => TradingPlatformDepositResponse( tradingPlatformDeposit: diff --git a/lib/api/response/trading_platform_new_account_response_result.dart b/lib/api/response/trading_platform_new_account_response_result.dart index f6fa27712a..2d3702e739 100644 --- a/lib/api/response/trading_platform_new_account_response_result.dart +++ b/lib/api/response/trading_platform_new_account_response_result.dart @@ -24,10 +24,8 @@ class TradingPlatformNewAccountResponse extends TradingPlatformNewAccountResponseModel { /// Initializes Trading platform new account response class. const TradingPlatformNewAccountResponse({ - TradingPlatformNewAccount? tradingPlatformNewAccount, - }) : super( - tradingPlatformNewAccount: tradingPlatformNewAccount, - ); + super.tradingPlatformNewAccount, + }); /// Creates an instance from JSON. factory TradingPlatformNewAccountResponse.fromJson( @@ -57,7 +55,7 @@ class TradingPlatformNewAccountResponse /// /// This call creates new Trading account, either demo or real money. /// For parameters information refer to [TradingPlatformNewAccountRequest]. - /// Throws a [BaseAPIException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error. static Future create( TradingPlatformNewAccountRequest request, ) async { @@ -165,6 +163,7 @@ enum MarketTypeEnum { final Map platformEnumMapper = { "dxtrade": PlatformEnum.dxtrade, "derivez": PlatformEnum.derivez, + "ctrader": PlatformEnum.ctrader, }; /// Platform Enum. @@ -174,6 +173,9 @@ enum PlatformEnum { /// derivez. derivez, + + /// ctrader. + ctrader, } /// SubAccountTypeEnum mapper. @@ -181,6 +183,7 @@ final Map subAccountTypeEnumMapper = { "financial": SubAccountTypeEnum.financial, "financial_stp": SubAccountTypeEnum.financialStp, + "swap_free": SubAccountTypeEnum.swapFree, }; /// SubAccountType Enum. @@ -190,8 +193,10 @@ enum SubAccountTypeEnum { /// financial_stp. financialStp, -} + /// swap_free. + swapFree, +} /// Trading platform new account model class. abstract class TradingPlatformNewAccountModel { /// Initializes Trading platform new account model class . @@ -251,32 +256,19 @@ abstract class TradingPlatformNewAccountModel { class TradingPlatformNewAccount extends TradingPlatformNewAccountModel { /// Initializes Trading platform new account class. const TradingPlatformNewAccount({ - String? accountId, - AccountTypeEnum? accountType, - String? agent, - double? balance, - String? currency, - String? displayBalance, - int? enabled, - LandingCompanyShortEnum? landingCompanyShort, - String? login, - MarketTypeEnum? marketType, - PlatformEnum? platform, - SubAccountTypeEnum? subAccountType, - }) : super( - accountId: accountId, - accountType: accountType, - agent: agent, - balance: balance, - currency: currency, - displayBalance: displayBalance, - enabled: enabled, - landingCompanyShort: landingCompanyShort, - login: login, - marketType: marketType, - platform: platform, - subAccountType: subAccountType, - ); + super.accountId, + super.accountType, + super.agent, + super.balance, + super.currency, + super.displayBalance, + super.enabled, + super.landingCompanyShort, + super.login, + super.marketType, + super.platform, + super.subAccountType, + }); /// Creates an instance from JSON. factory TradingPlatformNewAccount.fromJson(Map json) => diff --git a/lib/api/response/trading_platform_password_change_response_result.dart b/lib/api/response/trading_platform_password_change_response_result.dart index 5009db48f4..e5fb229501 100644 --- a/lib/api/response/trading_platform_password_change_response_result.dart +++ b/lib/api/response/trading_platform_password_change_response_result.dart @@ -20,10 +20,8 @@ class TradingPlatformPasswordChangeResponse extends TradingPlatformPasswordChangeResponseModel { /// Initializes Trading platform password change response class. const TradingPlatformPasswordChangeResponse({ - bool? tradingPlatformPasswordChange, - }) : super( - tradingPlatformPasswordChange: tradingPlatformPasswordChange, - ); + super.tradingPlatformPasswordChange, + }); /// Creates an instance from JSON. factory TradingPlatformPasswordChangeResponse.fromJson( diff --git a/lib/api/response/trading_platform_password_reset_response_result.dart b/lib/api/response/trading_platform_password_reset_response_result.dart index e825b072a7..192f020abf 100644 --- a/lib/api/response/trading_platform_password_reset_response_result.dart +++ b/lib/api/response/trading_platform_password_reset_response_result.dart @@ -19,10 +19,8 @@ class TradingPlatformPasswordResetResponse extends TradingPlatformPasswordResetResponseModel { /// Initializes Trading platform password reset response class. const TradingPlatformPasswordResetResponse({ - bool? tradingPlatformPasswordReset, - }) : super( - tradingPlatformPasswordReset: tradingPlatformPasswordReset, - ); + super.tradingPlatformPasswordReset, + }); /// Creates an instance from JSON. factory TradingPlatformPasswordResetResponse.fromJson( diff --git a/lib/api/response/trading_platform_product_listing_response_result.dart b/lib/api/response/trading_platform_product_listing_response_result.dart index ad32b872ec..c3a202e1f4 100644 --- a/lib/api/response/trading_platform_product_listing_response_result.dart +++ b/lib/api/response/trading_platform_product_listing_response_result.dart @@ -21,11 +21,8 @@ class TradingPlatformProductListingResponse extends TradingPlatformProductListingResponseModel { /// Initializes Trading platform product listing response class. const TradingPlatformProductListingResponse({ - Map? - tradingPlatformProductListing, - }) : super( - tradingPlatformProductListing: tradingPlatformProductListing, - ); + super.tradingPlatformProductListing, + }); /// Creates an instance from JSON. factory TradingPlatformProductListingResponse.fromJson( @@ -92,16 +89,11 @@ class TradingPlatformProductListingProperty extends TradingPlatformProductListingPropertyModel { /// Initializes Trading platform product listing property class. const TradingPlatformProductListingProperty({ - List? availableMarkets, - List? availableTradeTypes, - String? name, - List? productList, - }) : super( - availableMarkets: availableMarkets, - availableTradeTypes: availableTradeTypes, - name: name, - productList: productList, - ); + super.availableMarkets, + super.availableTradeTypes, + super.name, + super.productList, + }); /// Creates an instance from JSON. factory TradingPlatformProductListingProperty.fromJson( @@ -206,18 +198,12 @@ abstract class ProductListItemModel { class ProductListItem extends ProductListItemModel { /// Initializes Product list item class. const ProductListItem({ - List? availableAccountTypes, - List? availableTradeTypes, - Market? market, - Submarket? submarket, - Symbol? symbol, - }) : super( - availableAccountTypes: availableAccountTypes, - availableTradeTypes: availableTradeTypes, - market: market, - submarket: submarket, - symbol: symbol, - ); + super.availableAccountTypes, + super.availableTradeTypes, + super.market, + super.submarket, + super.symbol, + }); /// Creates an instance from JSON. factory ProductListItem.fromJson(Map json) => @@ -310,12 +296,9 @@ abstract class MarketModel { class Market extends MarketModel { /// Initializes Market class. const Market({ - String? displayName, - String? name, - }) : super( - displayName: displayName, - name: name, - ); + super.displayName, + super.name, + }); /// Creates an instance from JSON. factory Market.fromJson(Map json) => Market( @@ -362,12 +345,9 @@ abstract class SubmarketModel { class Submarket extends SubmarketModel { /// Initializes Submarket class. const Submarket({ - String? displayName, - String? name, - }) : super( - displayName: displayName, - name: name, - ); + super.displayName, + super.name, + }); /// Creates an instance from JSON. factory Submarket.fromJson(Map json) => Submarket( @@ -414,12 +394,9 @@ abstract class SymbolModel { class Symbol extends SymbolModel { /// Initializes Symbol class. const Symbol({ - String? displayName, - String? name, - }) : super( - displayName: displayName, - name: name, - ); + super.displayName, + super.name, + }); /// Creates an instance from JSON. factory Symbol.fromJson(Map json) => Symbol( diff --git a/lib/api/response/trading_platform_withdrawal_response_result.dart b/lib/api/response/trading_platform_withdrawal_response_result.dart index 7afc588b40..e15ca38b05 100644 --- a/lib/api/response/trading_platform_withdrawal_response_result.dart +++ b/lib/api/response/trading_platform_withdrawal_response_result.dart @@ -20,10 +20,8 @@ class TradingPlatformWithdrawalResponse extends TradingPlatformWithdrawalResponseModel { /// Initializes Trading platform withdrawal response class. const TradingPlatformWithdrawalResponse({ - TradingPlatformWithdrawal? tradingPlatformWithdrawal, - }) : super( - tradingPlatformWithdrawal: tradingPlatformWithdrawal, - ); + super.tradingPlatformWithdrawal, + }); /// Creates an instance from JSON. factory TradingPlatformWithdrawalResponse.fromJson( @@ -71,10 +69,8 @@ abstract class TradingPlatformWithdrawalModel { class TradingPlatformWithdrawal extends TradingPlatformWithdrawalModel { /// Initializes Trading platform withdrawal class. const TradingPlatformWithdrawal({ - int? transactionId, - }) : super( - transactionId: transactionId, - ); + super.transactionId, + }); /// Creates an instance from JSON. factory TradingPlatformWithdrawal.fromJson(Map json) => diff --git a/lib/api/response/transfer_between_accounts_response_result.dart b/lib/api/response/transfer_between_accounts_response_result.dart index 393049fcc7..301a58247e 100644 --- a/lib/api/response/transfer_between_accounts_response_result.dart +++ b/lib/api/response/transfer_between_accounts_response_result.dart @@ -42,18 +42,12 @@ class TransferBetweenAccountsResponse extends TransferBetweenAccountsResponseModel { /// Initializes Transfer between accounts response class. const TransferBetweenAccountsResponse({ - bool? transferBetweenAccounts, - List? accounts, - String? clientToFullName, - String? clientToLoginid, - int? transactionId, - }) : super( - transferBetweenAccounts: transferBetweenAccounts, - accounts: accounts, - clientToFullName: clientToFullName, - clientToLoginid: clientToLoginid, - transactionId: transactionId, - ); + super.transferBetweenAccounts, + super.accounts, + super.clientToFullName, + super.clientToLoginid, + super.transactionId, + }); /// Creates an instance from JSON. factory TransferBetweenAccountsResponse.fromJson( @@ -151,6 +145,7 @@ final Map accountTypeEnumMapper = "dxtrade": AccountTypeEnum.dxtrade, "derivez": AccountTypeEnum.derivez, "binary": AccountTypeEnum.binary, + "ctrader": AccountTypeEnum.ctrader, }; /// AccountType Enum. @@ -172,6 +167,9 @@ enum AccountTypeEnum { /// binary. binary, + + /// ctrader. + ctrader, } /// MarketTypeEnum mapper. @@ -193,7 +191,6 @@ enum MarketTypeEnum { /// all. all, } - /// Accounts item model class. abstract class AccountsItemModel { /// Initializes Accounts item model class . @@ -241,26 +238,16 @@ abstract class AccountsItemModel { class AccountsItem extends AccountsItemModel { /// Initializes Accounts item class. const AccountsItem({ - AccountTypeEnum? accountType, - String? balance, - String? currency, - bool? demoAccount, - String? derivezGroup, - String? loginid, - MarketTypeEnum? marketType, - String? mt5Group, - String? status, - }) : super( - accountType: accountType, - balance: balance, - currency: currency, - demoAccount: demoAccount, - derivezGroup: derivezGroup, - loginid: loginid, - marketType: marketType, - mt5Group: mt5Group, - status: status, - ); + super.accountType, + super.balance, + super.currency, + super.demoAccount, + super.derivezGroup, + super.loginid, + super.marketType, + super.mt5Group, + super.status, + }); /// Creates an instance from JSON. factory AccountsItem.fromJson(Map json) => AccountsItem( diff --git a/lib/api/response/wallet_migration_response_extended.dart b/lib/api/response/wallet_migration_response_extended.dart new file mode 100644 index 0000000000..28b1aa2203 --- /dev/null +++ b/lib/api/response/wallet_migration_response_extended.dart @@ -0,0 +1,57 @@ +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/basic_api/generated/wallet_migration_receive.dart'; +import 'package:flutter_deriv_api/basic_api/generated/wallet_migration_send.dart'; +import 'package:flutter_deriv_api/helpers/helpers.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; + +import 'wallet_migration_response_result.dart'; + +/// The extended version of the [WalletMigrationResponse] class to implement +/// the API call methods. +class WalletMigrationResponseExtended extends WalletMigrationResponse { + static final BaseAPI _api = Injector()(); + + /// Initiates the migration process to wallet. can also check the status of + /// the migration or reset it if it has failed for any reason. + /// + /// [request] is the request object. For its `walletMigration` field, you can + /// set the following values: + /// - `start` to initiate the migration process. + /// - `state` to check the status of the migration. + /// - `reset` to reset the migration process. + static Future fetchWalletMigration({ + required WalletMigrationRequest request, + }) async { + final WalletMigrationReceive response = await _api.call(request: request); + + checkException( + response: response, + exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => + BaseAPIException(baseExceptionModel: baseExceptionModel), + ); + + return WalletMigrationResponse.fromJson(response.walletMigration); + } + + /// Starts the user's migration process to wallet. + static Future startMigration() => fetchWalletMigration( + request: const WalletMigrationRequest( + walletMigration: 'start', + ), + ); + + /// Resets the user's migration process to wallet. + static Future resetMigration() => fetchWalletMigration( + request: const WalletMigrationRequest( + walletMigration: 'reset', + ), + ); + + /// Checks the status of the user's migration process to wallet. + static Future checkStatus() => fetchWalletMigration( + request: const WalletMigrationRequest( + walletMigration: 'state', + ), + ); +} diff --git a/lib/api/response/wallet_migration_response_result.dart b/lib/api/response/wallet_migration_response_result.dart new file mode 100644 index 0000000000..ebe3e04e10 --- /dev/null +++ b/lib/api/response/wallet_migration_response_result.dart @@ -0,0 +1,417 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Wallet migration response model class. +abstract class WalletMigrationResponseModel { + /// Initializes Wallet migration response model class . + const WalletMigrationResponseModel({ + this.walletMigration, + }); + + /// The information regarding wallet migration state + final WalletMigration? walletMigration; +} + +/// Wallet migration response class. +class WalletMigrationResponse extends WalletMigrationResponseModel { + /// Initializes Wallet migration response class. + const WalletMigrationResponse({ + super.walletMigration, + }); + + /// Creates an instance from JSON. + factory WalletMigrationResponse.fromJson( + dynamic walletMigrationJson, + ) => + WalletMigrationResponse( + walletMigration: walletMigrationJson == null + ? null + : WalletMigration.fromJson(walletMigrationJson), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (walletMigration != null) { + resultMap['wallet_migration'] = walletMigration!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + WalletMigrationResponse copyWith({ + WalletMigration? walletMigration, + }) => + WalletMigrationResponse( + walletMigration: walletMigration ?? this.walletMigration, + ); +} + +/// AccountCategoryEnum mapper. +final Map accountCategoryEnumMapper = + { + "wallet": AccountCategoryEnum.wallet, +}; + +/// AccountCategory Enum. +enum AccountCategoryEnum { + /// wallet. + wallet, +} + +/// LinkAccountsItemAccountCategoryEnum mapper. +final Map + linkAccountsItemAccountCategoryEnumMapper = + { + "trading": LinkAccountsItemAccountCategoryEnum.trading, +}; + +/// AccountCategory Enum. +enum LinkAccountsItemAccountCategoryEnum { + /// trading. + trading, +} + +/// AccountTypeEnum mapper. +final Map accountTypeEnumMapper = + { + "standard": AccountTypeEnum.standard, + "mt5": AccountTypeEnum.mt5, + "dxtrade": AccountTypeEnum.dxtrade, + "derivez": AccountTypeEnum.derivez, + "ctrader": AccountTypeEnum.ctrader, +}; + +/// AccountType Enum. +enum AccountTypeEnum { + /// standard. + standard, + + /// mt5. + mt5, + + /// dxtrade. + dxtrade, + + /// derivez. + derivez, + + /// ctrader. + ctrader, +} + +/// PlatformEnum mapper. +final Map platformEnumMapper = { + "dtrade": PlatformEnum.dtrade, + "mt5": PlatformEnum.mt5, + "dxtrade": PlatformEnum.dxtrade, + "derivez": PlatformEnum.derivez, + "ctrader": PlatformEnum.ctrader, +}; + +/// Platform Enum. +enum PlatformEnum { + /// dtrade. + dtrade, + + /// mt5. + mt5, + + /// dxtrade. + dxtrade, + + /// derivez. + derivez, + + /// ctrader. + ctrader, +} + +/// AccountListItemPlatformEnum mapper. +final Map + accountListItemPlatformEnumMapper = { + "dwallet": AccountListItemPlatformEnum.dwallet, +}; + +/// Platform Enum. +enum AccountListItemPlatformEnum { + /// dwallet. + dwallet, +} + +/// StateEnum mapper. +final Map stateEnumMapper = { + "ineligible": StateEnum.ineligible, + "eligible": StateEnum.eligible, + "in_progress": StateEnum.inProgress, + "migrated": StateEnum.migrated, + "failed": StateEnum.failed, +}; + +/// State Enum. +enum StateEnum { + /// ineligible. + ineligible, + + /// eligible. + eligible, + + /// in_progress. + inProgress, + + /// migrated. + migrated, + + /// failed. + failed, +} +/// Wallet migration model class. +abstract class WalletMigrationModel { + /// Initializes Wallet migration model class . + const WalletMigrationModel({ + required this.state, + this.accountList, + }); + + /// Current state of migration process + final StateEnum state; + + /// [Optional] This field is only presented when state is eligible. It contains a list of accounts that are eligible for migration and provide information what wallets are going to be created + final List? accountList; +} + +/// Wallet migration class. +class WalletMigration extends WalletMigrationModel { + /// Initializes Wallet migration class. + const WalletMigration({ + required super.state, + super.accountList, + }); + + /// Creates an instance from JSON. + factory WalletMigration.fromJson(Map json) => + WalletMigration( + state: stateEnumMapper[json['state']]!, + accountList: json['account_list'] == null + ? null + : List.from( + json['account_list']?.map( + (dynamic item) => AccountListItem.fromJson(item), + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['state'] = stateEnumMapper.entries + .firstWhere((MapEntry entry) => entry.value == state) + .key; + if (accountList != null) { + resultMap['account_list'] = accountList! + .map( + (AccountListItem item) => item.toJson(), + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + WalletMigration copyWith({ + StateEnum? state, + List? accountList, + }) => + WalletMigration( + state: state ?? this.state, + accountList: accountList ?? this.accountList, + ); +} +/// Account list item model class. +abstract class AccountListItemModel { + /// Initializes Account list item model class . + const AccountListItemModel({ + required this.platform, + required this.linkAccounts, + required this.landingCompanyShort, + required this.currency, + required this.accountType, + required this.accountCategory, + }); + + /// The platform of the account + final AccountListItemPlatformEnum platform; + + /// The list of accounts that will be linked to this wallet account + final List linkAccounts; + + /// The landing company short code of the account + final String landingCompanyShort; + + /// The currency of the account + final String currency; + + /// The type of the account + final String accountType; + + /// The category of the account + final AccountCategoryEnum accountCategory; +} + +/// Account list item class. +class AccountListItem extends AccountListItemModel { + /// Initializes Account list item class. + const AccountListItem({ + required super.accountCategory, + required super.accountType, + required super.currency, + required super.landingCompanyShort, + required super.linkAccounts, + required super.platform, + }); + + /// Creates an instance from JSON. + factory AccountListItem.fromJson(Map json) => + AccountListItem( + accountCategory: accountCategoryEnumMapper[json['account_category']]!, + accountType: json['account_type'], + currency: json['currency'], + landingCompanyShort: json['landing_company_short'], + linkAccounts: List.from( + json['link_accounts'].map( + (dynamic item) => LinkAccountsItem.fromJson(item), + ), + ), + platform: accountListItemPlatformEnumMapper[json['platform']]!, + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['account_category'] = accountCategoryEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == accountCategory) + .key; + resultMap['account_type'] = accountType; + resultMap['currency'] = currency; + resultMap['landing_company_short'] = landingCompanyShort; + resultMap['link_accounts'] = linkAccounts + .map( + (LinkAccountsItem item) => item.toJson(), + ) + .toList(); + + resultMap['platform'] = accountListItemPlatformEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == platform) + .key; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + AccountListItem copyWith({ + AccountCategoryEnum? accountCategory, + String? accountType, + String? currency, + String? landingCompanyShort, + List? linkAccounts, + AccountListItemPlatformEnum? platform, + }) => + AccountListItem( + accountCategory: accountCategory ?? this.accountCategory, + accountType: accountType ?? this.accountType, + currency: currency ?? this.currency, + landingCompanyShort: landingCompanyShort ?? this.landingCompanyShort, + linkAccounts: linkAccounts ?? this.linkAccounts, + platform: platform ?? this.platform, + ); +} +/// Link accounts item model class. +abstract class LinkAccountsItemModel { + /// Initializes Link accounts item model class . + const LinkAccountsItemModel({ + required this.platform, + required this.loginid, + required this.accountType, + required this.accountCategory, + }); + + /// The platform of the account + final PlatformEnum platform; + + /// The loginid of the account + final String loginid; + + /// The type of the account + final AccountTypeEnum accountType; + + /// The category of the account + final LinkAccountsItemAccountCategoryEnum accountCategory; +} + +/// Link accounts item class. +class LinkAccountsItem extends LinkAccountsItemModel { + /// Initializes Link accounts item class. + const LinkAccountsItem({ + required super.accountCategory, + required super.accountType, + required super.loginid, + required super.platform, + }); + + /// Creates an instance from JSON. + factory LinkAccountsItem.fromJson(Map json) => + LinkAccountsItem( + accountCategory: linkAccountsItemAccountCategoryEnumMapper[ + json['account_category']]!, + accountType: accountTypeEnumMapper[json['account_type']]!, + loginid: json['loginid'], + platform: platformEnumMapper[json['platform']]!, + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['account_category'] = linkAccountsItemAccountCategoryEnumMapper + .entries + .firstWhere( + (MapEntry entry) => + entry.value == accountCategory) + .key; + resultMap['account_type'] = accountTypeEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == accountType) + .key; + resultMap['loginid'] = loginid; + resultMap['platform'] = platformEnumMapper.entries + .firstWhere( + (MapEntry entry) => entry.value == platform) + .key; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + LinkAccountsItem copyWith({ + LinkAccountsItemAccountCategoryEnum? accountCategory, + AccountTypeEnum? accountType, + String? loginid, + PlatformEnum? platform, + }) => + LinkAccountsItem( + accountCategory: accountCategory ?? this.accountCategory, + accountType: accountType ?? this.accountType, + loginid: loginid ?? this.loginid, + platform: platform ?? this.platform, + ); +} diff --git a/lib/api/response/website_status_response_result.dart b/lib/api/response/website_status_response_result.dart index 058b5a26ac..9b30d661b8 100644 --- a/lib/api/response/website_status_response_result.dart +++ b/lib/api/response/website_status_response_result.dart @@ -36,12 +36,9 @@ abstract class WebsiteStatusResponseModel { class WebsiteStatusResponse extends WebsiteStatusResponseModel { /// Initializes Website status response class. const WebsiteStatusResponse({ - WebsiteStatus? websiteStatus, - Subscription? subscription, - }) : super( - websiteStatus: websiteStatus, - subscription: subscription, - ); + super.websiteStatus, + super.subscription, + }); /// Creates an instance from JSON. factory WebsiteStatusResponse.fromJson( @@ -284,13 +281,13 @@ enum SiteStatusEnum { /// updating. updating, } - /// Website status model class. abstract class WebsiteStatusModel { /// Initializes Website status model class . const WebsiteStatusModel({ required this.currenciesConfig, required this.apiCallLimits, + this.brokerCodes, this.clientsCountry, this.dxtradeStatus, this.message, @@ -308,6 +305,9 @@ abstract class WebsiteStatusModel { /// Maximum number of API calls during specified period of time. final ApiCallLimits apiCallLimits; + /// List of all available broker codes. + final List? brokerCodes; + /// Country code of connected IP final String? clientsCountry; @@ -340,30 +340,19 @@ abstract class WebsiteStatusModel { class WebsiteStatus extends WebsiteStatusModel { /// Initializes Website status class. const WebsiteStatus({ - required ApiCallLimits apiCallLimits, - required Map currenciesConfig, - String? clientsCountry, - DxtradeStatus? dxtradeStatus, - String? message, - Mt5Status? mt5Status, - P2pConfig? p2pConfig, - PaymentAgents? paymentAgents, - SiteStatusEnum? siteStatus, - List? supportedLanguages, - String? termsConditionsVersion, - }) : super( - apiCallLimits: apiCallLimits, - currenciesConfig: currenciesConfig, - clientsCountry: clientsCountry, - dxtradeStatus: dxtradeStatus, - message: message, - mt5Status: mt5Status, - p2pConfig: p2pConfig, - paymentAgents: paymentAgents, - siteStatus: siteStatus, - supportedLanguages: supportedLanguages, - termsConditionsVersion: termsConditionsVersion, - ); + required super.apiCallLimits, + required super.currenciesConfig, + super.brokerCodes, + super.clientsCountry, + super.dxtradeStatus, + super.message, + super.mt5Status, + super.p2pConfig, + super.paymentAgents, + super.siteStatus, + super.supportedLanguages, + super.termsConditionsVersion, + }); /// Creates an instance from JSON. factory WebsiteStatus.fromJson(Map json) => WebsiteStatus( @@ -375,6 +364,13 @@ class WebsiteStatus extends WebsiteStatusModel { (MapEntry entry) => MapEntry(entry.key, CurrenciesConfigProperty.fromJson(entry.value)))), + brokerCodes: json['broker_codes'] == null + ? null + : List.from( + json['broker_codes']?.map( + (dynamic item) => item, + ), + ), clientsCountry: json['clients_country'], dxtradeStatus: json['dxtrade_status'] == null ? null @@ -409,6 +405,13 @@ class WebsiteStatus extends WebsiteStatusModel { resultMap['api_call_limits'] = apiCallLimits.toJson(); resultMap['currencies_config'] = currenciesConfig; + if (brokerCodes != null) { + resultMap['broker_codes'] = brokerCodes! + .map( + (String item) => item, + ) + .toList(); + } resultMap['clients_country'] = clientsCountry; if (dxtradeStatus != null) { resultMap['dxtrade_status'] = dxtradeStatus!.toJson(); @@ -443,6 +446,7 @@ class WebsiteStatus extends WebsiteStatusModel { WebsiteStatus copyWith({ ApiCallLimits? apiCallLimits, Map? currenciesConfig, + List? brokerCodes, String? clientsCountry, DxtradeStatus? dxtradeStatus, String? message, @@ -456,6 +460,7 @@ class WebsiteStatus extends WebsiteStatusModel { WebsiteStatus( apiCallLimits: apiCallLimits ?? this.apiCallLimits, currenciesConfig: currenciesConfig ?? this.currenciesConfig, + brokerCodes: brokerCodes ?? this.brokerCodes, clientsCountry: clientsCountry ?? this.clientsCountry, dxtradeStatus: dxtradeStatus ?? this.dxtradeStatus, message: message ?? this.message, @@ -468,7 +473,6 @@ class WebsiteStatus extends WebsiteStatusModel { termsConditionsVersion ?? this.termsConditionsVersion, ); } - /// Api call limits model class. abstract class ApiCallLimitsModel { /// Initializes Api call limits model class . @@ -496,16 +500,11 @@ abstract class ApiCallLimitsModel { class ApiCallLimits extends ApiCallLimitsModel { /// Initializes Api call limits class. const ApiCallLimits({ - required MaxProposalSubscription maxProposalSubscription, - required MaxRequestesGeneral maxRequestesGeneral, - required MaxRequestsOutcome maxRequestsOutcome, - required MaxRequestsPricing maxRequestsPricing, - }) : super( - maxProposalSubscription: maxProposalSubscription, - maxRequestesGeneral: maxRequestesGeneral, - maxRequestsOutcome: maxRequestsOutcome, - maxRequestsPricing: maxRequestsPricing, - ); + required super.maxProposalSubscription, + required super.maxRequestesGeneral, + required super.maxRequestsOutcome, + required super.maxRequestsPricing, + }); /// Creates an instance from JSON. factory ApiCallLimits.fromJson(Map json) => ApiCallLimits( @@ -549,7 +548,6 @@ class ApiCallLimits extends ApiCallLimitsModel { maxRequestsPricing: maxRequestsPricing ?? this.maxRequestsPricing, ); } - /// Max proposal subscription model class. abstract class MaxProposalSubscriptionModel { /// Initializes Max proposal subscription model class . @@ -569,12 +567,9 @@ abstract class MaxProposalSubscriptionModel { class MaxProposalSubscription extends MaxProposalSubscriptionModel { /// Initializes Max proposal subscription class. const MaxProposalSubscription({ - required String appliesTo, - required double max, - }) : super( - appliesTo: appliesTo, - max: max, - ); + required super.appliesTo, + required super.max, + }); /// Creates an instance from JSON. factory MaxProposalSubscription.fromJson(Map json) => @@ -603,7 +598,6 @@ class MaxProposalSubscription extends MaxProposalSubscriptionModel { max: max ?? this.max, ); } - /// Max requestes general model class. abstract class MaxRequestesGeneralModel { /// Initializes Max requestes general model class . @@ -627,14 +621,10 @@ abstract class MaxRequestesGeneralModel { class MaxRequestesGeneral extends MaxRequestesGeneralModel { /// Initializes Max requestes general class. const MaxRequestesGeneral({ - required String appliesTo, - required double hourly, - required double minutely, - }) : super( - appliesTo: appliesTo, - hourly: hourly, - minutely: minutely, - ); + required super.appliesTo, + required super.hourly, + required super.minutely, + }); /// Creates an instance from JSON. factory MaxRequestesGeneral.fromJson(Map json) => @@ -667,7 +657,6 @@ class MaxRequestesGeneral extends MaxRequestesGeneralModel { minutely: minutely ?? this.minutely, ); } - /// Max requests outcome model class. abstract class MaxRequestsOutcomeModel { /// Initializes Max requests outcome model class . @@ -691,14 +680,10 @@ abstract class MaxRequestsOutcomeModel { class MaxRequestsOutcome extends MaxRequestsOutcomeModel { /// Initializes Max requests outcome class. const MaxRequestsOutcome({ - required String appliesTo, - required double hourly, - required double minutely, - }) : super( - appliesTo: appliesTo, - hourly: hourly, - minutely: minutely, - ); + required super.appliesTo, + required super.hourly, + required super.minutely, + }); /// Creates an instance from JSON. factory MaxRequestsOutcome.fromJson(Map json) => @@ -731,7 +716,6 @@ class MaxRequestsOutcome extends MaxRequestsOutcomeModel { minutely: minutely ?? this.minutely, ); } - /// Max requests pricing model class. abstract class MaxRequestsPricingModel { /// Initializes Max requests pricing model class . @@ -755,14 +739,10 @@ abstract class MaxRequestsPricingModel { class MaxRequestsPricing extends MaxRequestsPricingModel { /// Initializes Max requests pricing class. const MaxRequestsPricing({ - required String appliesTo, - required double hourly, - required double minutely, - }) : super( - appliesTo: appliesTo, - hourly: hourly, - minutely: minutely, - ); + required super.appliesTo, + required super.hourly, + required super.minutely, + }); /// Creates an instance from JSON. factory MaxRequestsPricing.fromJson(Map json) => @@ -795,7 +775,6 @@ class MaxRequestsPricing extends MaxRequestsPricingModel { minutely: minutely ?? this.minutely, ); } - /// Currencies config property model class. abstract class CurrenciesConfigPropertyModel { /// Initializes Currencies config property model class . @@ -839,24 +818,15 @@ abstract class CurrenciesConfigPropertyModel { class CurrenciesConfigProperty extends CurrenciesConfigPropertyModel { /// Initializes Currencies config property class. const CurrenciesConfigProperty({ - required double fractionalDigits, - required double isDepositSuspended, - required double isSuspended, - required double isWithdrawalSuspended, - required double stakeDefault, - required TransferBetweenAccounts transferBetweenAccounts, - required TypeEnum type, - String? name, - }) : super( - fractionalDigits: fractionalDigits, - isDepositSuspended: isDepositSuspended, - isSuspended: isSuspended, - isWithdrawalSuspended: isWithdrawalSuspended, - stakeDefault: stakeDefault, - transferBetweenAccounts: transferBetweenAccounts, - type: type, - name: name, - ); + required super.fractionalDigits, + required super.isDepositSuspended, + required super.isSuspended, + required super.isWithdrawalSuspended, + required super.stakeDefault, + required super.transferBetweenAccounts, + required super.type, + super.name, + }); /// Creates an instance from JSON. factory CurrenciesConfigProperty.fromJson(Map json) => @@ -915,13 +885,13 @@ class CurrenciesConfigProperty extends CurrenciesConfigPropertyModel { name: name ?? this.name, ); } - /// Transfer between accounts model class. abstract class TransferBetweenAccountsModel { /// Initializes Transfer between accounts model class . const TransferBetweenAccountsModel({ required this.limits, required this.fees, + this.limitsCtrader, this.limitsDerivez, this.limitsDxtrade, this.limitsMt5, @@ -933,6 +903,9 @@ abstract class TransferBetweenAccountsModel { /// The fee that applies for transfer between accounts with different types of currencies. final Map fees; + /// Range of allowed amount for transfer between ctrader accounts. + final Map? limitsCtrader; + /// Range of allowed amount for transfer between derivez accounts. final Map? limitsDerivez; @@ -947,18 +920,13 @@ abstract class TransferBetweenAccountsModel { class TransferBetweenAccounts extends TransferBetweenAccountsModel { /// Initializes Transfer between accounts class. const TransferBetweenAccounts({ - required Map fees, - required Limits limits, - Map? limitsDerivez, - Map? limitsDxtrade, - Map? limitsMt5, - }) : super( - fees: fees, - limits: limits, - limitsDerivez: limitsDerivez, - limitsDxtrade: limitsDxtrade, - limitsMt5: limitsMt5, - ); + required super.fees, + required super.limits, + super.limitsCtrader, + super.limitsDerivez, + super.limitsDxtrade, + super.limitsMt5, + }); /// Creates an instance from JSON. factory TransferBetweenAccounts.fromJson(Map json) => @@ -968,6 +936,7 @@ class TransferBetweenAccounts extends TransferBetweenAccountsModel { .map>((MapEntry entry) => MapEntry(entry.key, getDouble(entry.value)!))), limits: Limits.fromJson(json['limits']), + limitsCtrader: json['limits_ctrader'], limitsDerivez: json['limits_derivez'], limitsDxtrade: json['limits_dxtrade'], limitsMt5: json['limits_mt5'], @@ -980,6 +949,7 @@ class TransferBetweenAccounts extends TransferBetweenAccountsModel { resultMap['fees'] = fees; resultMap['limits'] = limits.toJson(); + resultMap['limits_ctrader'] = limitsCtrader; resultMap['limits_derivez'] = limitsDerivez; resultMap['limits_dxtrade'] = limitsDxtrade; resultMap['limits_mt5'] = limitsMt5; @@ -991,6 +961,7 @@ class TransferBetweenAccounts extends TransferBetweenAccountsModel { TransferBetweenAccounts copyWith({ Map? fees, Limits? limits, + Map? limitsCtrader, Map? limitsDerivez, Map? limitsDxtrade, Map? limitsMt5, @@ -998,12 +969,12 @@ class TransferBetweenAccounts extends TransferBetweenAccountsModel { TransferBetweenAccounts( fees: fees ?? this.fees, limits: limits ?? this.limits, + limitsCtrader: limitsCtrader ?? this.limitsCtrader, limitsDerivez: limitsDerivez ?? this.limitsDerivez, limitsDxtrade: limitsDxtrade ?? this.limitsDxtrade, limitsMt5: limitsMt5 ?? this.limitsMt5, ); } - /// Limits model class. abstract class LimitsModel { /// Initializes Limits model class . @@ -1023,12 +994,9 @@ abstract class LimitsModel { class Limits extends LimitsModel { /// Initializes Limits class. const Limits({ - required double min, - double? max, - }) : super( - min: min, - max: max, - ); + required super.min, + super.max, + }); /// Creates an instance from JSON. factory Limits.fromJson(Map json) => Limits( @@ -1056,7 +1024,6 @@ class Limits extends LimitsModel { max: max ?? this.max, ); } - /// Dxtrade status model class. abstract class DxtradeStatusModel { /// Initializes Dxtrade status model class . @@ -1080,14 +1047,10 @@ abstract class DxtradeStatusModel { class DxtradeStatus extends DxtradeStatusModel { /// Initializes Dxtrade status class. const DxtradeStatus({ - int? all, - int? demo, - int? real, - }) : super( - all: all, - demo: demo, - real: real, - ); + super.all, + super.demo, + super.real, + }); /// Creates an instance from JSON. factory DxtradeStatus.fromJson(Map json) => DxtradeStatus( @@ -1119,7 +1082,6 @@ class DxtradeStatus extends DxtradeStatusModel { real: real ?? this.real, ); } - /// Mt5 status model class. abstract class Mt5StatusModel { /// Initializes Mt5 status model class . @@ -1139,12 +1101,9 @@ abstract class Mt5StatusModel { class Mt5Status extends Mt5StatusModel { /// Initializes Mt5 status class. const Mt5Status({ - List? demo, - List? real, - }) : super( - demo: demo, - real: real, - ); + super.demo, + super.real, + }); /// Creates an instance from JSON. factory Mt5Status.fromJson(Map json) => Mt5Status( @@ -1196,7 +1155,6 @@ class Mt5Status extends Mt5StatusModel { real: real ?? this.real, ); } - /// P2p config model class. abstract class P2pConfigModel { /// Initializes P2p config model class . @@ -1214,10 +1172,12 @@ abstract class P2pConfigModel { required this.fixedRateAdverts, required this.featureLevel, required this.disabled, + required this.crossBorderAdsEnabled, required this.cancellationLimit, required this.cancellationGracePeriod, required this.cancellationCountPeriod, required this.cancellationBlockDuration, + required this.blockTrade, required this.advertsActiveLimit, this.advertsArchivePeriod, this.fixedRateAdvertsEndDate, @@ -1263,6 +1223,9 @@ abstract class P2pConfigModel { /// When `true`, the P2P service is unavailable. final bool disabled; + /// When `false`, only exchanges in local currency are allowed for P2P advertiser. + final bool crossBorderAdsEnabled; + /// A buyer will be temporarily barred after marking this number of cancellations within cancellation_period. final int cancellationLimit; @@ -1275,6 +1238,9 @@ abstract class P2pConfigModel { /// A buyer will be blocked for this duration after exceeding the cancellation limit, in hours. final int cancellationBlockDuration; + /// Block trading settings + final BlockTrade blockTrade; + /// Maximum number of active ads allowed by an advertiser per currency pair and advert type (buy or sell). final int advertsActiveLimit; @@ -1292,58 +1258,40 @@ abstract class P2pConfigModel { class P2pConfig extends P2pConfigModel { /// Initializes P2p config class. const P2pConfig({ - required int advertsActiveLimit, - required int cancellationBlockDuration, - required int cancellationCountPeriod, - required int cancellationGracePeriod, - required int cancellationLimit, - required bool disabled, - required int featureLevel, - required FixedRateAdvertsEnum fixedRateAdverts, - required FloatRateAdvertsEnum floatRateAdverts, - required double floatRateOffsetLimit, - required List localCurrencies, - required double maximumAdvertAmount, - required double maximumOrderAmount, - required int orderDailyLimit, - required int orderPaymentPeriod, - required bool paymentMethodsEnabled, - required double reviewPeriod, - required List supportedCurrencies, - int? advertsArchivePeriod, - String? fixedRateAdvertsEndDate, - String? overrideExchangeRate, - }) : super( - advertsActiveLimit: advertsActiveLimit, - cancellationBlockDuration: cancellationBlockDuration, - cancellationCountPeriod: cancellationCountPeriod, - cancellationGracePeriod: cancellationGracePeriod, - cancellationLimit: cancellationLimit, - disabled: disabled, - featureLevel: featureLevel, - fixedRateAdverts: fixedRateAdverts, - floatRateAdverts: floatRateAdverts, - floatRateOffsetLimit: floatRateOffsetLimit, - localCurrencies: localCurrencies, - maximumAdvertAmount: maximumAdvertAmount, - maximumOrderAmount: maximumOrderAmount, - orderDailyLimit: orderDailyLimit, - orderPaymentPeriod: orderPaymentPeriod, - paymentMethodsEnabled: paymentMethodsEnabled, - reviewPeriod: reviewPeriod, - supportedCurrencies: supportedCurrencies, - advertsArchivePeriod: advertsArchivePeriod, - fixedRateAdvertsEndDate: fixedRateAdvertsEndDate, - overrideExchangeRate: overrideExchangeRate, - ); + required super.advertsActiveLimit, + required super.blockTrade, + required super.cancellationBlockDuration, + required super.cancellationCountPeriod, + required super.cancellationGracePeriod, + required super.cancellationLimit, + required super.crossBorderAdsEnabled, + required super.disabled, + required super.featureLevel, + required super.fixedRateAdverts, + required super.floatRateAdverts, + required super.floatRateOffsetLimit, + required super.localCurrencies, + required super.maximumAdvertAmount, + required super.maximumOrderAmount, + required super.orderDailyLimit, + required super.orderPaymentPeriod, + required super.paymentMethodsEnabled, + required super.reviewPeriod, + required super.supportedCurrencies, + super.advertsArchivePeriod, + super.fixedRateAdvertsEndDate, + super.overrideExchangeRate, + }); /// Creates an instance from JSON. factory P2pConfig.fromJson(Map json) => P2pConfig( advertsActiveLimit: json['adverts_active_limit'], + blockTrade: BlockTrade.fromJson(json['block_trade']), cancellationBlockDuration: json['cancellation_block_duration'], cancellationCountPeriod: json['cancellation_count_period'], cancellationGracePeriod: json['cancellation_grace_period'], cancellationLimit: json['cancellation_limit'], + crossBorderAdsEnabled: getBool(json['cross_border_ads_enabled'])!, disabled: getBool(json['disabled'])!, featureLevel: json['feature_level'], fixedRateAdverts: @@ -1377,10 +1325,13 @@ class P2pConfig extends P2pConfigModel { final Map resultMap = {}; resultMap['adverts_active_limit'] = advertsActiveLimit; + resultMap['block_trade'] = blockTrade.toJson(); + resultMap['cancellation_block_duration'] = cancellationBlockDuration; resultMap['cancellation_count_period'] = cancellationCountPeriod; resultMap['cancellation_grace_period'] = cancellationGracePeriod; resultMap['cancellation_limit'] = cancellationLimit; + resultMap['cross_border_ads_enabled'] = crossBorderAdsEnabled; resultMap['disabled'] = disabled; resultMap['feature_level'] = featureLevel; resultMap['fixed_rate_adverts'] = fixedRateAdvertsEnumMapper.entries @@ -1420,10 +1371,12 @@ class P2pConfig extends P2pConfigModel { /// Creates a copy of instance with given parameters. P2pConfig copyWith({ int? advertsActiveLimit, + BlockTrade? blockTrade, int? cancellationBlockDuration, int? cancellationCountPeriod, int? cancellationGracePeriod, int? cancellationLimit, + bool? crossBorderAdsEnabled, bool? disabled, int? featureLevel, FixedRateAdvertsEnum? fixedRateAdverts, @@ -1443,6 +1396,7 @@ class P2pConfig extends P2pConfigModel { }) => P2pConfig( advertsActiveLimit: advertsActiveLimit ?? this.advertsActiveLimit, + blockTrade: blockTrade ?? this.blockTrade, cancellationBlockDuration: cancellationBlockDuration ?? this.cancellationBlockDuration, cancellationCountPeriod: @@ -1450,6 +1404,8 @@ class P2pConfig extends P2pConfigModel { cancellationGracePeriod: cancellationGracePeriod ?? this.cancellationGracePeriod, cancellationLimit: cancellationLimit ?? this.cancellationLimit, + crossBorderAdsEnabled: + crossBorderAdsEnabled ?? this.crossBorderAdsEnabled, disabled: disabled ?? this.disabled, featureLevel: featureLevel ?? this.featureLevel, fixedRateAdverts: fixedRateAdverts ?? this.fixedRateAdverts, @@ -1470,7 +1426,55 @@ class P2pConfig extends P2pConfigModel { overrideExchangeRate: overrideExchangeRate ?? this.overrideExchangeRate, ); } +/// Block trade model class. +abstract class BlockTradeModel { + /// Initializes Block trade model class . + const BlockTradeModel({ + this.disabled, + this.maximumAdvertAmount, + }); + + /// When `true`, Block trading is unavailable. + final bool? disabled; + + /// Maximum amount of a block trade advert, in USD. + final double? maximumAdvertAmount; +} + +/// Block trade class. +class BlockTrade extends BlockTradeModel { + /// Initializes Block trade class. + const BlockTrade({ + super.disabled, + super.maximumAdvertAmount, + }); + + /// Creates an instance from JSON. + factory BlockTrade.fromJson(Map json) => BlockTrade( + disabled: getBool(json['disabled']), + maximumAdvertAmount: getDouble(json['maximum_advert_amount']), + ); + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['disabled'] = disabled; + resultMap['maximum_advert_amount'] = maximumAdvertAmount; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + BlockTrade copyWith({ + bool? disabled, + double? maximumAdvertAmount, + }) => + BlockTrade( + disabled: disabled ?? this.disabled, + maximumAdvertAmount: maximumAdvertAmount ?? this.maximumAdvertAmount, + ); +} /// Local currencies item model class. abstract class LocalCurrenciesItemModel { /// Initializes Local currencies item model class . @@ -1498,16 +1502,11 @@ abstract class LocalCurrenciesItemModel { class LocalCurrenciesItem extends LocalCurrenciesItemModel { /// Initializes Local currencies item class. const LocalCurrenciesItem({ - required String displayName, - required bool hasAdverts, - required String symbol, - int? isDefault, - }) : super( - displayName: displayName, - hasAdverts: hasAdverts, - symbol: symbol, - isDefault: isDefault, - ); + required super.displayName, + required super.hasAdverts, + required super.symbol, + super.isDefault, + }); /// Creates an instance from JSON. factory LocalCurrenciesItem.fromJson(Map json) => @@ -1544,7 +1543,6 @@ class LocalCurrenciesItem extends LocalCurrenciesItemModel { isDefault: isDefault ?? this.isDefault, ); } - /// Payment agents model class. abstract class PaymentAgentsModel { /// Initializes Payment agents model class . @@ -1560,10 +1558,8 @@ abstract class PaymentAgentsModel { class PaymentAgents extends PaymentAgentsModel { /// Initializes Payment agents class. const PaymentAgents({ - required Map initialDepositPerCountry, - }) : super( - initialDepositPerCountry: initialDepositPerCountry, - ); + required super.initialDepositPerCountry, + }); /// Creates an instance from JSON. factory PaymentAgents.fromJson(Map json) => PaymentAgents( @@ -1592,7 +1588,6 @@ class PaymentAgents extends PaymentAgentsModel { initialDepositPerCountry ?? this.initialDepositPerCountry, ); } - /// Subscription model class. abstract class SubscriptionModel { /// Initializes Subscription model class . @@ -1608,10 +1603,8 @@ abstract class SubscriptionModel { class Subscription extends SubscriptionModel { /// Initializes Subscription class. const Subscription({ - required String id, - }) : super( - id: id, - ); + required super.id, + }); /// Creates an instance from JSON. factory Subscription.fromJson(Map json) => Subscription( diff --git a/lib/basic_api/generated/authorize_receive.dart b/lib/basic_api/generated/authorize_receive.dart index b40f4887df..6a2dea5963 100644 --- a/lib/basic_api/generated/authorize_receive.dart +++ b/lib/basic_api/generated/authorize_receive.dart @@ -9,16 +9,11 @@ class AuthorizeReceive extends Response { /// Initialize AuthorizeReceive. const AuthorizeReceive({ this.authorize, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory AuthorizeReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/authorize_send.dart b/lib/basic_api/generated/authorize_send.dart index 31ecf87105..15c237dbd3 100644 --- a/lib/basic_api/generated/authorize_send.dart +++ b/lib/basic_api/generated/authorize_send.dart @@ -10,13 +10,10 @@ class AuthorizeRequest extends Request { const AuthorizeRequest({ this.addToLoginHistory, required this.authorize, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'authorize', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'authorize', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory AuthorizeRequest.fromJson(Map json) => diff --git a/lib/basic_api/generated/get_account_types_receive.dart b/lib/basic_api/generated/get_account_types_receive.dart index 3cded5047b..2542422c26 100644 --- a/lib/basic_api/generated/get_account_types_receive.dart +++ b/lib/basic_api/generated/get_account_types_receive.dart @@ -9,16 +9,11 @@ class GetAccountTypesReceive extends Response { /// Initialize GetAccountTypesReceive. const GetAccountTypesReceive({ this.getAccountTypes, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory GetAccountTypesReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/get_account_types_send.dart b/lib/basic_api/generated/get_account_types_send.dart index ec218b33b8..3697fec157 100644 --- a/lib/basic_api/generated/get_account_types_send.dart +++ b/lib/basic_api/generated/get_account_types_send.dart @@ -8,18 +8,17 @@ import '../request.dart'; class GetAccountTypesRequest extends Request { /// Initialize GetAccountTypesRequest. const GetAccountTypesRequest({ + this.company, this.getAccountTypes = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'get_account_types', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'get_account_types', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory GetAccountTypesRequest.fromJson(Map json) => GetAccountTypesRequest( + company: json['company'] as String?, getAccountTypes: json['get_account_types'] == null ? null : json['get_account_types'] == 1, @@ -27,12 +26,16 @@ class GetAccountTypesRequest extends Request { reqId: json['req_id'] as int?, ); + /// [Optional] Set to landing company to get relevant account types. If not set, this defaults to current account landing company + final String? company; + /// Must be `true` final bool? getAccountTypes; /// Converts this instance to JSON @override Map toJson() => { + 'company': company, 'get_account_types': getAccountTypes == null ? null : getAccountTypes! @@ -45,11 +48,13 @@ class GetAccountTypesRequest extends Request { /// Creates a copy of instance with given parameters @override GetAccountTypesRequest copyWith({ + String? company, bool? getAccountTypes, Map? passthrough, int? reqId, }) => GetAccountTypesRequest( + company: company ?? this.company, getAccountTypes: getAccountTypes ?? this.getAccountTypes, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/get_settings_receive.dart b/lib/basic_api/generated/get_settings_receive.dart index 4822730a8d..9cac4c85ae 100644 --- a/lib/basic_api/generated/get_settings_receive.dart +++ b/lib/basic_api/generated/get_settings_receive.dart @@ -9,16 +9,11 @@ class GetSettingsReceive extends Response { /// Initialize GetSettingsReceive. const GetSettingsReceive({ this.getSettings, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory GetSettingsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/get_settings_send.dart b/lib/basic_api/generated/get_settings_send.dart index 3983af76ae..2f8605934c 100644 --- a/lib/basic_api/generated/get_settings_send.dart +++ b/lib/basic_api/generated/get_settings_send.dart @@ -9,13 +9,10 @@ class GetSettingsRequest extends Request { /// Initialize GetSettingsRequest. const GetSettingsRequest({ this.getSettings = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'get_settings', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'get_settings', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory GetSettingsRequest.fromJson(Map json) => diff --git a/lib/basic_api/generated/landing_company_details_send.dart b/lib/basic_api/generated/landing_company_details_send.dart index ad8785a79c..32f70337f5 100644 --- a/lib/basic_api/generated/landing_company_details_send.dart +++ b/lib/basic_api/generated/landing_company_details_send.dart @@ -8,29 +8,32 @@ import '../request.dart'; class LandingCompanyDetailsRequest extends Request { /// Initialize LandingCompanyDetailsRequest. const LandingCompanyDetailsRequest({ + this.country, required this.landingCompanyDetails, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'landing_company_details', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'landing_company_details', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory LandingCompanyDetailsRequest.fromJson(Map json) => LandingCompanyDetailsRequest( + country: json['country'] as String?, landingCompanyDetails: json['landing_company_details'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); + /// [Optional] Will return an extra field `tin_not_mandatory` indicating if the landing company does not require tax identification number for the provided country. + final String? country; + /// Landing company shortcode. final String? landingCompanyDetails; /// Converts this instance to JSON @override Map toJson() => { + 'country': country, 'landing_company_details': landingCompanyDetails, 'passthrough': passthrough, 'req_id': reqId, @@ -39,11 +42,13 @@ class LandingCompanyDetailsRequest extends Request { /// Creates a copy of instance with given parameters @override LandingCompanyDetailsRequest copyWith({ + String? country, String? landingCompanyDetails, Map? passthrough, int? reqId, }) => LandingCompanyDetailsRequest( + country: country ?? this.country, landingCompanyDetails: landingCompanyDetails ?? this.landingCompanyDetails, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/landing_company_send.dart b/lib/basic_api/generated/landing_company_send.dart index daf7f217f6..df52cef8b9 100644 --- a/lib/basic_api/generated/landing_company_send.dart +++ b/lib/basic_api/generated/landing_company_send.dart @@ -9,13 +9,10 @@ class LandingCompanyRequest extends Request { /// Initialize LandingCompanyRequest. const LandingCompanyRequest({ required this.landingCompany, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'landing_company', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'landing_company', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory LandingCompanyRequest.fromJson(Map json) => diff --git a/lib/basic_api/generated/link_wallet_receive.dart b/lib/basic_api/generated/link_wallet_receive.dart index c811464302..ecdb3c82c9 100644 --- a/lib/basic_api/generated/link_wallet_receive.dart +++ b/lib/basic_api/generated/link_wallet_receive.dart @@ -9,16 +9,11 @@ class LinkWalletReceive extends Response { /// Initialize LinkWalletReceive. const LinkWalletReceive({ this.linkWallet, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory LinkWalletReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/link_wallet_send.dart b/lib/basic_api/generated/link_wallet_send.dart index 5a188dedca..295ac456e9 100644 --- a/lib/basic_api/generated/link_wallet_send.dart +++ b/lib/basic_api/generated/link_wallet_send.dart @@ -11,13 +11,10 @@ class LinkWalletRequest extends Request { required this.clientId, this.linkWallet = true, required this.walletId, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'link_wallet', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'link_wallet', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory LinkWalletRequest.fromJson(Map json) => diff --git a/lib/basic_api/generated/methods/trading_platform_asset_listing_receive_methods.json b/lib/basic_api/generated/methods/trading_platform_asset_listing_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/trading_platform_asset_listing_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/methods/wallet_migration_receive_methods.json b/lib/basic_api/generated/methods/wallet_migration_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/wallet_migration_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/mt5_new_account_receive.dart b/lib/basic_api/generated/mt5_new_account_receive.dart index 1a035485f0..8a081d4e7d 100644 --- a/lib/basic_api/generated/mt5_new_account_receive.dart +++ b/lib/basic_api/generated/mt5_new_account_receive.dart @@ -9,16 +9,11 @@ class Mt5NewAccountReceive extends Response { /// Initialize Mt5NewAccountReceive. const Mt5NewAccountReceive({ this.mt5NewAccount, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory Mt5NewAccountReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/mt5_new_account_send.dart b/lib/basic_api/generated/mt5_new_account_send.dart index ada5e003fe..cf50ed0c55 100644 --- a/lib/basic_api/generated/mt5_new_account_send.dart +++ b/lib/basic_api/generated/mt5_new_account_send.dart @@ -27,14 +27,12 @@ class Mt5NewAccountRequest extends Request { this.phonePassword, this.server, this.state, + this.subAccountCategory, this.zipCode, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'mt5_new_account', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'mt5_new_account', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory Mt5NewAccountRequest.fromJson(Map json) => @@ -60,6 +58,7 @@ class Mt5NewAccountRequest extends Request { phonePassword: json['phonePassword'] as String?, server: json['server'] as String?, state: json['state'] as String?, + subAccountCategory: json['sub_account_category'] as String?, zipCode: json['zipCode'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, @@ -98,7 +97,7 @@ class Mt5NewAccountRequest extends Request { /// The master password of the account. For validation (Accepts any printable ASCII character. Must be within 8-25 characters, and include numbers, lowercase and uppercase letters. Must not be the same as the user's email address). This field is required. final String? mainPassword; - /// [Optional] To choose whether account is conventional or not. Unavailable for financial_stp MT5_account_type + /// [Optional] To choose whether account is conventional or swap_free. Unavailable for financial_stp MT5_account_type final String? mt5AccountCategory; /// [Optional] Financial: Variable spreads, High leverage. Financial STP: Variable spreads, Medium Leverage, more products. If 'account_type' set to 'financial', setting 'mt5_account_type' is also required. @@ -122,6 +121,9 @@ class Mt5NewAccountRequest extends Request { /// [Optional] User's state (region) of residence. final String? state; + /// [Optional] Indicate the sub account category that we have in the cfd group naming convention. + final String? subAccountCategory; + /// [Optional] User's zip code. final String? zipCode; @@ -155,6 +157,7 @@ class Mt5NewAccountRequest extends Request { 'phonePassword': phonePassword, 'server': server, 'state': state, + 'sub_account_category': subAccountCategory, 'zipCode': zipCode, 'passthrough': passthrough, 'req_id': reqId, @@ -182,6 +185,7 @@ class Mt5NewAccountRequest extends Request { String? phonePassword, String? server, String? state, + String? subAccountCategory, String? zipCode, Map? passthrough, int? reqId, @@ -206,6 +210,7 @@ class Mt5NewAccountRequest extends Request { phonePassword: phonePassword ?? this.phonePassword, server: server ?? this.server, state: state ?? this.state, + subAccountCategory: subAccountCategory ?? this.subAccountCategory, zipCode: zipCode ?? this.zipCode, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/mt5_password_change_receive.dart b/lib/basic_api/generated/mt5_password_change_receive.dart index 7aaeed5bf5..20e1a5209e 100644 --- a/lib/basic_api/generated/mt5_password_change_receive.dart +++ b/lib/basic_api/generated/mt5_password_change_receive.dart @@ -9,16 +9,11 @@ class Mt5PasswordChangeReceive extends Response { /// Initialize Mt5PasswordChangeReceive. const Mt5PasswordChangeReceive({ this.mt5PasswordChange, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory Mt5PasswordChangeReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/new_account_maltainvest_send.dart b/lib/basic_api/generated/new_account_maltainvest_send.dart index 4ba6436f32..5a3d3b65da 100644 --- a/lib/basic_api/generated/new_account_maltainvest_send.dart +++ b/lib/basic_api/generated/new_account_maltainvest_send.dart @@ -17,45 +17,44 @@ class NewAccountMaltainvestRequest extends Request { this.addressPostcode, this.addressState, this.affiliateToken, - this.binaryOptionsTradingExperience, - this.binaryOptionsTradingFrequency, - this.cfdTradingExperience, - this.cfdTradingFrequency, + required this.cfdExperience, + required this.cfdFrequency, + required this.cfdTradingDefinition, this.citizen, this.clientType, this.currency, required this.dateOfBirth, required this.educationLevel, required this.employmentIndustry, - this.employmentStatus, + required this.employmentStatus, required this.estimatedWorth, required this.firstName, - this.forexTradingExperience, - this.forexTradingFrequency, required this.incomeSource, required this.lastName, + required this.leverageImpactTrading, + required this.leverageTradingHighRiskStopLoss, required this.netIncome, this.newAccountMaltainvest = true, this.nonPepDeclaration, required this.occupation, - this.otherInstrumentsTradingExperience, - this.otherInstrumentsTradingFrequency, this.phone, this.placeOfBirth, + required this.requiredInitialMargin, required this.residence, + required this.riskTolerance, required this.salutation, this.secretAnswer, this.secretQuestion, + required this.sourceOfExperience, this.sourceOfWealth, required this.taxIdentificationNumber, required this.taxResidence, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'new_account_maltainvest', - passthrough: passthrough, - reqId: reqId, - ); + required this.tradingExperienceFinancialInstruments, + required this.tradingFrequencyFinancialInstruments, + super.msgType = 'new_account_maltainvest', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory NewAccountMaltainvestRequest.fromJson(Map json) => @@ -70,12 +69,9 @@ class NewAccountMaltainvestRequest extends Request { addressPostcode: json['address_postcode'] as String?, addressState: json['address_state'] as String?, affiliateToken: json['affiliate_token'] as String?, - binaryOptionsTradingExperience: - json['binary_options_trading_experience'] as String?, - binaryOptionsTradingFrequency: - json['binary_options_trading_frequency'] as String?, - cfdTradingExperience: json['cfd_trading_experience'] as String?, - cfdTradingFrequency: json['cfd_trading_frequency'] as String?, + cfdExperience: json['cfd_experience'] as String?, + cfdFrequency: json['cfd_frequency'] as String?, + cfdTradingDefinition: json['cfd_trading_definition'] as String?, citizen: json['citizen'] as String?, clientType: json['client_type'] as String?, currency: json['currency'] as String?, @@ -85,29 +81,33 @@ class NewAccountMaltainvestRequest extends Request { employmentStatus: json['employment_status'] as String?, estimatedWorth: json['estimated_worth'] as String?, firstName: json['first_name'] as String?, - forexTradingExperience: json['forex_trading_experience'] as String?, - forexTradingFrequency: json['forex_trading_frequency'] as String?, incomeSource: json['income_source'] as String?, lastName: json['last_name'] as String?, + leverageImpactTrading: json['leverage_impact_trading'] as String?, + leverageTradingHighRiskStopLoss: + json['leverage_trading_high_risk_stop_loss'] as String?, netIncome: json['net_income'] as String?, newAccountMaltainvest: json['new_account_maltainvest'] == null ? null : json['new_account_maltainvest'] == 1, nonPepDeclaration: json['non_pep_declaration'] as int?, occupation: json['occupation'] as String?, - otherInstrumentsTradingExperience: - json['other_instruments_trading_experience'] as String?, - otherInstrumentsTradingFrequency: - json['other_instruments_trading_frequency'] as String?, phone: json['phone'] as String?, placeOfBirth: json['place_of_birth'] as String?, + requiredInitialMargin: json['required_initial_margin'] as String?, residence: json['residence'] as String?, + riskTolerance: json['risk_tolerance'] as String?, salutation: json['salutation'] as String?, secretAnswer: json['secret_answer'] as String?, secretQuestion: json['secret_question'] as String?, + sourceOfExperience: json['source_of_experience'] as String?, sourceOfWealth: json['source_of_wealth'] as String?, taxIdentificationNumber: json['tax_identification_number'] as String?, taxResidence: json['tax_residence'] as String?, + tradingExperienceFinancialInstruments: + json['trading_experience_financial_instruments'] as String?, + tradingFrequencyFinancialInstruments: + json['trading_frequency_financial_instruments'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -139,17 +139,14 @@ class NewAccountMaltainvestRequest extends Request { /// [Optional] Affiliate token, within 32 characters. final String? affiliateToken; - /// [Optional] Binary options trading experience. - final String? binaryOptionsTradingExperience; + /// How much experience do you have in CFD trading? + final String? cfdExperience; - /// [Optional] Binary options trading frequency. - final String? binaryOptionsTradingFrequency; + /// How many CFD trades have you placed in the past 12 months? + final String? cfdFrequency; - /// [Optional] CFDs trading experience. - final String? cfdTradingExperience; - - /// [Optional] CFDs trading frequency. - final String? cfdTradingFrequency; + /// In your understanding, CFD trading allows you to: + final String? cfdTradingDefinition; /// [Optional] Country of legal citizenship, 2-letter country code. Possible value receive from `residence_list` call. final String? citizen; @@ -169,7 +166,7 @@ class NewAccountMaltainvestRequest extends Request { /// Industry of Employment. final String? employmentIndustry; - /// [Optional] Employment Status. + /// Employment Status. final String? employmentStatus; /// Estimated Net Worth. @@ -178,18 +175,18 @@ class NewAccountMaltainvestRequest extends Request { /// Within 2-50 characters, use only letters, spaces, hyphens, full-stops or apostrophes. final String? firstName; - /// [Optional] Forex trading experience. - final String? forexTradingExperience; - - /// [Optional] Forex trading frequency. - final String? forexTradingFrequency; - /// Income Source. final String? incomeSource; /// Within 2-50 characters, use only letters, spaces, hyphens, full-stops or apostrophes. final String? lastName; + /// How does leverage affect CFD trading? + final String? leverageImpactTrading; + + /// Leverage trading is high-risk, so it's a good idea to use risk management features such as stop loss. Stop loss allows you to + final String? leverageTradingHighRiskStopLoss; + /// Net Annual Income. final String? netIncome; @@ -202,21 +199,21 @@ class NewAccountMaltainvestRequest extends Request { /// Occupation. final String? occupation; - /// [Optional] Trading experience in other financial instruments. - final String? otherInstrumentsTradingExperience; - - /// [Optional] Trading frequency in other financial instruments. - final String? otherInstrumentsTradingFrequency; - /// [Optional] Starting with `+` followed by 9-35 digits, hyphens or space. final String? phone; /// [Optional] Place of birth, 2-letter country code. final String? placeOfBirth; + /// When would you be required to pay an initial margin? + final String? requiredInitialMargin; + /// 2-letter country code, possible value receive from `residence_list` call. final String? residence; + /// Do you understand that you could potentially lose 100% of the money you use to trade? + final String? riskTolerance; + /// Accept any value in enum list. final String? salutation; @@ -226,6 +223,9 @@ class NewAccountMaltainvestRequest extends Request { /// [Optional] Accept any value in enum list. final String? secretQuestion; + /// How much knowledge and experience do you have in relation to online trading? + final String? sourceOfExperience; + /// [Optional] Source of wealth. final String? sourceOfWealth; @@ -235,6 +235,12 @@ class NewAccountMaltainvestRequest extends Request { /// Residence for tax purpose. Comma separated iso country code if multiple jurisdictions. Only applicable for real money account. Required for `maltainvest` landing company. final String? taxResidence; + /// How much experience do you have with other financial instruments? + final String? tradingExperienceFinancialInstruments; + + /// How many trades have you placed with other financial instruments in the past 12 months? + final String? tradingFrequencyFinancialInstruments; + /// Converts this instance to JSON @override Map toJson() => { @@ -251,10 +257,9 @@ class NewAccountMaltainvestRequest extends Request { 'address_postcode': addressPostcode, 'address_state': addressState, 'affiliate_token': affiliateToken, - 'binary_options_trading_experience': binaryOptionsTradingExperience, - 'binary_options_trading_frequency': binaryOptionsTradingFrequency, - 'cfd_trading_experience': cfdTradingExperience, - 'cfd_trading_frequency': cfdTradingFrequency, + 'cfd_experience': cfdExperience, + 'cfd_frequency': cfdFrequency, + 'cfd_trading_definition': cfdTradingDefinition, 'citizen': citizen, 'client_type': clientType, 'currency': currency, @@ -264,10 +269,10 @@ class NewAccountMaltainvestRequest extends Request { 'employment_status': employmentStatus, 'estimated_worth': estimatedWorth, 'first_name': firstName, - 'forex_trading_experience': forexTradingExperience, - 'forex_trading_frequency': forexTradingFrequency, 'income_source': incomeSource, 'last_name': lastName, + 'leverage_impact_trading': leverageImpactTrading, + 'leverage_trading_high_risk_stop_loss': leverageTradingHighRiskStopLoss, 'net_income': netIncome, 'new_account_maltainvest': newAccountMaltainvest == null ? null @@ -276,18 +281,22 @@ class NewAccountMaltainvestRequest extends Request { : 0, 'non_pep_declaration': nonPepDeclaration, 'occupation': occupation, - 'other_instruments_trading_experience': - otherInstrumentsTradingExperience, - 'other_instruments_trading_frequency': otherInstrumentsTradingFrequency, 'phone': phone, 'place_of_birth': placeOfBirth, + 'required_initial_margin': requiredInitialMargin, 'residence': residence, + 'risk_tolerance': riskTolerance, 'salutation': salutation, 'secret_answer': secretAnswer, 'secret_question': secretQuestion, + 'source_of_experience': sourceOfExperience, 'source_of_wealth': sourceOfWealth, 'tax_identification_number': taxIdentificationNumber, 'tax_residence': taxResidence, + 'trading_experience_financial_instruments': + tradingExperienceFinancialInstruments, + 'trading_frequency_financial_instruments': + tradingFrequencyFinancialInstruments, 'passthrough': passthrough, 'req_id': reqId, }; @@ -304,10 +313,9 @@ class NewAccountMaltainvestRequest extends Request { String? addressPostcode, String? addressState, String? affiliateToken, - String? binaryOptionsTradingExperience, - String? binaryOptionsTradingFrequency, - String? cfdTradingExperience, - String? cfdTradingFrequency, + String? cfdExperience, + String? cfdFrequency, + String? cfdTradingDefinition, String? citizen, String? clientType, String? currency, @@ -317,25 +325,28 @@ class NewAccountMaltainvestRequest extends Request { String? employmentStatus, String? estimatedWorth, String? firstName, - String? forexTradingExperience, - String? forexTradingFrequency, String? incomeSource, String? lastName, + String? leverageImpactTrading, + String? leverageTradingHighRiskStopLoss, String? netIncome, bool? newAccountMaltainvest, int? nonPepDeclaration, String? occupation, - String? otherInstrumentsTradingExperience, - String? otherInstrumentsTradingFrequency, String? phone, String? placeOfBirth, + String? requiredInitialMargin, String? residence, + String? riskTolerance, String? salutation, String? secretAnswer, String? secretQuestion, + String? sourceOfExperience, String? sourceOfWealth, String? taxIdentificationNumber, String? taxResidence, + String? tradingExperienceFinancialInstruments, + String? tradingFrequencyFinancialInstruments, Map? passthrough, int? reqId, }) => @@ -349,12 +360,9 @@ class NewAccountMaltainvestRequest extends Request { addressPostcode: addressPostcode ?? this.addressPostcode, addressState: addressState ?? this.addressState, affiliateToken: affiliateToken ?? this.affiliateToken, - binaryOptionsTradingExperience: binaryOptionsTradingExperience ?? - this.binaryOptionsTradingExperience, - binaryOptionsTradingFrequency: - binaryOptionsTradingFrequency ?? this.binaryOptionsTradingFrequency, - cfdTradingExperience: cfdTradingExperience ?? this.cfdTradingExperience, - cfdTradingFrequency: cfdTradingFrequency ?? this.cfdTradingFrequency, + cfdExperience: cfdExperience ?? this.cfdExperience, + cfdFrequency: cfdFrequency ?? this.cfdFrequency, + cfdTradingDefinition: cfdTradingDefinition ?? this.cfdTradingDefinition, citizen: citizen ?? this.citizen, clientType: clientType ?? this.clientType, currency: currency ?? this.currency, @@ -364,31 +372,37 @@ class NewAccountMaltainvestRequest extends Request { employmentStatus: employmentStatus ?? this.employmentStatus, estimatedWorth: estimatedWorth ?? this.estimatedWorth, firstName: firstName ?? this.firstName, - forexTradingExperience: - forexTradingExperience ?? this.forexTradingExperience, - forexTradingFrequency: - forexTradingFrequency ?? this.forexTradingFrequency, incomeSource: incomeSource ?? this.incomeSource, lastName: lastName ?? this.lastName, + leverageImpactTrading: + leverageImpactTrading ?? this.leverageImpactTrading, + leverageTradingHighRiskStopLoss: leverageTradingHighRiskStopLoss ?? + this.leverageTradingHighRiskStopLoss, netIncome: netIncome ?? this.netIncome, newAccountMaltainvest: newAccountMaltainvest ?? this.newAccountMaltainvest, nonPepDeclaration: nonPepDeclaration ?? this.nonPepDeclaration, occupation: occupation ?? this.occupation, - otherInstrumentsTradingExperience: otherInstrumentsTradingExperience ?? - this.otherInstrumentsTradingExperience, - otherInstrumentsTradingFrequency: otherInstrumentsTradingFrequency ?? - this.otherInstrumentsTradingFrequency, phone: phone ?? this.phone, placeOfBirth: placeOfBirth ?? this.placeOfBirth, + requiredInitialMargin: + requiredInitialMargin ?? this.requiredInitialMargin, residence: residence ?? this.residence, + riskTolerance: riskTolerance ?? this.riskTolerance, salutation: salutation ?? this.salutation, secretAnswer: secretAnswer ?? this.secretAnswer, secretQuestion: secretQuestion ?? this.secretQuestion, + sourceOfExperience: sourceOfExperience ?? this.sourceOfExperience, sourceOfWealth: sourceOfWealth ?? this.sourceOfWealth, taxIdentificationNumber: taxIdentificationNumber ?? this.taxIdentificationNumber, taxResidence: taxResidence ?? this.taxResidence, + tradingExperienceFinancialInstruments: + tradingExperienceFinancialInstruments ?? + this.tradingExperienceFinancialInstruments, + tradingFrequencyFinancialInstruments: + tradingFrequencyFinancialInstruments ?? + this.tradingFrequencyFinancialInstruments, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/new_account_real_receive.dart b/lib/basic_api/generated/new_account_real_receive.dart index 17b42b70c8..d45426248e 100644 --- a/lib/basic_api/generated/new_account_real_receive.dart +++ b/lib/basic_api/generated/new_account_real_receive.dart @@ -9,16 +9,11 @@ class NewAccountRealReceive extends Response { /// Initialize NewAccountRealReceive. const NewAccountRealReceive({ this.newAccountReal, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory NewAccountRealReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/new_account_real_send.dart b/lib/basic_api/generated/new_account_real_send.dart index b5a3907a2f..80dd7ac8f6 100644 --- a/lib/basic_api/generated/new_account_real_send.dart +++ b/lib/basic_api/generated/new_account_real_send.dart @@ -11,7 +11,7 @@ class NewAccountRealRequest extends Request { this.accountOpeningReason, this.accountTurnover, this.addressCity, - required this.addressLine1, + this.addressLine1, this.addressLine2, this.addressPostcode, this.addressState, @@ -19,26 +19,23 @@ class NewAccountRealRequest extends Request { this.citizen, this.clientType, this.currency, - required this.dateOfBirth, - required this.firstName, - required this.lastName, + this.dateOfBirth, + this.firstName, + this.lastName, this.newAccountReal = true, this.nonPepDeclaration, this.phone, this.placeOfBirth, - required this.residence, + this.residence, this.salutation, this.secretAnswer, this.secretQuestion, this.taxIdentificationNumber, this.taxResidence, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'new_account_real', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'new_account_real', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory NewAccountRealRequest.fromJson(Map json) => diff --git a/lib/basic_api/generated/new_account_virtual_receive.dart b/lib/basic_api/generated/new_account_virtual_receive.dart index 9edd1cb4f3..6ea7ffd2c5 100644 --- a/lib/basic_api/generated/new_account_virtual_receive.dart +++ b/lib/basic_api/generated/new_account_virtual_receive.dart @@ -9,16 +9,11 @@ class NewAccountVirtualReceive extends Response { /// Initialize NewAccountVirtualReceive. const NewAccountVirtualReceive({ this.newAccountVirtual, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory NewAccountVirtualReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/new_account_virtual_send.dart b/lib/basic_api/generated/new_account_virtual_send.dart index fa783d27a5..3a54d5c1bb 100644 --- a/lib/basic_api/generated/new_account_virtual_send.dart +++ b/lib/basic_api/generated/new_account_virtual_send.dart @@ -30,13 +30,10 @@ class NewAccountVirtualRequest extends Request { this.utmSource, this.utmTerm, required this.verificationCode, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'new_account_virtual', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'new_account_virtual', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory NewAccountVirtualRequest.fromJson(Map json) => diff --git a/lib/basic_api/generated/new_account_wallet_receive.dart b/lib/basic_api/generated/new_account_wallet_receive.dart index 1e85f91e99..2bc0d8a35d 100644 --- a/lib/basic_api/generated/new_account_wallet_receive.dart +++ b/lib/basic_api/generated/new_account_wallet_receive.dart @@ -9,16 +9,11 @@ class NewAccountWalletReceive extends Response { /// Initialize NewAccountWalletReceive. const NewAccountWalletReceive({ this.newAccountWallet, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory NewAccountWalletReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/new_account_wallet_send.dart b/lib/basic_api/generated/new_account_wallet_send.dart index c900792269..d252ab36cb 100644 --- a/lib/basic_api/generated/new_account_wallet_send.dart +++ b/lib/basic_api/generated/new_account_wallet_send.dart @@ -8,49 +8,75 @@ import '../request.dart'; class NewAccountWalletRequest extends Request { /// Initialize NewAccountWalletRequest. const NewAccountWalletRequest({ + this.acceptRisk, + this.accountOpeningReason, + required this.accountType, this.addressCity, this.addressLine1, this.addressLine2, this.addressPostcode, this.addressState, + this.citizen, + this.clientType, required this.currency, this.dateOfBirth, + this.financialAssessment, this.firstName, + this.landingCompanyShort, this.lastName, this.newAccountWallet = true, this.nonPepDeclaration, - required this.paymentMethod, this.phone, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'new_account_wallet', - passthrough: passthrough, - reqId: reqId, - ); + this.salutation, + this.taxIdentificationNumber, + this.taxResidence, + super.msgType = 'new_account_wallet', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory NewAccountWalletRequest.fromJson(Map json) => NewAccountWalletRequest( + acceptRisk: + json['accept_risk'] == null ? null : json['accept_risk'] == 1, + accountOpeningReason: json['account_opening_reason'] as String?, + accountType: json['account_type'] as String?, addressCity: json['address_city'] as String?, addressLine1: json['address_line_1'] as String?, addressLine2: json['address_line_2'] as String?, addressPostcode: json['address_postcode'] as String?, addressState: json['address_state'] as String?, + citizen: json['citizen'] as String?, + clientType: json['client_type'] as String?, currency: json['currency'] as String?, dateOfBirth: json['date_of_birth'] as String?, + financialAssessment: + json['financial_assessment'] as Map?, firstName: json['first_name'] as String?, + landingCompanyShort: json['landing_company_short'] as String?, lastName: json['last_name'] as String?, newAccountWallet: json['new_account_wallet'] == null ? null : json['new_account_wallet'] == 1, nonPepDeclaration: json['non_pep_declaration'] as int?, - paymentMethod: json['payment_method'] as String?, phone: json['phone'] as String?, + salutation: json['salutation'] as String?, + taxIdentificationNumber: json['tax_identification_number'] as String?, + taxResidence: json['tax_residence'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); + /// Show whether client has accepted risk disclaimer. + final bool? acceptRisk; + + /// [Optional] Purpose and reason for requesting the account opening. + final String? accountOpeningReason; + + /// To set the wallets type - only doughflow and crptyo wallets are allowed for initial phase, other types will be added later + final String? accountType; + /// [Optional] Within 35 characters. final String? addressCity; @@ -66,15 +92,27 @@ class NewAccountWalletRequest extends Request { /// [Optional] Possible value receive from `states_list` call. final String? addressState; + /// [Optional] Country of legal citizenship, 2-letter country code. Possible value receive from `residence_list` call. + final String? citizen; + + /// [Optional] Indicates whether this is for a client requesting an account with professional status. + final String? clientType; + /// To set currency of the account. List of supported currencies can be acquired with `payout_currencies` call. final String? currency; /// [Optional] Date of birth format: `yyyy-mm-dd`. final String? dateOfBirth; + /// Required for maltainvest + final Map? financialAssessment; + /// [Optional] Within 2-50 characters, use only letters, spaces, hyphens, full-stops or apostrophes. final String? firstName; + /// [Optional] Set the landing company of the wallet. Default value is 'svg' if company not provided + final String? landingCompanyShort; + /// [Optional] Within 2-50 characters, use only letters, spaces, hyphens, full-stops or apostrophes. final String? lastName; @@ -84,23 +122,40 @@ class NewAccountWalletRequest extends Request { /// [Optional] Indicates client's self-declaration of not being a PEP/RCA (Politically Exposed Person/Relatives and Close Associates). final int? nonPepDeclaration; - /// To set method which is used to transfer to/from wallet. - final String? paymentMethod; - /// [Optional] Starting with `+` followed by 8-35 digits, allowing hyphens or space. final String? phone; + /// Accept any value in enum list. + final String? salutation; + + /// Tax identification number. Only applicable for real money account. Required for `maltainvest` landing company. + final String? taxIdentificationNumber; + + /// Residence for tax purpose. Comma separated iso country code if multiple jurisdictions. Only applicable for real money account. Required for `maltainvest` landing company. + final String? taxResidence; + /// Converts this instance to JSON @override Map toJson() => { + 'accept_risk': acceptRisk == null + ? null + : acceptRisk! + ? 1 + : 0, + 'account_opening_reason': accountOpeningReason, + 'account_type': accountType, 'address_city': addressCity, 'address_line_1': addressLine1, 'address_line_2': addressLine2, 'address_postcode': addressPostcode, 'address_state': addressState, + 'citizen': citizen, + 'client_type': clientType, 'currency': currency, 'date_of_birth': dateOfBirth, + 'financial_assessment': financialAssessment, 'first_name': firstName, + 'landing_company_short': landingCompanyShort, 'last_name': lastName, 'new_account_wallet': newAccountWallet == null ? null @@ -108,8 +163,10 @@ class NewAccountWalletRequest extends Request { ? 1 : 0, 'non_pep_declaration': nonPepDeclaration, - 'payment_method': paymentMethod, 'phone': phone, + 'salutation': salutation, + 'tax_identification_number': taxIdentificationNumber, + 'tax_residence': taxResidence, 'passthrough': passthrough, 'req_id': reqId, }; @@ -117,36 +174,55 @@ class NewAccountWalletRequest extends Request { /// Creates a copy of instance with given parameters @override NewAccountWalletRequest copyWith({ + bool? acceptRisk, + String? accountOpeningReason, + String? accountType, String? addressCity, String? addressLine1, String? addressLine2, String? addressPostcode, String? addressState, + String? citizen, + String? clientType, String? currency, String? dateOfBirth, + Map? financialAssessment, String? firstName, + String? landingCompanyShort, String? lastName, bool? newAccountWallet, int? nonPepDeclaration, - String? paymentMethod, String? phone, + String? salutation, + String? taxIdentificationNumber, + String? taxResidence, Map? passthrough, int? reqId, }) => NewAccountWalletRequest( + acceptRisk: acceptRisk ?? this.acceptRisk, + accountOpeningReason: accountOpeningReason ?? this.accountOpeningReason, + accountType: accountType ?? this.accountType, addressCity: addressCity ?? this.addressCity, addressLine1: addressLine1 ?? this.addressLine1, addressLine2: addressLine2 ?? this.addressLine2, addressPostcode: addressPostcode ?? this.addressPostcode, addressState: addressState ?? this.addressState, + citizen: citizen ?? this.citizen, + clientType: clientType ?? this.clientType, currency: currency ?? this.currency, dateOfBirth: dateOfBirth ?? this.dateOfBirth, + financialAssessment: financialAssessment ?? this.financialAssessment, firstName: firstName ?? this.firstName, + landingCompanyShort: landingCompanyShort ?? this.landingCompanyShort, lastName: lastName ?? this.lastName, newAccountWallet: newAccountWallet ?? this.newAccountWallet, nonPepDeclaration: nonPepDeclaration ?? this.nonPepDeclaration, - paymentMethod: paymentMethod ?? this.paymentMethod, phone: phone ?? this.phone, + salutation: salutation ?? this.salutation, + taxIdentificationNumber: + taxIdentificationNumber ?? this.taxIdentificationNumber, + taxResidence: taxResidence ?? this.taxResidence, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/profit_table_send.dart b/lib/basic_api/generated/profit_table_send.dart index fca57bf712..320c128fde 100644 --- a/lib/basic_api/generated/profit_table_send.dart +++ b/lib/basic_api/generated/profit_table_send.dart @@ -16,13 +16,10 @@ class ProfitTableRequest extends Request { this.offset, this.profitTable = true, this.sort, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'profit_table', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'profit_table', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory ProfitTableRequest.fromJson(Map json) => @@ -35,7 +32,7 @@ class ProfitTableRequest extends Request { description: json['description'] == null ? null : json['description'] == 1, limit: json['limit'] as num?, - offset: json['offset'] as num?, + offset: json['offset'] as int?, profitTable: json['profit_table'] == null ? null : json['profit_table'] == 1, sort: json['sort'] as String?, @@ -59,7 +56,7 @@ class ProfitTableRequest extends Request { final num? limit; /// [Optional] Number of transactions to skip. - final num? offset; + final int? offset; /// Must be `true` final bool? profitTable; @@ -98,7 +95,7 @@ class ProfitTableRequest extends Request { String? dateTo, bool? description, num? limit, - num? offset, + int? offset, bool? profitTable, String? sort, Map? passthrough, diff --git a/lib/basic_api/generated/set_settings_receive.dart b/lib/basic_api/generated/set_settings_receive.dart index 7b939e22c4..4cb252c9ad 100644 --- a/lib/basic_api/generated/set_settings_receive.dart +++ b/lib/basic_api/generated/set_settings_receive.dart @@ -9,16 +9,11 @@ class SetSettingsReceive extends Response { /// Initialize SetSettingsReceive. const SetSettingsReceive({ this.setSettings, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory SetSettingsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/set_settings_send.dart b/lib/basic_api/generated/set_settings_send.dart index 443e116b46..80a8e2fad9 100644 --- a/lib/basic_api/generated/set_settings_send.dart +++ b/lib/basic_api/generated/set_settings_send.dart @@ -17,7 +17,9 @@ class SetSettingsRequest extends Request { this.allowCopiers, this.citizen, this.dateOfBirth, + this.dxtradeUserException, this.emailConsent, + this.employmentStatus, this.featureFlag, this.firstName, this.lastName, @@ -34,13 +36,10 @@ class SetSettingsRequest extends Request { this.taxIdentificationNumber, this.taxResidence, this.tradingHub, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'set_settings', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'set_settings', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory SetSettingsRequest.fromJson(Map json) => @@ -55,8 +54,12 @@ class SetSettingsRequest extends Request { json['allow_copiers'] == null ? null : json['allow_copiers'] == 1, citizen: json['citizen'] as String?, dateOfBirth: json['date_of_birth'] as String?, + dxtradeUserException: json['dxtrade_user_exception'] == null + ? null + : json['dxtrade_user_exception'] == 1, emailConsent: json['email_consent'] == null ? null : json['email_consent'] == 1, + employmentStatus: json['employment_status'] as String?, featureFlag: json['feature_flag'] as Map?, firstName: json['first_name'] as String?, lastName: json['last_name'] as String?, @@ -106,9 +109,15 @@ class SetSettingsRequest extends Request { /// [Optional] Date of birth format: yyyy-mm-dd (can only be changed on unauthenticated svg accounts). final String? dateOfBirth; + /// Boolean value `true` or `false`, indicating if user email belong to dxtrade exception list. + final bool? dxtradeUserException; + /// [Optional] Boolean value `true` or `false`, indicating permission to use email address for any contact which may include marketing final bool? emailConsent; + /// [Optional] Employment Status. + final String? employmentStatus; + /// [Optional] Enable or disable one or multiple features. final Map? featureFlag; @@ -173,11 +182,17 @@ class SetSettingsRequest extends Request { : 0, 'citizen': citizen, 'date_of_birth': dateOfBirth, + 'dxtrade_user_exception': dxtradeUserException == null + ? null + : dxtradeUserException! + ? 1 + : 0, 'email_consent': emailConsent == null ? null : emailConsent! ? 1 : 0, + 'employment_status': employmentStatus, 'feature_flag': featureFlag, 'first_name': firstName, 'last_name': lastName, @@ -218,7 +233,9 @@ class SetSettingsRequest extends Request { bool? allowCopiers, String? citizen, String? dateOfBirth, + bool? dxtradeUserException, bool? emailConsent, + String? employmentStatus, Map? featureFlag, String? firstName, String? lastName, @@ -248,7 +265,9 @@ class SetSettingsRequest extends Request { allowCopiers: allowCopiers ?? this.allowCopiers, citizen: citizen ?? this.citizen, dateOfBirth: dateOfBirth ?? this.dateOfBirth, + dxtradeUserException: dxtradeUserException ?? this.dxtradeUserException, emailConsent: emailConsent ?? this.emailConsent, + employmentStatus: employmentStatus ?? this.employmentStatus, featureFlag: featureFlag ?? this.featureFlag, firstName: firstName ?? this.firstName, lastName: lastName ?? this.lastName, diff --git a/lib/basic_api/generated/statement_receive.dart b/lib/basic_api/generated/statement_receive.dart index 27cc65f1ea..6dffaab987 100644 --- a/lib/basic_api/generated/statement_receive.dart +++ b/lib/basic_api/generated/statement_receive.dart @@ -9,16 +9,11 @@ class StatementReceive extends Response { /// Initialize StatementReceive. const StatementReceive({ this.statement, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory StatementReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/statement_send.dart b/lib/basic_api/generated/statement_send.dart index c721380ae6..55b84bbef6 100644 --- a/lib/basic_api/generated/statement_send.dart +++ b/lib/basic_api/generated/statement_send.dart @@ -15,13 +15,10 @@ class StatementRequest extends Request { this.limit, this.offset, this.statement = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'statement', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'statement', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory StatementRequest.fromJson(Map json) => @@ -32,7 +29,7 @@ class StatementRequest extends Request { description: json['description'] == null ? null : json['description'] == 1, limit: json['limit'] as num?, - offset: json['offset'] as num?, + offset: json['offset'] as int?, statement: json['statement'] == null ? null : json['statement'] == 1, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, @@ -54,7 +51,7 @@ class StatementRequest extends Request { final num? limit; /// [Optional] Number of transactions to skip. - final num? offset; + final int? offset; /// Must be `true` final bool? statement; @@ -89,7 +86,7 @@ class StatementRequest extends Request { int? dateTo, bool? description, num? limit, - num? offset, + int? offset, bool? statement, Map? passthrough, int? reqId, diff --git a/lib/basic_api/generated/trading_durations_receive.dart b/lib/basic_api/generated/trading_durations_receive.dart index 68ce77835d..eed0afb069 100644 --- a/lib/basic_api/generated/trading_durations_receive.dart +++ b/lib/basic_api/generated/trading_durations_receive.dart @@ -9,16 +9,11 @@ class TradingDurationsReceive extends Response { /// Initialize TradingDurationsReceive. const TradingDurationsReceive({ this.tradingDurations, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TradingDurationsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/trading_durations_send.dart b/lib/basic_api/generated/trading_durations_send.dart index bd9d6d5fb3..2d6fe41186 100644 --- a/lib/basic_api/generated/trading_durations_send.dart +++ b/lib/basic_api/generated/trading_durations_send.dart @@ -8,20 +8,19 @@ import '../request.dart'; class TradingDurationsRequest extends Request { /// Initialize TradingDurationsRequest. const TradingDurationsRequest({ - this.landingCompany, + required this.landingCompany, + this.landingCompanyShort, this.tradingDurations = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'trading_durations', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'trading_durations', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TradingDurationsRequest.fromJson(Map json) => TradingDurationsRequest( landingCompany: json['landing_company'] as String?, + landingCompanyShort: json['landing_company_short'] as String?, tradingDurations: json['trading_durations'] == null ? null : json['trading_durations'] == 1, @@ -29,9 +28,12 @@ class TradingDurationsRequest extends Request { reqId: json['req_id'] as int?, ); - /// [Optional] If specified, will return only the underlyings for the specified landing company. + /// Deprecated - Replaced by landing_company_short. final String? landingCompany; + /// [Optional] If specified, will return only the underlyings for the specified landing company. + final String? landingCompanyShort; + /// Must be `true` final bool? tradingDurations; @@ -39,6 +41,7 @@ class TradingDurationsRequest extends Request { @override Map toJson() => { 'landing_company': landingCompany, + 'landing_company_short': landingCompanyShort, 'trading_durations': tradingDurations == null ? null : tradingDurations! @@ -52,12 +55,14 @@ class TradingDurationsRequest extends Request { @override TradingDurationsRequest copyWith({ String? landingCompany, + String? landingCompanyShort, bool? tradingDurations, Map? passthrough, int? reqId, }) => TradingDurationsRequest( landingCompany: landingCompany ?? this.landingCompany, + landingCompanyShort: landingCompanyShort ?? this.landingCompanyShort, tradingDurations: tradingDurations ?? this.tradingDurations, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/trading_platform_asset_listing_receive.dart b/lib/basic_api/generated/trading_platform_asset_listing_receive.dart new file mode 100644 index 0000000000..281a61aacb --- /dev/null +++ b/lib/basic_api/generated/trading_platform_asset_listing_receive.dart @@ -0,0 +1,72 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/trading_platform_asset_listing_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Trading platform asset listing receive class. +class TradingPlatformAssetListingReceive extends Response { + /// Initialize TradingPlatformAssetListingReceive. + const TradingPlatformAssetListingReceive({ + this.subscription, + this.tradingPlatformAssetListing, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory TradingPlatformAssetListingReceive.fromJson( + Map json) => + TradingPlatformAssetListingReceive( + subscription: json['subscription'] as Map?, + tradingPlatformAssetListing: + json['trading_platform_asset_listing'] as Map?, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// For subscription requests only. + final Map? subscription; + + /// Containing Trading asset objects. + final Map? tradingPlatformAssetListing; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'subscription': subscription, + 'trading_platform_asset_listing': tradingPlatformAssetListing, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + TradingPlatformAssetListingReceive copyWith({ + Map? subscription, + Map? tradingPlatformAssetListing, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + TradingPlatformAssetListingReceive( + subscription: subscription ?? this.subscription, + tradingPlatformAssetListing: + tradingPlatformAssetListing ?? this.tradingPlatformAssetListing, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/trading_platform_asset_listing_send.dart b/lib/basic_api/generated/trading_platform_asset_listing_send.dart new file mode 100644 index 0000000000..36d781b2b8 --- /dev/null +++ b/lib/basic_api/generated/trading_platform_asset_listing_send.dart @@ -0,0 +1,97 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/trading_platform_asset_listing_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Trading platform asset listing request class. +class TradingPlatformAssetListingRequest extends Request { + /// Initialize TradingPlatformAssetListingRequest. + const TradingPlatformAssetListingRequest({ + required this.platform, + required this.region, + this.subscribe, + this.tradingPlatformAssetListing = true, + required this.type, + super.msgType = 'trading_platform_asset_listing', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory TradingPlatformAssetListingRequest.fromJson( + Map json) => + TradingPlatformAssetListingRequest( + platform: json['platform'] as String?, + region: json['region'] as String?, + subscribe: json['subscribe'] == null ? null : json['subscribe'] == 1, + tradingPlatformAssetListing: + json['trading_platform_asset_listing'] == null + ? null + : json['trading_platform_asset_listing'] == 1, + type: json['type'] as String?, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// Trading platform name + final String? platform; + + /// Region be either 'eu' or 'row'. + final String? region; + + /// [Optional] If set to `true`, will send updates whenever asset listing is updated. + final bool? subscribe; + + /// Must be `true` + final bool? tradingPlatformAssetListing; + + /// Can be either 'brief' or 'full'. + final String? type; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'platform': platform, + 'region': region, + 'subscribe': subscribe == null + ? null + : subscribe! + ? 1 + : 0, + 'trading_platform_asset_listing': tradingPlatformAssetListing == null + ? null + : tradingPlatformAssetListing! + ? 1 + : 0, + 'type': type, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + TradingPlatformAssetListingRequest copyWith({ + String? platform, + String? region, + bool? subscribe, + bool? tradingPlatformAssetListing, + String? type, + Map? passthrough, + int? reqId, + }) => + TradingPlatformAssetListingRequest( + platform: platform ?? this.platform, + region: region ?? this.region, + subscribe: subscribe ?? this.subscribe, + tradingPlatformAssetListing: + tradingPlatformAssetListing ?? this.tradingPlatformAssetListing, + type: type ?? this.type, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/trading_platform_investor_password_change_send.dart b/lib/basic_api/generated/trading_platform_investor_password_change_send.dart index a3c650ac02..758f7349ab 100644 --- a/lib/basic_api/generated/trading_platform_investor_password_change_send.dart +++ b/lib/basic_api/generated/trading_platform_investor_password_change_send.dart @@ -13,13 +13,10 @@ class TradingPlatformInvestorPasswordChangeRequest extends Request { required this.oldPassword, required this.platform, this.tradingPlatformInvestorPasswordChange = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'trading_platform_investor_password_change', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'trading_platform_investor_password_change', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformInvestorPasswordChangeRequest.fromJson( diff --git a/lib/basic_api/generated/trading_platform_new_account_receive.dart b/lib/basic_api/generated/trading_platform_new_account_receive.dart index a4b0ebd1d6..3748c05479 100644 --- a/lib/basic_api/generated/trading_platform_new_account_receive.dart +++ b/lib/basic_api/generated/trading_platform_new_account_receive.dart @@ -9,16 +9,11 @@ class TradingPlatformNewAccountReceive extends Response { /// Initialize TradingPlatformNewAccountReceive. const TradingPlatformNewAccountReceive({ this.tradingPlatformNewAccount, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformNewAccountReceive.fromJson( diff --git a/lib/basic_api/generated/trading_platform_new_account_send.dart b/lib/basic_api/generated/trading_platform_new_account_send.dart index 26159a3750..bdd7904c45 100644 --- a/lib/basic_api/generated/trading_platform_new_account_send.dart +++ b/lib/basic_api/generated/trading_platform_new_account_send.dart @@ -17,13 +17,10 @@ class TradingPlatformNewAccountRequest extends Request { required this.platform, this.subAccountType, this.tradingPlatformNewAccount = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'trading_platform_new_account', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'trading_platform_new_account', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformNewAccountRequest.fromJson( @@ -59,7 +56,7 @@ class TradingPlatformNewAccountRequest extends Request { /// Market type final String? marketType; - /// The master password of the account. For validation (Accepts any printable ASCII character. Must be within 8-25 characters, and include numbers, lowercase and uppercase letters. Must not be the same as the user's email address). This field is required. + /// The master password of the account. For validation (Accepts any printable ASCII character. Must be within 8-25 characters, and include numbers, lowercase and uppercase letters. Must not be the same as the user's email address). Only for DXTrade. final String? password; /// Name of trading platform. diff --git a/lib/basic_api/generated/wallet_migration_receive.dart b/lib/basic_api/generated/wallet_migration_receive.dart new file mode 100644 index 0000000000..7f088e5999 --- /dev/null +++ b/lib/basic_api/generated/wallet_migration_receive.dart @@ -0,0 +1,61 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/wallet_migration_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Wallet migration receive class. +class WalletMigrationReceive extends Response { + /// Initialize WalletMigrationReceive. + const WalletMigrationReceive({ + this.walletMigration, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory WalletMigrationReceive.fromJson(Map json) => + WalletMigrationReceive( + walletMigration: json['wallet_migration'] as Map?, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// The information regarding wallet migration state + final Map? walletMigration; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'wallet_migration': walletMigration, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + WalletMigrationReceive copyWith({ + Map? walletMigration, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + WalletMigrationReceive( + walletMigration: walletMigration ?? this.walletMigration, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/wallet_migration_send.dart b/lib/basic_api/generated/wallet_migration_send.dart new file mode 100644 index 0000000000..4216d2b22f --- /dev/null +++ b/lib/basic_api/generated/wallet_migration_send.dart @@ -0,0 +1,52 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/wallet_migration_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Wallet migration request class. +class WalletMigrationRequest extends Request { + /// Initialize WalletMigrationRequest. + const WalletMigrationRequest({ + required this.walletMigration, + super.msgType = 'wallet_migration', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory WalletMigrationRequest.fromJson(Map json) => + WalletMigrationRequest( + walletMigration: json['wallet_migration'] as String?, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// Wallet migration action. + final String? walletMigration; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'wallet_migration': walletMigration, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + WalletMigrationRequest copyWith({ + String? walletMigration, + Map? passthrough, + int? reqId, + }) => + WalletMigrationRequest( + walletMigration: walletMigration ?? this.walletMigration, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/helper/response_mapper.helper.dart b/lib/basic_api/helper/response_mapper.helper.dart index 956431bc53..88237bceb5 100644 --- a/lib/basic_api/helper/response_mapper.helper.dart +++ b/lib/basic_api/helper/response_mapper.helper.dart @@ -7,7 +7,6 @@ import '../generated/account_closure_receive.dart'; import '../generated/account_security_receive.dart'; import '../generated/account_statistics_receive.dart'; import '../generated/active_symbols_receive.dart'; -import '../generated/affiliate_account_add_receive.dart'; import '../generated/api_token_receive.dart'; import '../generated/app_delete_receive.dart'; import '../generated/app_get_receive.dart'; @@ -122,6 +121,7 @@ import '../generated/tnc_approval_receive.dart'; import '../generated/topup_virtual_receive.dart'; import '../generated/trading_durations_receive.dart'; import '../generated/trading_platform_accounts_receive.dart'; +import '../generated/trading_platform_asset_listing_receive.dart'; import '../generated/trading_platform_available_accounts_receive.dart'; import '../generated/trading_platform_deposit_receive.dart'; import '../generated/trading_platform_investor_password_change_receive.dart'; @@ -138,6 +138,7 @@ import '../generated/transfer_between_accounts_receive.dart'; import '../generated/unsubscribe_email_receive.dart'; import '../generated/verify_email_cellxpert_receive.dart'; import '../generated/verify_email_receive.dart'; +import '../generated/wallet_migration_receive.dart'; import '../generated/website_status_receive.dart'; import '../response.dart'; @@ -153,8 +154,6 @@ Response getGeneratedResponse(Map responseMap) { return AccountStatisticsReceive.fromJson(responseMap); case 'active_symbols': return ActiveSymbolsReceive.fromJson(responseMap); - case 'affiliate_account_add': - return AffiliateAccountAddReceive.fromJson(responseMap); case 'api_token': return ApiTokenReceive.fromJson(responseMap); case 'app_delete': @@ -383,6 +382,8 @@ Response getGeneratedResponse(Map responseMap) { return TradingDurationsReceive.fromJson(responseMap); case 'trading_platform_accounts': return TradingPlatformAccountsReceive.fromJson(responseMap); + case 'trading_platform_asset_listing': + return TradingPlatformAssetListingReceive.fromJson(responseMap); case 'trading_platform_available_accounts': return TradingPlatformAvailableAccountsReceive.fromJson(responseMap); case 'trading_platform_deposit': @@ -415,6 +416,8 @@ Response getGeneratedResponse(Map responseMap) { return VerifyEmailCellxpertReceive.fromJson(responseMap); case 'verify_email': return VerifyEmailReceive.fromJson(responseMap); + case 'wallet_migration': + return WalletMigrationReceive.fromJson(responseMap); case 'website_status': return WebsiteStatusReceive.fromJson(responseMap); diff --git a/lib/services/connection/api_manager/mock_api.dart b/lib/services/connection/api_manager/mock_api.dart index 8f51940748..a18cc41ecd 100644 --- a/lib/services/connection/api_manager/mock_api.dart +++ b/lib/services/connection/api_manager/mock_api.dart @@ -12,6 +12,8 @@ import 'package:flutter_deriv_api/basic_api/response.dart'; import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; import 'package:flutter_deriv_api/services/connection/api_manager/connection_information.dart'; import 'package:flutter_deriv_api/services/connection/api_manager/exceptions/api_manager_exception.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/mock_data/account/new_account_wallet_response.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/mock_data/cashier/cashier_payments_response.dart'; import 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart'; import 'package:flutter_deriv_api/services/connection/call_manager/exceptions/call_manager_exception.dart'; @@ -21,6 +23,7 @@ import 'mock_data/account/balance_response.dart'; import 'mock_data/account/copy_trading_list_response.dart'; import 'mock_data/account/copy_trading_statistics_response.dart'; import 'mock_data/account/get_account_status_response.dart'; +import 'mock_data/account/get_account_types_response.dart'; import 'mock_data/account/get_limits_response.dart'; import 'mock_data/account/get_self_exclusion_response.dart'; import 'mock_data/account/get_settings_response.dart'; @@ -106,6 +109,7 @@ import 'mock_data/user/set_financial_assessment_response.dart'; import 'mock_data/user/tnc_approval_response.dart'; import 'mock_data/user/transfer_between_accounts_response.dart'; import 'mock_data/user/verify_email_response.dart'; +import 'mock_data/wallet_migration_response.dart'; /// This class is for handling mock API connection and calling mock APIs class MockAPI extends BaseAPI { @@ -203,6 +207,8 @@ class MockAPI extends BaseAPI { return cancelResponse; case 'cashier': return cashierInformationResponse; + case 'cashier_payments': + return cashierPaymentsResponse; case 'contract_update': return contractUpdateResponse; case 'contract_update_history': @@ -226,6 +232,8 @@ class MockAPI extends BaseAPI { return forgetAllResponse; case 'get_account_status': return getAccountStatusResponse; + case 'get_account_types': + return getAccountTypesResponse; case 'get_financial_assessment': return getFinancialAssessmentResponse; case 'get_limits': @@ -263,6 +271,8 @@ class MockAPI extends BaseAPI { return newAccountRealResponse; case 'new_account_virtual': return newAccountVirtualResponse; + case 'new_account_wallet': + return newAccountWalletResponse; case 'oauth_apps': return oauthAppsResponse; case 'p2p_advert_create': @@ -361,6 +371,8 @@ class MockAPI extends BaseAPI { return verifyEmailResponse; case 'website_status': return websiteStatusResponse; + case 'wallet_migration': + return walletMigrationResponse; default: throw APIManagerException( diff --git a/lib/services/connection/api_manager/mock_data/account/get_account_types_response.dart b/lib/services/connection/api_manager/mock_data/account/get_account_types_response.dart new file mode 100644 index 0000000000..fb7a6146e3 --- /dev/null +++ b/lib/services/connection/api_manager/mock_data/account/get_account_types_response.dart @@ -0,0 +1,153 @@ +/// Mock data for get_account_types response. +const String getAccountTypesResponse = '''{ + "echo_req": { + "get_account_types": 1 + }, + "get_account_types": { + "trading": { + "binary": { + "allowed_wallet_currencies": [ + "AUD", + "BTC", + "ETH", + "EUR", + "GBP", + "LTC", + "USD", + "USDC", + "UST", + "eUSDT", + "tUSDT" + ], + "linkable_to_different_currency": 0, + "linkable_wallet_types": [ + "doughflow", + "crypto", + "p2p", + "paymentagent_client" + ] + }, + "derivez": { + "allowed_wallet_currencies": [ + "AUD", + "EUR", + "GBP", + "USD" + ], + "linkable_to_different_currency": 1, + "linkable_wallet_types": [ + "doughflow", + "p2p", + "paymentagent_client" + ] + }, + "dxtrade": { + "allowed_wallet_currencies": [ + "AUD", + "EUR", + "GBP", + "USD" + ], + "linkable_to_different_currency": 1, + "linkable_wallet_types": [ + "doughflow", + "p2p", + "paymentagent_client" + ] + }, + "mt5": { + "allowed_wallet_currencies": [ + "AUD", + "EUR", + "GBP", + "USD" + ], + "linkable_to_different_currency": 1, + "linkable_wallet_types": [ + "doughflow", + "p2p", + "paymentagent_client" + ] + }, + "standard": { + "allowed_wallet_currencies": [ + "AUD", + "BTC", + "ETH", + "EUR", + "GBP", + "LTC", + "USD", + "USDC", + "UST", + "eUSDT", + "tUSDT" + ], + "linkable_to_different_currency": 0, + "linkable_wallet_types": [ + "doughflow", + "crypto", + "p2p", + "paymentagent_client" + ] + } + }, + "wallet": { + "crypto": { + "currencies": [ + "BTC", + "ETH", + "LTC", + "USDC", + "UST", + "eUSDT", + "tUSDT" + ] + }, + "doughflow": { + "currencies": [ + "AUD", + "EUR", + "GBP", + "USD" + ] + }, + "p2p": { + "currencies": [ + "USD" + ] + }, + "paymentagent": { + "currencies": [ + "AUD", + "BTC", + "ETH", + "EUR", + "GBP", + "LTC", + "USD", + "USDC", + "UST", + "eUSDT", + "tUSDT" + ] + }, + "paymentagent_client": { + "currencies": [ + "AUD", + "BTC", + "ETH", + "EUR", + "GBP", + "LTC", + "USD", + "USDC", + "UST", + "eUSDT", + "tUSDT" + ] + } + } + }, + "msg_type": "get_account_types" +}'''; diff --git a/lib/services/connection/api_manager/mock_data/account/new_account_wallet_response.dart b/lib/services/connection/api_manager/mock_data/account/new_account_wallet_response.dart new file mode 100644 index 0000000000..7d428009ca --- /dev/null +++ b/lib/services/connection/api_manager/mock_data/account/new_account_wallet_response.dart @@ -0,0 +1,16 @@ +/// New account wallet response mock data. +const String newAccountWalletResponse = '''{ + "echo_req": { + "account_type": "crypto", + "currency": "BTC", + "new_account_wallet": 1 + }, + "msg_type": "new_account_wallet", + "new_account_wallet": { + "client_id": "CRW1170", + "currency": "BTC", + "landing_company": "Deriv (SVG) LLC", + "landing_company_shortcode": "svg", + "oauth_token": "DYsMOCKRAqaX23DvpZfmUW" + } +}'''; diff --git a/lib/services/connection/api_manager/mock_data/cashier/cashier_payments_response.dart b/lib/services/connection/api_manager/mock_data/cashier/cashier_payments_response.dart new file mode 100644 index 0000000000..f47489ccce --- /dev/null +++ b/lib/services/connection/api_manager/mock_data/cashier/cashier_payments_response.dart @@ -0,0 +1,27 @@ +import 'package:flutter_deriv_api/api/response/cashier_payments_response_result.dart'; + +/// The mock data for [CashierPaymentsResponse]. +const String cashierPaymentsResponse = ''' +{ + "cashier_payments": { + "crypto": [ + { + "address_hash": "addressHash", + "address_url": "addressUrl", + "id": "id", + "status_code": "CANCELLED", + "status_message": "statusMessage", + "transaction_type": "deposit", + "amount": 1, + "confirmations": 1, + "is_valid_to_cancel": true, + "submit_date": 1695118224, + "transaction_hash": "transactionHash", + "transaction_url": "transactionUrl" + } + ] + }, + "msg_type": "cashier_payments", + "req_id": 681 +} +'''; diff --git a/lib/services/connection/api_manager/mock_data/common/website_status_response.dart b/lib/services/connection/api_manager/mock_data/common/website_status_response.dart index 77ab3b219e..0bc9d3229f 100644 --- a/lib/services/connection/api_manager/mock_data/common/website_status_response.dart +++ b/lib/services/connection/api_manager/mock_data/common/website_status_response.dart @@ -653,6 +653,11 @@ const String websiteStatusResponse = '''{ "cancellation_count_period": 24, "cancellation_grace_period": 15, "cancellation_limit": 3, + "cross_border_ads_enabled": 1, + "block_trade": { + "disabled": false, + "maximum_advert_amount": 3000 + }, "maximum_advert_amount": 3000, "maximum_order_amount": 1000, "order_daily_limit": 200, diff --git a/lib/services/connection/api_manager/mock_data/wallet_migration_response.dart b/lib/services/connection/api_manager/mock_data/wallet_migration_response.dart new file mode 100644 index 0000000000..00ed61c8c6 --- /dev/null +++ b/lib/services/connection/api_manager/mock_data/wallet_migration_response.dart @@ -0,0 +1,42 @@ +/// Wallet migration response mock data. +const String walletMigrationResponse = '''{ + "echo_req": { + "wallet_migration": "state" + }, + "msg_type": "wallet_migration", + "wallet_migration": { + "account_list": [ + { + "account_category": "wallet", + "account_type": "virtual", + "currency": "USD", + "landing_company_short": "virtual", + "link_accounts": [ + { + "account_category": "trading", + "account_type": "standard", + "loginid": "VRTC90000164", + "platform": "dtrade" + } + ], + "platform": "dwallet" + }, + { + "account_category": "wallet", + "account_type": "doughflow", + "currency": "USD", + "landing_company_short": "svg", + "link_accounts": [ + { + "account_category": "trading", + "account_type": "standard", + "loginid": "CR90000255", + "platform": "dtrade" + } + ], + "platform": "dwallet" + } + ], + "state": "eligible" + } +}'''; diff --git a/test/api/account/get_account_types/get_account_types_test.dart b/test/api/account/get_account_types/get_account_types_test.dart new file mode 100644 index 0000000000..935494e26c --- /dev/null +++ b/test/api/account/get_account_types/get_account_types_test.dart @@ -0,0 +1,75 @@ +import 'package:flutter_deriv_api/api/api_initializer.dart'; +import 'package:flutter_deriv_api/api/response/get_account_types_response_extended.dart'; +import 'package:flutter_deriv_api/api/response/get_account_types_response_result.dart'; +import 'package:flutter_deriv_api/basic_api/generated/api.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/mock_api.dart'; +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + setUp(() => APIInitializer().initialize(api: MockAPI())); + + tearDown(() => Injector().dispose()); + + test('Get account types API call returns the expected result.', () async { + final GetAccountTypesResponse accountTypesResponse = + await GetAccountTypesResponseExtended.fetchAccountTypes( + request: const GetAccountTypesRequest(), + ); + + expect(accountTypesResponse.getAccountTypes?.trading.length, 5); + expect(accountTypesResponse.getAccountTypes?.wallet.length, 5); + expect(accountTypesResponse.getAccountTypes?.trading['binary'], + isA()); + expect( + accountTypesResponse + .getAccountTypes?.trading['binary']?.linkableWalletTypes.length, + 4, + ); + expect( + accountTypesResponse + .getAccountTypes?.trading['binary']?.linkableWalletTypes.first, + 'doughflow', + ); + expect( + accountTypesResponse + .getAccountTypes?.trading['binary']?.allowedWalletCurrencies.length, + 11, + ); + expect( + accountTypesResponse + .getAccountTypes?.trading['binary']?.allowedWalletCurrencies.first, + 'AUD', + ); + expect( + accountTypesResponse + .getAccountTypes?.trading['derivez']?.linkableWalletTypes.length, + 3, + ); + expect( + accountTypesResponse + .getAccountTypes?.trading['derivez']?.linkableWalletTypes.first, + 'doughflow', + ); + expect( + accountTypesResponse.getAccountTypes?.trading['standard'], + isA(), + ); + expect( + accountTypesResponse.getAccountTypes?.wallet['crypto']?.currencies.length, + 7, + ); + expect( + accountTypesResponse.getAccountTypes?.wallet['crypto']?.currencies.first, + 'BTC', + ); + expect( + accountTypesResponse.getAccountTypes?.wallet['crypto']?.currencies.last, + 'tUSDT', + ); + expect( + accountTypesResponse.getAccountTypes?.wallet['doughflow'], + isA(), + ); + }); +} diff --git a/test/api/account/new_account_wallet/new_account_wallet_test.dart b/test/api/account/new_account_wallet/new_account_wallet_test.dart new file mode 100644 index 0000000000..e3a990eea8 --- /dev/null +++ b/test/api/account/new_account_wallet/new_account_wallet_test.dart @@ -0,0 +1,31 @@ +import 'package:flutter_deriv_api/api/api_initializer.dart'; +import 'package:flutter_deriv_api/api/response/new_account_wallet_response_extended.dart'; +import 'package:flutter_deriv_api/api/response/new_account_wallet_response_result.dart'; +import 'package:flutter_deriv_api/basic_api/generated/api.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/mock_api.dart'; +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + setUp(() => APIInitializer().initialize(api: MockAPI())); + + tearDown(() => Injector().dispose()); + + test('New account wallet API call returns the expected result.', () async { + final NewAccountWalletResponse newAccountWallet = + await NewAccountWalletResponseExtended.createNewWalletAccount( + request: const NewAccountWalletRequest( + accountType: 'crypto', + currency: 'BTC', + ), + ); + + expect(newAccountWallet.newAccountWallet?.clientId, 'CRW1170'); + expect(newAccountWallet.newAccountWallet?.currency, 'BTC'); + expect(newAccountWallet.newAccountWallet?.clientId, 'CRW1170'); + expect( + newAccountWallet.newAccountWallet?.oauthToken, + 'DYsMOCKRAqaX23DvpZfmUW', + ); + }); +} diff --git a/test/api/account/wallet_migration/wallet_migration_test.dart b/test/api/account/wallet_migration/wallet_migration_test.dart new file mode 100644 index 0000000000..cd8448a4ad --- /dev/null +++ b/test/api/account/wallet_migration/wallet_migration_test.dart @@ -0,0 +1,63 @@ +import 'package:flutter_deriv_api/api/api_initializer.dart'; +import 'package:flutter_deriv_api/api/response/wallet_migration_response_extended.dart'; +import 'package:flutter_deriv_api/api/response/wallet_migration_response_result.dart'; +import 'package:flutter_deriv_api/basic_api/generated/wallet_migration_send.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/mock_api.dart'; +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + group('Wallet migration', () { + setUpAll(() => APIInitializer().initialize(api: MockAPI())); + + tearDownAll(() => Injector().dispose()); + + test( + 'fetchWalletMigration method returns the expected result.', + () async { + final WalletMigrationResponse response = + await WalletMigrationResponseExtended.fetchWalletMigration( + request: const WalletMigrationRequest(walletMigration: 'state'), + ); + + expect(response.walletMigration?.state, StateEnum.eligible); + expect(response.walletMigration?.accountList?.length, 2); + + final AccountListItem? firstAccount = + response.walletMigration?.accountList?.first; + + expect(firstAccount?.currency, 'USD'); + expect(firstAccount?.platform, AccountListItemPlatformEnum.dwallet); + expect( + firstAccount?.accountCategory, + AccountCategoryEnum.wallet, + ); + expect(firstAccount?.accountType, 'virtual'); + expect(firstAccount?.linkAccounts.length, 1); + }, + ); + + test( + 'checkStatus method returns the expected result.', + () async { + final WalletMigrationResponse response = + await WalletMigrationResponseExtended.checkStatus(); + + expect(response.walletMigration?.state, StateEnum.eligible); + expect(response.walletMigration?.accountList?.length, 2); + + final AccountListItem? firstAccount = + response.walletMigration?.accountList?.first; + + expect(firstAccount?.currency, 'USD'); + expect(firstAccount?.platform, AccountListItemPlatformEnum.dwallet); + expect( + firstAccount?.accountCategory, + AccountCategoryEnum.wallet, + ); + expect(firstAccount?.accountType, 'virtual'); + expect(firstAccount?.linkAccounts.length, 1); + }, + ); + }); +} diff --git a/test/api/cashier/cashier_payments_test.dart b/test/api/cashier/cashier_payments_test.dart new file mode 100644 index 0000000000..28e805c3ec --- /dev/null +++ b/test/api/cashier/cashier_payments_test.dart @@ -0,0 +1,30 @@ +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_deriv_api/api/api_initializer.dart'; +import 'package:flutter_deriv_api/api/response/cashier_payments_response_extended.dart'; +import 'package:flutter_deriv_api/api/response/cashier_payments_response_result.dart'; +import 'package:flutter_deriv_api/basic_api/generated/cashier_payments_send.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/mock_api.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + setUp(() => APIInitializer().initialize(api: MockAPI())); + + tearDown(() => Injector().dispose()); + + test('Fetch Cashier Payments Test', () async { + final CashierPaymentsResponse response = + await CashierPaymentsResponseExtended.fetchCashierPayments( + request: const CashierPaymentsRequest(), + ); + + expect(response.cashierPayments?.crypto?.length, 1); + expect(response.cashierPayments?.crypto?.first.id, 'id'); + expect(response.cashierPayments?.crypto?.first.statusCode, + StatusCodeEnum.cancelled); + expect( + response + .cashierPayments?.crypto?.first.submitDate?.millisecondsSinceEpoch, + 1695118224000, + ); + }); +} diff --git a/test/api/common/asset_index/asset_index_test.dart b/test/api/common/asset_index/asset_index_test.dart index 05a4bdfa32..013d2fc7ff 100644 --- a/test/api/common/asset_index/asset_index_test.dart +++ b/test/api/common/asset_index/asset_index_test.dart @@ -12,7 +12,8 @@ void main() { test('Fetch Asset Index Test', () async { final AssetIndexResponse assetIndices = - await AssetIndexResponse.fetchAssetIndices(const AssetIndexRequest()); + await AssetIndexResponse.fetchAssetIndices( + const AssetIndexRequest(landingCompany: 'svg')); expect(assetIndices.assetIndex?.length, 1); // expect(assetIndices.assetIndex.first['symbol_code'], 'frxAUDJPY'); diff --git a/test/api/common/trading/trading_duration_test.dart b/test/api/common/trading/trading_duration_test.dart index ede7e756b0..388c6af57e 100644 --- a/test/api/common/trading/trading_duration_test.dart +++ b/test/api/common/trading/trading_duration_test.dart @@ -13,7 +13,7 @@ void main() { test('Fetch Trading Duration Test', () async { final TradingDurationsResponse tradeDuration = await TradingDurationsResponse.fetchTradingDurations( - const TradingDurationsRequest(), + const TradingDurationsRequest(landingCompany: 'svg'), ); expect(tradeDuration.tradingDurations?.length, 8); diff --git a/test/api/mt5/mt5_account_test.dart b/test/api/mt5/mt5_account_test.dart index ef8d57c8ad..ceaeb5a242 100644 --- a/test/api/mt5/mt5_account_test.dart +++ b/test/api/mt5/mt5_account_test.dart @@ -131,7 +131,7 @@ void main() { ).fetchSettings(); expect(mt5Settings.mt5GetSettings?.address, 'sample address'); - expect(mt5Settings.mt5GetSettings?.balance, '250.0'); + expect(mt5Settings.mt5GetSettings?.balance, 250.0); expect(mt5Settings.mt5GetSettings?.city, 'London'); expect(mt5Settings.mt5GetSettings?.company, 'sample company'); expect(mt5Settings.mt5GetSettings?.country, 'England'); From 7e829efa7049301ca13a6f93f4dae3f3d9fddc2e Mon Sep 17 00:00:00 2001 From: Weng Lok <103249398+weng-deriv@users.noreply.github.com> Date: Wed, 11 Oct 2023 14:45:19 +0800 Subject: [PATCH 14/64] weng/updated_p2p_order_list_api_request (#282) - updated p2p order list api request. --- .../generated/p2p_order_list_send.dart | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/lib/basic_api/generated/p2p_order_list_send.dart b/lib/basic_api/generated/p2p_order_list_send.dart index 8dee4a71b1..b340480493 100644 --- a/lib/basic_api/generated/p2p_order_list_send.dart +++ b/lib/basic_api/generated/p2p_order_list_send.dart @@ -10,23 +10,24 @@ class P2pOrderListRequest extends Request { const P2pOrderListRequest({ this.active, this.advertId, + this.dateFrom, + this.dateTo, this.limit, this.offset, this.p2pOrderList = true, this.subscribe, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_order_list', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_order_list', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pOrderListRequest.fromJson(Map json) => P2pOrderListRequest( active: json['active'] as num?, advertId: json['advert_id'] as String?, + dateFrom: json['date_from'] as String?, + dateTo: json['date_to'] as String?, limit: json['limit'] as int?, offset: json['offset'] as int?, p2pOrderList: @@ -42,6 +43,12 @@ class P2pOrderListRequest extends Request { /// [Optional] If present, lists orders applying to a specific advert. final String? advertId; + /// [Optional] Filter the orders created after this date(included) format(epoch or YYYY-MM-DD) + final String? dateFrom; + + /// [Optional] Filter the orders created before this date(included) format(epoch or YYYY-MM-DD) + final String? dateTo; + /// [Optional] Used for paging. final int? limit; @@ -59,6 +66,8 @@ class P2pOrderListRequest extends Request { Map toJson() => { 'active': active, 'advert_id': advertId, + 'date_from': dateFrom, + 'date_to': dateTo, 'limit': limit, 'offset': offset, 'p2p_order_list': p2pOrderList == null @@ -80,6 +89,8 @@ class P2pOrderListRequest extends Request { P2pOrderListRequest copyWith({ num? active, String? advertId, + String? dateFrom, + String? dateTo, int? limit, int? offset, bool? p2pOrderList, @@ -90,6 +101,8 @@ class P2pOrderListRequest extends Request { P2pOrderListRequest( active: active ?? this.active, advertId: advertId ?? this.advertId, + dateFrom: dateFrom ?? this.dateFrom, + dateTo: dateTo ?? this.dateTo, limit: limit ?? this.limit, offset: offset ?? this.offset, p2pOrderList: p2pOrderList ?? this.p2pOrderList, From 13ce0047d0a3418dab209171a5f79e52ed30be70 Mon Sep 17 00:00:00 2001 From: WAQAS YOUNAS Date: Tue, 14 Nov 2023 13:40:24 +0800 Subject: [PATCH 15/64] waqas/add_language_support_to_deriv_api --- lib/state/connection/connection_cubit.dart | 9 ++++++--- lib/state/connection/connection_state.dart | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/state/connection/connection_cubit.dart b/lib/state/connection/connection_cubit.dart index c2f401161e..cc8b8d9949 100644 --- a/lib/state/connection/connection_cubit.dart +++ b/lib/state/connection/connection_cubit.dart @@ -73,12 +73,15 @@ class ConnectionCubit extends Cubit { /// Gets app id of websocket. static String get appId => _connectionInformation.appId; - /// Streamsubscription for connectivity. + /// Stream subscription for connectivity. StreamSubscription? connectivitySubscription; /// Reconnect to Websocket. - Future reconnect({ConnectionInformation? connectionInformation}) async { - emit(const ConnectionDisconnectedState()); + Future reconnect({ + ConnectionInformation? connectionInformation, + bool isChangingLanguage = false, + }) async { + emit(ConnectionDisconnectedState(isChangingLanguage: isChangingLanguage)); if (connectionInformation != null) { _connectionInformation = connectionInformation; diff --git a/lib/state/connection/connection_state.dart b/lib/state/connection/connection_state.dart index 2ca83457c6..6ae26e40a5 100644 --- a/lib/state/connection/connection_state.dart +++ b/lib/state/connection/connection_state.dart @@ -33,7 +33,10 @@ class ConnectionConnectedState extends ConnectionState { /// Connection disconnected state. class ConnectionDisconnectedState extends ConnectionState { /// Initializes [ConnectionDisconnectedState]. - const ConnectionDisconnectedState(); + const ConnectionDisconnectedState({this.isChangingLanguage = false}); + + /// Is the App language changing during connection change + final bool isChangingLanguage; } /// Connection error state. From b4db925d96226b6b78972502810385f6d5eaa1fb Mon Sep 17 00:00:00 2001 From: balakrishna-deriv <56330681+balakrishna-deriv@users.noreply.github.com> Date: Thu, 23 Nov 2023 13:37:05 +0800 Subject: [PATCH 16/64] chore: fix dependency injector branch (#289) --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 9612ac8ed5..be7316d9fb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: git: url: git@github.com:regentmarkets/flutter-deriv-packages.git path: packages/deriv_dependency_injector - ref: flutter-version-3 + ref: dev build: ^2.3.1 dart_style: ^2.3.0 From 29145654c2a96d0ca068002fe5421cd5d77c5231 Mon Sep 17 00:00:00 2001 From: ramin-deriv <55975218+ramin-deriv@users.noreply.github.com> Date: Wed, 6 Dec 2023 10:14:11 +0800 Subject: [PATCH 17/64] Ramin/update_for_accumulators (#288) --- example/lib/sample_app.dart | 1 + ...roposal_open_contract_response_result.dart | 439 ++++++++---------- .../response/proposal_response_result.dart | 209 ++++----- .../methods/proposal_receive_methods.json | 2 +- .../proposal_open_contract_receive.dart | 15 +- .../proposal_open_contract_send.dart | 19 +- lib/basic_api/generated/proposal_receive.dart | 15 +- lib/basic_api/generated/proposal_send.dart | 19 +- 8 files changed, 310 insertions(+), 409 deletions(-) diff --git a/example/lib/sample_app.dart b/example/lib/sample_app.dart index 19286bf8e3..a3799bfe71 100644 --- a/example/lib/sample_app.dart +++ b/example/lib/sample_app.dart @@ -24,6 +24,7 @@ class _SampleAppState extends State { appId: '1089', brand: 'binary', endpoint: 'frontend.binaryws.com', + authEndpoint: '', ), ); } diff --git a/lib/api/response/proposal_open_contract_response_result.dart b/lib/api/response/proposal_open_contract_response_result.dart index c233b7dec7..35823a6354 100644 --- a/lib/api/response/proposal_open_contract_response_result.dart +++ b/lib/api/response/proposal_open_contract_response_result.dart @@ -20,7 +20,6 @@ import 'package:flutter_deriv_api/helpers/helpers.dart'; import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; import 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart'; import 'package:deriv_dependency_injector/dependency_injector.dart'; - /// Proposal open contract response model class. abstract class ProposalOpenContractResponseModel { /// Initializes Proposal open contract response model class . @@ -40,12 +39,9 @@ abstract class ProposalOpenContractResponseModel { class ProposalOpenContractResponse extends ProposalOpenContractResponseModel { /// Initializes Proposal open contract response class. const ProposalOpenContractResponse({ - ProposalOpenContract? proposalOpenContract, - Subscription? subscription, - }) : super( - proposalOpenContract: proposalOpenContract, - subscription: subscription, - ); + super.proposalOpenContract, + super.subscription, + }); /// Creates an instance from JSON. factory ProposalOpenContractResponse.fromJson( @@ -216,7 +212,6 @@ enum StatusEnum { /// null. _null, } - /// Proposal open contract model class. abstract class ProposalOpenContractModel { /// Initializes Proposal open contract model class . @@ -225,6 +220,7 @@ abstract class ProposalOpenContractModel { this.auditDetails, this.barrier, this.barrierCount, + this.barrierSpotDistance, this.bidPrice, this.buyPrice, this.cancellation, @@ -235,11 +231,14 @@ abstract class ProposalOpenContractModel { this.currency, this.currentSpot, this.currentSpotDisplayValue, + this.currentSpotHighBarrier, + this.currentSpotLowBarrier, this.currentSpotTime, this.dateExpiry, this.dateSettlement, this.dateStart, this.displayName, + this.displayNumberOfContracts, this.displayValue, this.entrySpot, this.entrySpotDisplayValue, @@ -265,10 +264,12 @@ abstract class ProposalOpenContractModel { this.longcode, this.lowBarrier, this.multiplier, + this.numberOfContracts, this.payout, this.profit, this.profitPercentage, this.purchaseTime, + this.resetBarrier, this.resetTime, this.sellPrice, this.sellSpot, @@ -283,6 +284,7 @@ abstract class ProposalOpenContractModel { this.transactionIds, this.underlying, this.validationError, + this.validationErrorCode, }); /// Account Id @@ -297,6 +299,9 @@ abstract class ProposalOpenContractModel { /// The number of barriers a contract has. final double? barrierCount; + /// [Only for accumulator] Absolute difference between high/low barrier and spot + final String? barrierSpotDistance; + /// Price at which the contract could be sold back to the company. final double? bidPrice; @@ -327,6 +332,12 @@ abstract class ProposalOpenContractModel { /// Spot value with the correct precision if we have license to stream this symbol. final String? currentSpotDisplayValue; + /// [Applicable for accumulator] High barrier based on current spot. + final String? currentSpotHighBarrier; + + /// [Applicable for accumulator] Low barrier based on current spot. + final String? currentSpotLowBarrier; + /// The corresponding time of the current spot. final DateTime? currentSpotTime; @@ -342,6 +353,9 @@ abstract class ProposalOpenContractModel { /// Display name of underlying final String? displayName; + /// [Only for vanilla or turbos options] The implied number of contracts + final String? displayNumberOfContracts; + /// The `bid_price` with the correct precision final String? displayValue; @@ -417,6 +431,9 @@ abstract class ProposalOpenContractModel { /// [Only for lookback trades] Multiplier applies when calculating the final payoff for each type of lookback. e.g. (Exit spot - Lowest historical price) * multiplier = Payout final double? multiplier; + /// [Only for vanilla or turbos options] The implied number of contracts + final double? numberOfContracts; + /// Payout value of the contract. final double? payout; @@ -429,7 +446,10 @@ abstract class ProposalOpenContractModel { /// Epoch of purchase time, will be same as `date_start` for all contracts except forward starting contracts. final DateTime? purchaseTime; - /// [Only for reset trades] The epoch time of a barrier reset. + /// [Only for reset trades i.e. RESETCALL and RESETPUT] Reset barrier of the contract. + final String? resetBarrier; + + /// [Only for reset trades i.e. RESETCALL and RESETPUT] The epoch time of a barrier reset. final DateTime? resetTime; /// Price at which contract was sold, only available when contract has been sold. @@ -470,138 +490,85 @@ abstract class ProposalOpenContractModel { /// Error message if validation fails final String? validationError; + + /// Error code if validation fails + final String? validationErrorCode; } /// Proposal open contract class. class ProposalOpenContract extends ProposalOpenContractModel { /// Initializes Proposal open contract class. const ProposalOpenContract({ - double? accountId, - AuditDetails? auditDetails, - String? barrier, - double? barrierCount, - double? bidPrice, - double? buyPrice, - Cancellation? cancellation, - double? commision, - double? commission, - int? contractId, - String? contractType, - String? currency, - double? currentSpot, - String? currentSpotDisplayValue, - DateTime? currentSpotTime, - DateTime? dateExpiry, - DateTime? dateSettlement, - DateTime? dateStart, - String? displayName, - String? displayValue, - double? entrySpot, - String? entrySpotDisplayValue, - double? entryTick, - String? entryTickDisplayValue, - DateTime? entryTickTime, - double? exitTick, - String? exitTickDisplayValue, - DateTime? exitTickTime, - DateTime? expiryTime, - double? growthRate, - String? highBarrier, - String? id, - bool? isExpired, - bool? isForwardStarting, - bool? isIntraday, - bool? isPathDependent, - bool? isSettleable, - bool? isSold, - bool? isValidToCancel, - bool? isValidToSell, - LimitOrder? limitOrder, - String? longcode, - String? lowBarrier, - double? multiplier, - double? payout, - double? profit, - double? profitPercentage, - DateTime? purchaseTime, - DateTime? resetTime, - double? sellPrice, - double? sellSpot, - String? sellSpotDisplayValue, - DateTime? sellSpotTime, - DateTime? sellTime, - String? shortcode, - StatusEnum? status, - int? tickCount, - int? tickPassed, - List? tickStream, - TransactionIds? transactionIds, - String? underlying, - String? validationError, - }) : super( - accountId: accountId, - auditDetails: auditDetails, - barrier: barrier, - barrierCount: barrierCount, - bidPrice: bidPrice, - buyPrice: buyPrice, - cancellation: cancellation, - commision: commision, - commission: commission, - contractId: contractId, - contractType: contractType, - currency: currency, - currentSpot: currentSpot, - currentSpotDisplayValue: currentSpotDisplayValue, - currentSpotTime: currentSpotTime, - dateExpiry: dateExpiry, - dateSettlement: dateSettlement, - dateStart: dateStart, - displayName: displayName, - displayValue: displayValue, - entrySpot: entrySpot, - entrySpotDisplayValue: entrySpotDisplayValue, - entryTick: entryTick, - entryTickDisplayValue: entryTickDisplayValue, - entryTickTime: entryTickTime, - exitTick: exitTick, - exitTickDisplayValue: exitTickDisplayValue, - exitTickTime: exitTickTime, - expiryTime: expiryTime, - growthRate: growthRate, - highBarrier: highBarrier, - id: id, - isExpired: isExpired, - isForwardStarting: isForwardStarting, - isIntraday: isIntraday, - isPathDependent: isPathDependent, - isSettleable: isSettleable, - isSold: isSold, - isValidToCancel: isValidToCancel, - isValidToSell: isValidToSell, - limitOrder: limitOrder, - longcode: longcode, - lowBarrier: lowBarrier, - multiplier: multiplier, - payout: payout, - profit: profit, - profitPercentage: profitPercentage, - purchaseTime: purchaseTime, - resetTime: resetTime, - sellPrice: sellPrice, - sellSpot: sellSpot, - sellSpotDisplayValue: sellSpotDisplayValue, - sellSpotTime: sellSpotTime, - sellTime: sellTime, - shortcode: shortcode, - status: status, - tickCount: tickCount, - tickPassed: tickPassed, - tickStream: tickStream, - transactionIds: transactionIds, - underlying: underlying, - validationError: validationError, - ); + super.accountId, + super.auditDetails, + super.barrier, + super.barrierCount, + super.barrierSpotDistance, + super.bidPrice, + super.buyPrice, + super.cancellation, + super.commision, + super.commission, + super.contractId, + super.contractType, + super.currency, + super.currentSpot, + super.currentSpotDisplayValue, + super.currentSpotHighBarrier, + super.currentSpotLowBarrier, + super.currentSpotTime, + super.dateExpiry, + super.dateSettlement, + super.dateStart, + super.displayName, + super.displayNumberOfContracts, + super.displayValue, + super.entrySpot, + super.entrySpotDisplayValue, + super.entryTick, + super.entryTickDisplayValue, + super.entryTickTime, + super.exitTick, + super.exitTickDisplayValue, + super.exitTickTime, + super.expiryTime, + super.growthRate, + super.highBarrier, + super.id, + super.isExpired, + super.isForwardStarting, + super.isIntraday, + super.isPathDependent, + super.isSettleable, + super.isSold, + super.isValidToCancel, + super.isValidToSell, + super.limitOrder, + super.longcode, + super.lowBarrier, + super.multiplier, + super.numberOfContracts, + super.payout, + super.profit, + super.profitPercentage, + super.purchaseTime, + super.resetBarrier, + super.resetTime, + super.sellPrice, + super.sellSpot, + super.sellSpotDisplayValue, + super.sellSpotTime, + super.sellTime, + super.shortcode, + super.status, + super.tickCount, + super.tickPassed, + super.tickStream, + super.transactionIds, + super.underlying, + super.validationError, + super.validationErrorCode, + }); /// Creates an instance from JSON. factory ProposalOpenContract.fromJson(Map json) => @@ -612,6 +579,7 @@ class ProposalOpenContract extends ProposalOpenContractModel { : AuditDetails.fromJson(json['audit_details']), barrier: json['barrier'], barrierCount: getDouble(json['barrier_count']), + barrierSpotDistance: json['barrier_spot_distance'], bidPrice: getDouble(json['bid_price']), buyPrice: getDouble(json['buy_price']), cancellation: json['cancellation'] == null @@ -624,11 +592,14 @@ class ProposalOpenContract extends ProposalOpenContractModel { currency: json['currency'], currentSpot: getDouble(json['current_spot']), currentSpotDisplayValue: json['current_spot_display_value'], + currentSpotHighBarrier: json['current_spot_high_barrier'], + currentSpotLowBarrier: json['current_spot_low_barrier'], currentSpotTime: getDateTime(json['current_spot_time']), dateExpiry: getDateTime(json['date_expiry']), dateSettlement: getDateTime(json['date_settlement']), dateStart: getDateTime(json['date_start']), displayName: json['display_name'], + displayNumberOfContracts: json['display_number_of_contracts'], displayValue: json['display_value'], entrySpot: getDouble(json['entry_spot']), entrySpotDisplayValue: json['entry_spot_display_value'], @@ -656,10 +627,12 @@ class ProposalOpenContract extends ProposalOpenContractModel { longcode: json['longcode'], lowBarrier: json['low_barrier'], multiplier: getDouble(json['multiplier']), + numberOfContracts: getDouble(json['number_of_contracts']), payout: getDouble(json['payout']), profit: getDouble(json['profit']), profitPercentage: getDouble(json['profit_percentage']), purchaseTime: getDateTime(json['purchase_time']), + resetBarrier: json['reset_barrier'], resetTime: getDateTime(json['reset_time']), sellPrice: getDouble(json['sell_price']), sellSpot: getDouble(json['sell_spot']), @@ -683,6 +656,7 @@ class ProposalOpenContract extends ProposalOpenContractModel { : TransactionIds.fromJson(json['transaction_ids']), underlying: json['underlying'], validationError: json['validation_error'], + validationErrorCode: json['validation_error_code'], ); /// Converts an instance to JSON. @@ -695,6 +669,7 @@ class ProposalOpenContract extends ProposalOpenContractModel { } resultMap['barrier'] = barrier; resultMap['barrier_count'] = barrierCount; + resultMap['barrier_spot_distance'] = barrierSpotDistance; resultMap['bid_price'] = bidPrice; resultMap['buy_price'] = buyPrice; if (cancellation != null) { @@ -707,12 +682,15 @@ class ProposalOpenContract extends ProposalOpenContractModel { resultMap['currency'] = currency; resultMap['current_spot'] = currentSpot; resultMap['current_spot_display_value'] = currentSpotDisplayValue; + resultMap['current_spot_high_barrier'] = currentSpotHighBarrier; + resultMap['current_spot_low_barrier'] = currentSpotLowBarrier; resultMap['current_spot_time'] = getSecondsSinceEpochDateTime(currentSpotTime); resultMap['date_expiry'] = getSecondsSinceEpochDateTime(dateExpiry); resultMap['date_settlement'] = getSecondsSinceEpochDateTime(dateSettlement); resultMap['date_start'] = getSecondsSinceEpochDateTime(dateStart); resultMap['display_name'] = displayName; + resultMap['display_number_of_contracts'] = displayNumberOfContracts; resultMap['display_value'] = displayValue; resultMap['entry_spot'] = entrySpot; resultMap['entry_spot_display_value'] = entrySpotDisplayValue; @@ -740,10 +718,12 @@ class ProposalOpenContract extends ProposalOpenContractModel { resultMap['longcode'] = longcode; resultMap['low_barrier'] = lowBarrier; resultMap['multiplier'] = multiplier; + resultMap['number_of_contracts'] = numberOfContracts; resultMap['payout'] = payout; resultMap['profit'] = profit; resultMap['profit_percentage'] = profitPercentage; resultMap['purchase_time'] = getSecondsSinceEpochDateTime(purchaseTime); + resultMap['reset_barrier'] = resetBarrier; resultMap['reset_time'] = getSecondsSinceEpochDateTime(resetTime); resultMap['sell_price'] = sellPrice; resultMap['sell_spot'] = sellSpot; @@ -769,6 +749,7 @@ class ProposalOpenContract extends ProposalOpenContractModel { } resultMap['underlying'] = underlying; resultMap['validation_error'] = validationError; + resultMap['validation_error_code'] = validationErrorCode; return resultMap; } @@ -779,6 +760,7 @@ class ProposalOpenContract extends ProposalOpenContractModel { AuditDetails? auditDetails, String? barrier, double? barrierCount, + String? barrierSpotDistance, double? bidPrice, double? buyPrice, Cancellation? cancellation, @@ -789,11 +771,14 @@ class ProposalOpenContract extends ProposalOpenContractModel { String? currency, double? currentSpot, String? currentSpotDisplayValue, + String? currentSpotHighBarrier, + String? currentSpotLowBarrier, DateTime? currentSpotTime, DateTime? dateExpiry, DateTime? dateSettlement, DateTime? dateStart, String? displayName, + String? displayNumberOfContracts, String? displayValue, double? entrySpot, String? entrySpotDisplayValue, @@ -819,10 +804,12 @@ class ProposalOpenContract extends ProposalOpenContractModel { String? longcode, String? lowBarrier, double? multiplier, + double? numberOfContracts, double? payout, double? profit, double? profitPercentage, DateTime? purchaseTime, + String? resetBarrier, DateTime? resetTime, double? sellPrice, double? sellSpot, @@ -837,12 +824,14 @@ class ProposalOpenContract extends ProposalOpenContractModel { TransactionIds? transactionIds, String? underlying, String? validationError, + String? validationErrorCode, }) => ProposalOpenContract( accountId: accountId ?? this.accountId, auditDetails: auditDetails ?? this.auditDetails, barrier: barrier ?? this.barrier, barrierCount: barrierCount ?? this.barrierCount, + barrierSpotDistance: barrierSpotDistance ?? this.barrierSpotDistance, bidPrice: bidPrice ?? this.bidPrice, buyPrice: buyPrice ?? this.buyPrice, cancellation: cancellation ?? this.cancellation, @@ -854,11 +843,17 @@ class ProposalOpenContract extends ProposalOpenContractModel { currentSpot: currentSpot ?? this.currentSpot, currentSpotDisplayValue: currentSpotDisplayValue ?? this.currentSpotDisplayValue, + currentSpotHighBarrier: + currentSpotHighBarrier ?? this.currentSpotHighBarrier, + currentSpotLowBarrier: + currentSpotLowBarrier ?? this.currentSpotLowBarrier, currentSpotTime: currentSpotTime ?? this.currentSpotTime, dateExpiry: dateExpiry ?? this.dateExpiry, dateSettlement: dateSettlement ?? this.dateSettlement, dateStart: dateStart ?? this.dateStart, displayName: displayName ?? this.displayName, + displayNumberOfContracts: + displayNumberOfContracts ?? this.displayNumberOfContracts, displayValue: displayValue ?? this.displayValue, entrySpot: entrySpot ?? this.entrySpot, entrySpotDisplayValue: @@ -886,10 +881,12 @@ class ProposalOpenContract extends ProposalOpenContractModel { longcode: longcode ?? this.longcode, lowBarrier: lowBarrier ?? this.lowBarrier, multiplier: multiplier ?? this.multiplier, + numberOfContracts: numberOfContracts ?? this.numberOfContracts, payout: payout ?? this.payout, profit: profit ?? this.profit, profitPercentage: profitPercentage ?? this.profitPercentage, purchaseTime: purchaseTime ?? this.purchaseTime, + resetBarrier: resetBarrier ?? this.resetBarrier, resetTime: resetTime ?? this.resetTime, sellPrice: sellPrice ?? this.sellPrice, sellSpot: sellSpot ?? this.sellSpot, @@ -904,9 +901,9 @@ class ProposalOpenContract extends ProposalOpenContractModel { transactionIds: transactionIds ?? this.transactionIds, underlying: underlying ?? this.underlying, validationError: validationError ?? this.validationError, + validationErrorCode: validationErrorCode ?? this.validationErrorCode, ); } - /// Audit details model class. abstract class AuditDetailsModel { /// Initializes Audit details model class . @@ -930,14 +927,10 @@ abstract class AuditDetailsModel { class AuditDetails extends AuditDetailsModel { /// Initializes Audit details class. const AuditDetails({ - List? allTicks, - List? contractEnd, - List? contractStart, - }) : super( - allTicks: allTicks, - contractEnd: contractEnd, - contractStart: contractStart, - ); + super.allTicks, + super.contractEnd, + super.contractStart, + }); /// Creates an instance from JSON. factory AuditDetails.fromJson(Map json) => AuditDetails( @@ -1005,7 +998,6 @@ class AuditDetails extends AuditDetailsModel { contractStart: contractStart ?? this.contractStart, ); } - /// All ticks item model class. abstract class AllTicksItemModel { /// Initializes All ticks item model class . @@ -1037,18 +1029,12 @@ abstract class AllTicksItemModel { class AllTicksItem extends AllTicksItemModel { /// Initializes All ticks item class. const AllTicksItem({ - DateTime? epoch, - String? flag, - String? name, - double? tick, - String? tickDisplayValue, - }) : super( - epoch: epoch, - flag: flag, - name: name, - tick: tick, - tickDisplayValue: tickDisplayValue, - ); + super.epoch, + super.flag, + super.name, + super.tick, + super.tickDisplayValue, + }); /// Creates an instance from JSON. factory AllTicksItem.fromJson(Map json) => AllTicksItem( @@ -1088,7 +1074,6 @@ class AllTicksItem extends AllTicksItemModel { tickDisplayValue: tickDisplayValue ?? this.tickDisplayValue, ); } - /// Contract end item model class. abstract class ContractEndItemModel { /// Initializes Contract end item model class . @@ -1120,18 +1105,12 @@ abstract class ContractEndItemModel { class ContractEndItem extends ContractEndItemModel { /// Initializes Contract end item class. const ContractEndItem({ - DateTime? epoch, - String? flag, - String? name, - double? tick, - String? tickDisplayValue, - }) : super( - epoch: epoch, - flag: flag, - name: name, - tick: tick, - tickDisplayValue: tickDisplayValue, - ); + super.epoch, + super.flag, + super.name, + super.tick, + super.tickDisplayValue, + }); /// Creates an instance from JSON. factory ContractEndItem.fromJson(Map json) => @@ -1172,7 +1151,6 @@ class ContractEndItem extends ContractEndItemModel { tickDisplayValue: tickDisplayValue ?? this.tickDisplayValue, ); } - /// Contract start item model class. abstract class ContractStartItemModel { /// Initializes Contract start item model class . @@ -1204,18 +1182,12 @@ abstract class ContractStartItemModel { class ContractStartItem extends ContractStartItemModel { /// Initializes Contract start item class. const ContractStartItem({ - DateTime? epoch, - String? flag, - String? name, - double? tick, - String? tickDisplayValue, - }) : super( - epoch: epoch, - flag: flag, - name: name, - tick: tick, - tickDisplayValue: tickDisplayValue, - ); + super.epoch, + super.flag, + super.name, + super.tick, + super.tickDisplayValue, + }); /// Creates an instance from JSON. factory ContractStartItem.fromJson(Map json) => @@ -1256,7 +1228,6 @@ class ContractStartItem extends ContractStartItemModel { tickDisplayValue: tickDisplayValue ?? this.tickDisplayValue, ); } - /// Cancellation model class. abstract class CancellationModel extends Equatable { /// Initializes Cancellation model class . @@ -1276,12 +1247,9 @@ abstract class CancellationModel extends Equatable { class Cancellation extends CancellationModel { /// Initializes Cancellation class. const Cancellation({ - double? askPrice, - DateTime? dateExpiry, - }) : super( - askPrice: askPrice, - dateExpiry: dateExpiry, - ); + super.askPrice, + super.dateExpiry, + }); /// Creates an instance from JSON. factory Cancellation.fromJson(Map json) => Cancellation( @@ -1316,7 +1284,6 @@ class Cancellation extends CancellationModel { dateExpiry, ]; } - /// Limit order model class. abstract class LimitOrderModel extends Equatable { /// Initializes Limit order model class . @@ -1340,14 +1307,10 @@ abstract class LimitOrderModel extends Equatable { class LimitOrder extends LimitOrderModel { /// Initializes Limit order class. const LimitOrder({ - StopLoss? stopLoss, - StopOut? stopOut, - TakeProfit? takeProfit, - }) : super( - stopLoss: stopLoss, - stopOut: stopOut, - takeProfit: takeProfit, - ); + super.stopLoss, + super.stopOut, + super.takeProfit, + }); /// Creates an instance from JSON. factory LimitOrder.fromJson(Map json) => LimitOrder( @@ -1399,7 +1362,6 @@ class LimitOrder extends LimitOrderModel { takeProfit, ]; } - /// Stop loss model class. abstract class StopLossModel extends Equatable { /// Initializes Stop loss model class . @@ -1427,16 +1389,11 @@ abstract class StopLossModel extends Equatable { class StopLoss extends StopLossModel { /// Initializes Stop loss class. const StopLoss({ - String? displayName, - double? orderAmount, - DateTime? orderDate, - String? value, - }) : super( - displayName: displayName, - orderAmount: orderAmount, - orderDate: orderDate, - value: value, - ); + super.displayName, + super.orderAmount, + super.orderDate, + super.value, + }); /// Creates an instance from JSON. factory StopLoss.fromJson(Map json) => StopLoss( @@ -1479,7 +1436,6 @@ class StopLoss extends StopLossModel { orderAmount, ]; } - /// Stop out model class. abstract class StopOutModel extends Equatable { /// Initializes Stop out model class . @@ -1507,16 +1463,11 @@ abstract class StopOutModel extends Equatable { class StopOut extends StopOutModel { /// Initializes Stop out class. const StopOut({ - String? displayName, - double? orderAmount, - DateTime? orderDate, - String? value, - }) : super( - displayName: displayName, - orderAmount: orderAmount, - orderDate: orderDate, - value: value, - ); + super.displayName, + super.orderAmount, + super.orderDate, + super.value, + }); /// Creates an instance from JSON. factory StopOut.fromJson(Map json) => StopOut( @@ -1559,7 +1510,6 @@ class StopOut extends StopOutModel { orderAmount, ]; } - /// Take profit model class. abstract class TakeProfitModel extends Equatable { /// Initializes Take profit model class . @@ -1587,16 +1537,11 @@ abstract class TakeProfitModel extends Equatable { class TakeProfit extends TakeProfitModel { /// Initializes Take profit class. const TakeProfit({ - String? displayName, - double? orderAmount, - DateTime? orderDate, - String? value, - }) : super( - displayName: displayName, - orderAmount: orderAmount, - orderDate: orderDate, - value: value, - ); + super.displayName, + super.orderAmount, + super.orderDate, + super.value, + }); /// Creates an instance from JSON. factory TakeProfit.fromJson(Map json) => TakeProfit( @@ -1639,7 +1584,6 @@ class TakeProfit extends TakeProfitModel { orderAmount, ]; } - /// Tick stream item model class. abstract class TickStreamItemModel { /// Initializes Tick stream item model class . @@ -1663,14 +1607,10 @@ abstract class TickStreamItemModel { class TickStreamItem extends TickStreamItemModel { /// Initializes Tick stream item class. const TickStreamItem({ - DateTime? epoch, - double? tick, - String? tickDisplayValue, - }) : super( - epoch: epoch, - tick: tick, - tickDisplayValue: tickDisplayValue, - ); + super.epoch, + super.tick, + super.tickDisplayValue, + }); /// Creates an instance from JSON. factory TickStreamItem.fromJson(Map json) => TickStreamItem( @@ -1702,7 +1642,6 @@ class TickStreamItem extends TickStreamItemModel { tickDisplayValue: tickDisplayValue ?? this.tickDisplayValue, ); } - /// Transaction ids model class. abstract class TransactionIdsModel { /// Initializes Transaction ids model class . @@ -1722,12 +1661,9 @@ abstract class TransactionIdsModel { class TransactionIds extends TransactionIdsModel { /// Initializes Transaction ids class. const TransactionIds({ - int? buy, - int? sell, - }) : super( - buy: buy, - sell: sell, - ); + super.buy, + super.sell, + }); /// Creates an instance from JSON. factory TransactionIds.fromJson(Map json) => TransactionIds( @@ -1755,7 +1691,6 @@ class TransactionIds extends TransactionIdsModel { sell: sell ?? this.sell, ); } - /// Subscription model class. abstract class SubscriptionModel { /// Initializes Subscription model class . @@ -1771,10 +1706,8 @@ abstract class SubscriptionModel { class Subscription extends SubscriptionModel { /// Initializes Subscription class. const Subscription({ - required String id, - }) : super( - id: id, - ); + required super.id, + }); /// Creates an instance from JSON. factory Subscription.fromJson(Map json) => Subscription( diff --git a/lib/api/response/proposal_response_result.dart b/lib/api/response/proposal_response_result.dart index 00df4fd869..37124d8d5d 100644 --- a/lib/api/response/proposal_response_result.dart +++ b/lib/api/response/proposal_response_result.dart @@ -1,8 +1,9 @@ // ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import import 'package:equatable/equatable.dart'; -import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/api/models/enums.dart'; import 'package:flutter_deriv_api/api/response/buy_response_result.dart'; import 'package:flutter_deriv_api/api/response/forget_all_response_result.dart'; @@ -38,12 +39,9 @@ abstract class ProposalResponseModel { class ProposalResponse extends ProposalResponseModel { /// Initializes Proposal response class. const ProposalResponse({ - Proposal? proposal, - Subscription? subscription, - }) : super( - proposal: proposal, - subscription: subscription, - ); + super.proposal, + super.subscription, + }); /// Creates an instance from JSON. factory ProposalResponse.fromJson( @@ -181,7 +179,6 @@ class ProposalResponse extends ProposalResponseModel { subscription: subscription ?? this.subscription, ); } - /// Proposal model class. abstract class ProposalModel extends Equatable { /// Initializes Proposal model class . @@ -199,6 +196,7 @@ abstract class ProposalModel extends Equatable { this.commission, this.contractDetails, this.dateExpiry, + this.displayNumberOfContracts, this.limitOrder, this.maxStake, this.minStake, @@ -239,25 +237,28 @@ abstract class ProposalModel extends Equatable { /// Commission changed in percentage (%). final double? commission; - /// Contains contract information. (Only applicable for accumulator). + /// Contains contract information. final ContractDetails? contractDetails; /// The end date of the contract. final DateTime? dateExpiry; + /// [Only for vanilla or turbos options] The implied number of contracts + final String? displayNumberOfContracts; + /// Contains limit order information. (Only applicable for contract with limit order). final LimitOrder? limitOrder; - /// [Only for vanilla options] Maximum stakes allowed + /// [Only for vanilla or turbos options] Maximum stakes allowed final double? maxStake; - /// [Only for vanilla options] Minimum stakes allowed + /// [Only for vanilla or turbos options] Minimum stakes allowed final double? minStake; /// [Only for lookback trades] Multiplier applies when calculating the final payoff for each type of lookback. e.g. (Exit spot - Lowest historical price) * multiplier = Payout final double? multiplier; - /// [Only for vanilla options] The implied number of contracts + /// [Only for vanilla or turbos options] The implied number of contracts final double? numberOfContracts; } @@ -265,44 +266,26 @@ abstract class ProposalModel extends Equatable { class Proposal extends ProposalModel { /// Initializes Proposal class. const Proposal({ - required double askPrice, - required DateTime dateStart, - required String displayValue, - required String id, - required String longcode, - required double payout, - required double spot, - required DateTime spotTime, - List? barrierChoices, - Cancellation? cancellation, - double? commission, - ContractDetails? contractDetails, - DateTime? dateExpiry, - LimitOrder? limitOrder, - double? maxStake, - double? minStake, - double? multiplier, - double? numberOfContracts, - }) : super( - askPrice: askPrice, - dateStart: dateStart, - displayValue: displayValue, - id: id, - longcode: longcode, - payout: payout, - spot: spot, - spotTime: spotTime, - barrierChoices: barrierChoices, - cancellation: cancellation, - commission: commission, - contractDetails: contractDetails, - dateExpiry: dateExpiry, - limitOrder: limitOrder, - maxStake: maxStake, - minStake: minStake, - multiplier: multiplier, - numberOfContracts: numberOfContracts, - ); + required super.askPrice, + required super.dateStart, + required super.displayValue, + required super.id, + required super.longcode, + required super.payout, + required super.spot, + required super.spotTime, + super.barrierChoices, + super.cancellation, + super.commission, + super.contractDetails, + super.dateExpiry, + super.displayNumberOfContracts, + super.limitOrder, + super.maxStake, + super.minStake, + super.multiplier, + super.numberOfContracts, + }); /// Creates an instance from JSON. factory Proposal.fromJson(Map json) => Proposal( @@ -329,6 +312,7 @@ class Proposal extends ProposalModel { ? null : ContractDetails.fromJson(json['contract_details']), dateExpiry: getDateTime(json['date_expiry']), + displayNumberOfContracts: json['display_number_of_contracts'], limitOrder: json['limit_order'] == null ? null : LimitOrder.fromJson(json['limit_order']), @@ -365,6 +349,7 @@ class Proposal extends ProposalModel { resultMap['contract_details'] = contractDetails!.toJson(); } resultMap['date_expiry'] = getSecondsSinceEpochDateTime(dateExpiry); + resultMap['display_number_of_contracts'] = displayNumberOfContracts; if (limitOrder != null) { resultMap['limit_order'] = limitOrder!.toJson(); } @@ -391,6 +376,7 @@ class Proposal extends ProposalModel { double? commission, ContractDetails? contractDetails, DateTime? dateExpiry, + String? displayNumberOfContracts, LimitOrder? limitOrder, double? maxStake, double? minStake, @@ -411,6 +397,8 @@ class Proposal extends ProposalModel { commission: commission ?? this.commission, contractDetails: contractDetails ?? this.contractDetails, dateExpiry: dateExpiry ?? this.dateExpiry, + displayNumberOfContracts: + displayNumberOfContracts ?? this.displayNumberOfContracts, limitOrder: limitOrder ?? this.limitOrder, maxStake: maxStake ?? this.maxStake, minStake: minStake ?? this.minStake, @@ -430,7 +418,6 @@ class Proposal extends ProposalModel { limitOrder, ]; } - /// Cancellation model class. abstract class CancellationModel extends Equatable { /// Initializes Cancellation model class . @@ -450,12 +437,9 @@ abstract class CancellationModel extends Equatable { class Cancellation extends CancellationModel { /// Initializes Cancellation class. const Cancellation({ - double? askPrice, - DateTime? dateExpiry, - }) : super( - askPrice: askPrice, - dateExpiry: dateExpiry, - ); + super.askPrice, + super.dateExpiry, + }); /// Creates an instance from JSON. factory Cancellation.fromJson(Map json) => Cancellation( @@ -490,11 +474,12 @@ class Cancellation extends CancellationModel { dateExpiry, ]; } - /// Contract details model class. abstract class ContractDetailsModel { /// Initializes Contract details model class . const ContractDetailsModel({ + this.barrier, + this.barrierSpotDistance, this.highBarrier, this.lastTickEpoch, this.lowBarrier, @@ -504,6 +489,12 @@ abstract class ContractDetailsModel { this.ticksStayedIn, }); + /// Barrier of the contract. + final String? barrier; + + /// Absolute difference between high/low barrier and spot + final String? barrierSpotDistance; + /// High barrier calculated based on current spot final String? highBarrier; @@ -530,26 +521,22 @@ abstract class ContractDetailsModel { class ContractDetails extends ContractDetailsModel { /// Initializes Contract details class. const ContractDetails({ - String? highBarrier, - DateTime? lastTickEpoch, - String? lowBarrier, - double? maximumPayout, - int? maximumTicks, - double? tickSizeBarrier, - List? ticksStayedIn, - }) : super( - highBarrier: highBarrier, - lastTickEpoch: lastTickEpoch, - lowBarrier: lowBarrier, - maximumPayout: maximumPayout, - maximumTicks: maximumTicks, - tickSizeBarrier: tickSizeBarrier, - ticksStayedIn: ticksStayedIn, - ); + super.barrier, + super.barrierSpotDistance, + super.highBarrier, + super.lastTickEpoch, + super.lowBarrier, + super.maximumPayout, + super.maximumTicks, + super.tickSizeBarrier, + super.ticksStayedIn, + }); /// Creates an instance from JSON. factory ContractDetails.fromJson(Map json) => ContractDetails( + barrier: json['barrier'], + barrierSpotDistance: json['barrier_spot_distance'], highBarrier: json['high_barrier'], lastTickEpoch: getDateTime(json['last_tick_epoch']), lowBarrier: json['low_barrier'], @@ -569,6 +556,8 @@ class ContractDetails extends ContractDetailsModel { Map toJson() { final Map resultMap = {}; + resultMap['barrier'] = barrier; + resultMap['barrier_spot_distance'] = barrierSpotDistance; resultMap['high_barrier'] = highBarrier; resultMap['last_tick_epoch'] = getSecondsSinceEpochDateTime(lastTickEpoch); resultMap['low_barrier'] = lowBarrier; @@ -588,6 +577,8 @@ class ContractDetails extends ContractDetailsModel { /// Creates a copy of instance with given parameters. ContractDetails copyWith({ + String? barrier, + String? barrierSpotDistance, String? highBarrier, DateTime? lastTickEpoch, String? lowBarrier, @@ -597,6 +588,8 @@ class ContractDetails extends ContractDetailsModel { List? ticksStayedIn, }) => ContractDetails( + barrier: barrier ?? this.barrier, + barrierSpotDistance: barrierSpotDistance ?? this.barrierSpotDistance, highBarrier: highBarrier ?? this.highBarrier, lastTickEpoch: lastTickEpoch ?? this.lastTickEpoch, lowBarrier: lowBarrier ?? this.lowBarrier, @@ -606,7 +599,6 @@ class ContractDetails extends ContractDetailsModel { ticksStayedIn: ticksStayedIn ?? this.ticksStayedIn, ); } - /// Limit order model class. abstract class LimitOrderModel extends Equatable { /// Initializes Limit order model class . @@ -630,14 +622,10 @@ abstract class LimitOrderModel extends Equatable { class LimitOrder extends LimitOrderModel { /// Initializes Limit order class. const LimitOrder({ - StopLoss? stopLoss, - StopOut? stopOut, - TakeProfit? takeProfit, - }) : super( - stopLoss: stopLoss, - stopOut: stopOut, - takeProfit: takeProfit, - ); + super.stopLoss, + super.stopOut, + super.takeProfit, + }); /// Creates an instance from JSON. factory LimitOrder.fromJson(Map json) => LimitOrder( @@ -689,7 +677,6 @@ class LimitOrder extends LimitOrderModel { takeProfit, ]; } - /// Stop loss model class. abstract class StopLossModel extends Equatable { /// Initializes Stop loss model class . @@ -717,16 +704,11 @@ abstract class StopLossModel extends Equatable { class StopLoss extends StopLossModel { /// Initializes Stop loss class. const StopLoss({ - String? displayName, - double? orderAmount, - DateTime? orderDate, - String? value, - }) : super( - displayName: displayName, - orderAmount: orderAmount, - orderDate: orderDate, - value: value, - ); + super.displayName, + super.orderAmount, + super.orderDate, + super.value, + }); /// Creates an instance from JSON. factory StopLoss.fromJson(Map json) => StopLoss( @@ -769,7 +751,6 @@ class StopLoss extends StopLossModel { orderAmount, ]; } - /// Stop out model class. abstract class StopOutModel extends Equatable { /// Initializes Stop out model class . @@ -797,16 +778,11 @@ abstract class StopOutModel extends Equatable { class StopOut extends StopOutModel { /// Initializes Stop out class. const StopOut({ - String? displayName, - double? orderAmount, - DateTime? orderDate, - String? value, - }) : super( - displayName: displayName, - orderAmount: orderAmount, - orderDate: orderDate, - value: value, - ); + super.displayName, + super.orderAmount, + super.orderDate, + super.value, + }); /// Creates an instance from JSON. factory StopOut.fromJson(Map json) => StopOut( @@ -849,7 +825,6 @@ class StopOut extends StopOutModel { orderAmount, ]; } - /// Take profit model class. abstract class TakeProfitModel extends Equatable { /// Initializes Take profit model class . @@ -877,16 +852,11 @@ abstract class TakeProfitModel extends Equatable { class TakeProfit extends TakeProfitModel { /// Initializes Take profit class. const TakeProfit({ - String? displayName, - double? orderAmount, - DateTime? orderDate, - String? value, - }) : super( - displayName: displayName, - orderAmount: orderAmount, - orderDate: orderDate, - value: value, - ); + super.displayName, + super.orderAmount, + super.orderDate, + super.value, + }); /// Creates an instance from JSON. factory TakeProfit.fromJson(Map json) => TakeProfit( @@ -929,7 +899,6 @@ class TakeProfit extends TakeProfitModel { orderAmount, ]; } - /// Subscription model class. abstract class SubscriptionModel { /// Initializes Subscription model class . @@ -945,10 +914,8 @@ abstract class SubscriptionModel { class Subscription extends SubscriptionModel { /// Initializes Subscription class. const Subscription({ - required String id, - }) : super( - id: id, - ); + required super.id, + }); /// Creates an instance from JSON. factory Subscription.fromJson(Map json) => Subscription( diff --git a/lib/basic_api/generated/methods/proposal_receive_methods.json b/lib/basic_api/generated/methods/proposal_receive_methods.json index 1e05eb285e..37ce13363b 100644 --- a/lib/basic_api/generated/methods/proposal_receive_methods.json +++ b/lib/basic_api/generated/methods/proposal_receive_methods.json @@ -1,4 +1,4 @@ { "methods": " static final BaseAPI _api = Injector()();\n\n /// Gets the price proposal for contract\n ///\n /// For parameters information refer to [ProposalRequest]\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchPriceForContract(\n ProposalRequest request,\n ) async {\n final ProposalReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ProposalResponse.fromJson(response.proposal, response.subscription);\n }\n\n /// Gets the price proposal for contract.\n ///\n /// For parameters information refer to [ProposalRequest]\n /// Throws a [BaseAPIException] if API response contains an error\n static Stream subscribePriceForContract(\n ProposalRequest request, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: request, comparePredicate: comparePredicate)!\n .map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(\n baseExceptionModel: baseExceptionModel),\n );\n\n return response is ProposalReceive\n ? ProposalResponse.fromJson(\n response.proposal,\n response.subscription,\n )\n : null;\n },\n );\n\n /// Unsubscribes from price proposal subscription.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future unsubscribeProposal() async {\n if (subscription == null) {\n return null;\n }\n\n final ForgetReceive response =\n await _api.unsubscribe(subscriptionId: subscription!.id);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }\n\n /// Unsubscribes all proposal subscriptions.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future unsubscribeAllProposal() async {\n final ForgetAllReceive response =\n await _api.unsubscribeAll(method: ForgetStreamType.proposal);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }\n\n /// Buys this proposal contract with [price] specified.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future buy({double? price}) => BuyResponse.buyMethod(BuyRequest(\n buy: proposal?.id,\n price: price ?? proposal?.askPrice,\n ));\n\n /// Buys this proposal contract with [price] specified and subscribes to it.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Stream buyAndSubscribe({double? price}) =>\n BuyResponse.buyAndSubscribe(BuyRequest(\n buy: proposal?.id,\n price: price ?? proposal?.askPrice,\n ));", - "imports": "import 'package:flutter_deriv_api/api/exceptions/contract_operations_exception.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/buy_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/proposal_open_contract_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/buy_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/proposal_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/proposal_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" + "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/buy_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/proposal_open_contract_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/buy_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/proposal_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/proposal_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/proposal_open_contract_receive.dart b/lib/basic_api/generated/proposal_open_contract_receive.dart index 7f7acba998..8ec54eb880 100644 --- a/lib/basic_api/generated/proposal_open_contract_receive.dart +++ b/lib/basic_api/generated/proposal_open_contract_receive.dart @@ -10,16 +10,11 @@ class ProposalOpenContractReceive extends Response { const ProposalOpenContractReceive({ this.proposalOpenContract, this.subscription, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory ProposalOpenContractReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/proposal_open_contract_send.dart b/lib/basic_api/generated/proposal_open_contract_send.dart index 0b38b4afae..e7731bc4fc 100644 --- a/lib/basic_api/generated/proposal_open_contract_send.dart +++ b/lib/basic_api/generated/proposal_open_contract_send.dart @@ -9,20 +9,19 @@ class ProposalOpenContractRequest extends Request { /// Initialize ProposalOpenContractRequest. const ProposalOpenContractRequest({ this.contractId, + this.loginid, this.proposalOpenContract = true, this.subscribe, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'proposal_open_contract', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'proposal_open_contract', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory ProposalOpenContractRequest.fromJson(Map json) => ProposalOpenContractRequest( contractId: json['contract_id'] as int?, + loginid: json['loginid'] as String?, proposalOpenContract: json['proposal_open_contract'] == null ? null : json['proposal_open_contract'] == 1, @@ -34,6 +33,9 @@ class ProposalOpenContractRequest extends Request { /// [Optional] Contract ID received from a `portfolio` request. If not set, you will receive stream of all open contracts. final int? contractId; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? proposalOpenContract; @@ -44,6 +46,7 @@ class ProposalOpenContractRequest extends Request { @override Map toJson() => { 'contract_id': contractId, + 'loginid': loginid, 'proposal_open_contract': proposalOpenContract == null ? null : proposalOpenContract! @@ -62,6 +65,7 @@ class ProposalOpenContractRequest extends Request { @override ProposalOpenContractRequest copyWith({ int? contractId, + String? loginid, bool? proposalOpenContract, bool? subscribe, Map? passthrough, @@ -69,6 +73,7 @@ class ProposalOpenContractRequest extends Request { }) => ProposalOpenContractRequest( contractId: contractId ?? this.contractId, + loginid: loginid ?? this.loginid, proposalOpenContract: proposalOpenContract ?? this.proposalOpenContract, subscribe: subscribe ?? this.subscribe, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/proposal_receive.dart b/lib/basic_api/generated/proposal_receive.dart index a7c2bb428c..906279649e 100644 --- a/lib/basic_api/generated/proposal_receive.dart +++ b/lib/basic_api/generated/proposal_receive.dart @@ -10,16 +10,11 @@ class ProposalReceive extends Response { const ProposalReceive({ this.proposal, this.subscription, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory ProposalReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/proposal_send.dart b/lib/basic_api/generated/proposal_send.dart index 6d0de27ecb..ce91b2a5e2 100644 --- a/lib/basic_api/generated/proposal_send.dart +++ b/lib/basic_api/generated/proposal_send.dart @@ -22,6 +22,7 @@ class ProposalRequest extends Request { this.durationUnit, this.growthRate, required this.limitOrder, + this.loginid, this.multiplier, this.productType, this.proposal = true, @@ -29,13 +30,10 @@ class ProposalRequest extends Request { this.subscribe, required this.symbol, this.tradingPeriodStart, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'proposal', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'proposal', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory ProposalRequest.fromJson(Map json) => @@ -54,6 +52,7 @@ class ProposalRequest extends Request { durationUnit: json['duration_unit'] as String?, growthRate: json['growth_rate'] as num?, limitOrder: json['limit_order'] as Map?, + loginid: json['loginid'] as String?, multiplier: json['multiplier'] as num?, productType: json['product_type'] as String?, proposal: json['proposal'] == null ? null : json['proposal'] == 1, @@ -107,6 +106,9 @@ class ProposalRequest extends Request { /// Add an order to close the contract once the order condition is met (only for `MULTUP` and `MULTDOWN` and 'ACCU' contracts). Supported orders: `take_profit`, `stop_loss`. final Map? limitOrder; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] The multiplier for non-binary options. E.g. lookbacks. final num? multiplier; @@ -145,6 +147,7 @@ class ProposalRequest extends Request { 'duration_unit': durationUnit, 'growth_rate': growthRate, 'limit_order': limitOrder, + 'loginid': loginid, 'multiplier': multiplier, 'product_type': productType, 'proposal': proposal == null @@ -181,6 +184,7 @@ class ProposalRequest extends Request { String? durationUnit, num? growthRate, Map? limitOrder, + String? loginid, num? multiplier, String? productType, bool? proposal, @@ -206,6 +210,7 @@ class ProposalRequest extends Request { durationUnit: durationUnit ?? this.durationUnit, growthRate: growthRate ?? this.growthRate, limitOrder: limitOrder ?? this.limitOrder, + loginid: loginid ?? this.loginid, multiplier: multiplier ?? this.multiplier, productType: productType ?? this.productType, proposal: proposal ?? this.proposal, From 3a957ce9be48e319e0e5509a83819fd680b0e6fb Mon Sep 17 00:00:00 2001 From: Weng Lok <103249398+weng-deriv@users.noreply.github.com> Date: Wed, 6 Dec 2023 10:15:29 +0800 Subject: [PATCH 18/64] =?UTF-8?q?Updated=20p2p=20api=20send=20and=20receiv?= =?UTF-8?q?e=20requests=20for=20flexible=20order=20time=20sel=E2=80=A6=20(?= =?UTF-8?q?#286)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../p2p_advert_create_response_result.dart | 224 +++++++--------- .../p2p_advert_info_response_result.dart | 252 +++++++----------- .../p2p_advert_list_response_result.dart | 200 ++++++-------- .../p2p_advert_update_response_result.dart | 232 +++++++--------- ...2p_advertiser_adverts_response_result.dart | 192 ++++++------- .../generated/p2p_advert_create_send.dart | 32 ++- .../generated/p2p_advert_update_send.dart | 19 +- .../p2p/p2p_advert_create_response.dart | 2 + .../p2p/p2p_advert_list_response.dart | 4 + .../p2p/p2p_order_create_response.dart | 2 + test/api/p2p/p2p_advert/p2p_advert_test.dart | 9 +- 11 files changed, 493 insertions(+), 675 deletions(-) diff --git a/lib/api/response/p2p_advert_create_response_result.dart b/lib/api/response/p2p_advert_create_response_result.dart index 2c41b1b0b9..6cdd91498f 100644 --- a/lib/api/response/p2p_advert_create_response_result.dart +++ b/lib/api/response/p2p_advert_create_response_result.dart @@ -1,8 +1,8 @@ // ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import import 'package:equatable/equatable.dart'; -import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/api/exceptions/base_api_exception.dart'; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_receive.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_send.dart'; @@ -25,10 +25,8 @@ abstract class P2pAdvertCreateResponseModel { class P2pAdvertCreateResponse extends P2pAdvertCreateResponseModel { /// Initializes P2p advert create response class. const P2pAdvertCreateResponse({ - P2pAdvertCreate? p2pAdvertCreate, - }) : super( - p2pAdvertCreate: p2pAdvertCreate, - ); + super.p2pAdvertCreate, + }); /// Creates an instance from JSON. factory P2pAdvertCreateResponse.fromJson( @@ -185,6 +183,8 @@ final Map visibilityStatusItemEnumMapper = "advertiser_ads_paused": VisibilityStatusItemEnum.advertiserAdsPaused, "advertiser_approval": VisibilityStatusItemEnum.advertiserApproval, "advertiser_balance": VisibilityStatusItemEnum.advertiserBalance, + "advertiser_block_trade_ineligible": + VisibilityStatusItemEnum.advertiserBlockTradeIneligible, "advertiser_daily_limit": VisibilityStatusItemEnum.advertiserDailyLimit, "advertiser_temp_ban": VisibilityStatusItemEnum.advertiserTempBan, }; @@ -212,6 +212,9 @@ enum VisibilityStatusItemEnum { /// advertiser_balance. advertiserBalance, + /// advertiser_block_trade_ineligible. + advertiserBlockTradeIneligible, + /// advertiser_daily_limit. advertiserDailyLimit, @@ -229,6 +232,7 @@ abstract class P2pAdvertCreateModel { required this.rateType, required this.rateDisplay, required this.rate, + required this.orderExpiryPeriod, required this.minOrderAmountLimitDisplay, required this.minOrderAmountLimit, required this.minOrderAmountDisplay, @@ -245,6 +249,7 @@ abstract class P2pAdvertCreateModel { required this.createdTime, required this.country, required this.counterpartyType, + required this.blockTrade, required this.amountDisplay, required this.amount, required this.advertiserDetails, @@ -280,6 +285,9 @@ abstract class P2pAdvertCreateModel { /// Conversion rate from advertiser's account currency to `local_currency`. An absolute rate value (fixed), or percentage offset from current market rate (floating). final double rate; + /// Expiry period (seconds) for order created against this ad. + final int orderExpiryPeriod; + /// Minimum order amount at this time, in `account_currency`, formatted to appropriate decimal places. final String minOrderAmountLimitDisplay; @@ -328,6 +336,9 @@ abstract class P2pAdvertCreateModel { /// Type of transaction from the opposite party's perspective. final CounterpartyTypeEnum counterpartyType; + /// Indicates if this is block trade advert or not. + final bool blockTrade; + /// The total amount specified in advert, in `account_currency`, formatted to appropriate decimal places. final String amountDisplay; @@ -378,6 +389,7 @@ abstract class P2pAdvertCreateModel { /// - `advertiser_ads_paused`: the advertiser has paused all adverts. /// - `advertiser_approval`: the advertiser's proof of identity is not verified. /// - `advertiser_balance`: the advertiser's P2P balance is less than the minimum order. + /// - `advertiser_block_trade_ineligible`: the advertiser is not currently eligible for block trading. /// - `advertiser_daily_limit`: the advertiser's remaining daily limit is less than the minimum order. /// - `advertiser_temp_ban`: the advertiser is temporarily banned from P2P. final List? visibilityStatus; @@ -387,82 +399,46 @@ abstract class P2pAdvertCreateModel { class P2pAdvertCreate extends P2pAdvertCreateModel { /// Initializes P2p advert create class. const P2pAdvertCreate({ - required String accountCurrency, - required int activeOrders, - required AdvertiserDetails advertiserDetails, - required double amount, - required String amountDisplay, - required CounterpartyTypeEnum counterpartyType, - required String country, - required DateTime createdTime, - required String description, - required String id, - required bool isActive, - required bool isVisible, - required String localCurrency, - required double maxOrderAmount, - required String maxOrderAmountDisplay, - required double maxOrderAmountLimit, - required String maxOrderAmountLimitDisplay, - required double minOrderAmount, - required String minOrderAmountDisplay, - required double minOrderAmountLimit, - required String minOrderAmountLimitDisplay, - required double rate, - required String rateDisplay, - required RateTypeEnum rateType, - required double remainingAmount, - required String remainingAmountDisplay, - required P2pAdvertCreateTypeEnum type, - String? contactInfo, - double? effectiveRate, - String? effectiveRateDisplay, - String? paymentInfo, - String? paymentMethod, - Map? paymentMethodDetails, - List? paymentMethodNames, - double? price, - String? priceDisplay, - List? visibilityStatus, - }) : super( - accountCurrency: accountCurrency, - activeOrders: activeOrders, - advertiserDetails: advertiserDetails, - amount: amount, - amountDisplay: amountDisplay, - counterpartyType: counterpartyType, - country: country, - createdTime: createdTime, - description: description, - id: id, - isActive: isActive, - isVisible: isVisible, - localCurrency: localCurrency, - maxOrderAmount: maxOrderAmount, - maxOrderAmountDisplay: maxOrderAmountDisplay, - maxOrderAmountLimit: maxOrderAmountLimit, - maxOrderAmountLimitDisplay: maxOrderAmountLimitDisplay, - minOrderAmount: minOrderAmount, - minOrderAmountDisplay: minOrderAmountDisplay, - minOrderAmountLimit: minOrderAmountLimit, - minOrderAmountLimitDisplay: minOrderAmountLimitDisplay, - rate: rate, - rateDisplay: rateDisplay, - rateType: rateType, - remainingAmount: remainingAmount, - remainingAmountDisplay: remainingAmountDisplay, - type: type, - contactInfo: contactInfo, - effectiveRate: effectiveRate, - effectiveRateDisplay: effectiveRateDisplay, - paymentInfo: paymentInfo, - paymentMethod: paymentMethod, - paymentMethodDetails: paymentMethodDetails, - paymentMethodNames: paymentMethodNames, - price: price, - priceDisplay: priceDisplay, - visibilityStatus: visibilityStatus, - ); + required super.accountCurrency, + required super.activeOrders, + required super.advertiserDetails, + required super.amount, + required super.amountDisplay, + required super.blockTrade, + required super.counterpartyType, + required super.country, + required super.createdTime, + required super.description, + required super.id, + required super.isActive, + required super.isVisible, + required super.localCurrency, + required super.maxOrderAmount, + required super.maxOrderAmountDisplay, + required super.maxOrderAmountLimit, + required super.maxOrderAmountLimitDisplay, + required super.minOrderAmount, + required super.minOrderAmountDisplay, + required super.minOrderAmountLimit, + required super.minOrderAmountLimitDisplay, + required super.orderExpiryPeriod, + required super.rate, + required super.rateDisplay, + required super.rateType, + required super.remainingAmount, + required super.remainingAmountDisplay, + required super.type, + super.contactInfo, + super.effectiveRate, + super.effectiveRateDisplay, + super.paymentInfo, + super.paymentMethod, + super.paymentMethodDetails, + super.paymentMethodNames, + super.price, + super.priceDisplay, + super.visibilityStatus, + }); /// Creates an instance from JSON. factory P2pAdvertCreate.fromJson(Map json) => @@ -473,6 +449,7 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { AdvertiserDetails.fromJson(json['advertiser_details']), amount: getDouble(json['amount'])!, amountDisplay: json['amount_display'], + blockTrade: getBool(json['block_trade'])!, counterpartyType: counterpartyTypeEnumMapper[json['counterparty_type']]!, country: json['country'], @@ -490,6 +467,7 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { minOrderAmountDisplay: json['min_order_amount_display'], minOrderAmountLimit: getDouble(json['min_order_amount_limit'])!, minOrderAmountLimitDisplay: json['min_order_amount_limit_display'], + orderExpiryPeriod: json['order_expiry_period'], rate: getDouble(json['rate'])!, rateDisplay: json['rate_display'], rateType: rateTypeEnumMapper[json['rate_type']]!, @@ -542,6 +520,7 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { resultMap['amount'] = amount; resultMap['amount_display'] = amountDisplay; + resultMap['block_trade'] = blockTrade; resultMap['counterparty_type'] = counterpartyTypeEnumMapper.entries .firstWhere((MapEntry entry) => entry.value == counterpartyType) @@ -561,6 +540,7 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { resultMap['min_order_amount_display'] = minOrderAmountDisplay; resultMap['min_order_amount_limit'] = minOrderAmountLimit; resultMap['min_order_amount_limit_display'] = minOrderAmountLimitDisplay; + resultMap['order_expiry_period'] = orderExpiryPeriod; resultMap['rate'] = rate; resultMap['rate_display'] = rateDisplay; resultMap['rate_type'] = rateTypeEnumMapper.entries @@ -611,6 +591,7 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { AdvertiserDetails? advertiserDetails, double? amount, String? amountDisplay, + bool? blockTrade, CounterpartyTypeEnum? counterpartyType, String? country, DateTime? createdTime, @@ -627,6 +608,7 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { String? minOrderAmountDisplay, double? minOrderAmountLimit, String? minOrderAmountLimitDisplay, + int? orderExpiryPeriod, double? rate, String? rateDisplay, RateTypeEnum? rateType, @@ -650,6 +632,7 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { advertiserDetails: advertiserDetails ?? this.advertiserDetails, amount: amount ?? this.amount, amountDisplay: amountDisplay ?? this.amountDisplay, + blockTrade: blockTrade ?? this.blockTrade, counterpartyType: counterpartyType ?? this.counterpartyType, country: country ?? this.country, createdTime: createdTime ?? this.createdTime, @@ -670,6 +653,7 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { minOrderAmountLimit: minOrderAmountLimit ?? this.minOrderAmountLimit, minOrderAmountLimitDisplay: minOrderAmountLimitDisplay ?? this.minOrderAmountLimitDisplay, + orderExpiryPeriod: orderExpiryPeriod ?? this.orderExpiryPeriod, rate: rate ?? this.rate, rateDisplay: rateDisplay ?? this.rateDisplay, rateType: rateType ?? this.rateType, @@ -749,32 +733,19 @@ abstract class AdvertiserDetailsModel { class AdvertiserDetails extends AdvertiserDetailsModel { /// Initializes Advertiser details class. const AdvertiserDetails({ - required int completedOrdersCount, - required String id, - required bool isOnline, - required String name, - required int ratingCount, - String? firstName, - String? lastName, - DateTime? lastOnlineTime, - double? ratingAverage, - double? recommendedAverage, - int? recommendedCount, - double? totalCompletionRate, - }) : super( - completedOrdersCount: completedOrdersCount, - id: id, - isOnline: isOnline, - name: name, - ratingCount: ratingCount, - firstName: firstName, - lastName: lastName, - lastOnlineTime: lastOnlineTime, - ratingAverage: ratingAverage, - recommendedAverage: recommendedAverage, - recommendedCount: recommendedCount, - totalCompletionRate: totalCompletionRate, - ); + required super.completedOrdersCount, + required super.id, + required super.isOnline, + required super.name, + required super.ratingCount, + super.firstName, + super.lastName, + super.lastOnlineTime, + super.ratingAverage, + super.recommendedAverage, + super.recommendedCount, + super.totalCompletionRate, + }); /// Creates an instance from JSON. factory AdvertiserDetails.fromJson(Map json) => @@ -884,22 +855,14 @@ abstract class PaymentMethodDetailsPropertyModel { class PaymentMethodDetailsProperty extends PaymentMethodDetailsPropertyModel { /// Initializes Payment method details property class. const PaymentMethodDetailsProperty({ - required Map fields, - required bool isEnabled, - required String method, - required PaymentMethodDetailsPropertyTypeEnum type, - String? displayName, - List? usedByAdverts, - List? usedByOrders, - }) : super( - fields: fields, - isEnabled: isEnabled, - method: method, - type: type, - displayName: displayName, - usedByAdverts: usedByAdverts, - usedByOrders: usedByOrders, - ); + required super.fields, + required super.isEnabled, + required super.method, + required super.type, + super.displayName, + super.usedByAdverts, + super.usedByOrders, + }); /// Creates an instance from JSON. factory PaymentMethodDetailsProperty.fromJson(Map json) => @@ -1009,16 +972,11 @@ abstract class FieldsPropertyModel { class FieldsProperty extends FieldsPropertyModel { /// Initializes Fields property class. const FieldsProperty({ - required String displayName, - required int required, - required TypeEnum type, - required String value, - }) : super( - displayName: displayName, - required: required, - type: type, - value: value, - ); + required super.displayName, + required super.required, + required super.type, + required super.value, + }); /// Creates an instance from JSON. factory FieldsProperty.fromJson(Map json) => FieldsProperty( diff --git a/lib/api/response/p2p_advert_info_response_result.dart b/lib/api/response/p2p_advert_info_response_result.dart index 561bc9bb6e..eac7137470 100644 --- a/lib/api/response/p2p_advert_info_response_result.dart +++ b/lib/api/response/p2p_advert_info_response_result.dart @@ -17,7 +17,6 @@ import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_update_receive. import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_update_send.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_order_create_receive.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_order_create_send.dart'; - /// P2p advert info response model class. abstract class P2pAdvertInfoResponseModel { /// Initializes P2p advert info response model class . @@ -37,12 +36,9 @@ abstract class P2pAdvertInfoResponseModel { class P2pAdvertInfoResponse extends P2pAdvertInfoResponseModel { /// Initializes P2p advert info response class. const P2pAdvertInfoResponse({ - P2pAdvertInfo? p2pAdvertInfo, - Subscription? subscription, - }) : super( - p2pAdvertInfo: p2pAdvertInfo, - subscription: subscription, - ); + super.p2pAdvertInfo, + super.subscription, + }); /// Creates an instance from JSON. factory P2pAdvertInfoResponse.fromJson( @@ -317,6 +313,8 @@ final Map visibilityStatusItemEnumMapper = "advertiser_ads_paused": VisibilityStatusItemEnum.advertiserAdsPaused, "advertiser_approval": VisibilityStatusItemEnum.advertiserApproval, "advertiser_balance": VisibilityStatusItemEnum.advertiserBalance, + "advertiser_block_trade_ineligible": + VisibilityStatusItemEnum.advertiserBlockTradeIneligible, "advertiser_daily_limit": VisibilityStatusItemEnum.advertiserDailyLimit, "advertiser_temp_ban": VisibilityStatusItemEnum.advertiserTempBan, }; @@ -344,13 +342,15 @@ enum VisibilityStatusItemEnum { /// advertiser_balance. advertiserBalance, + /// advertiser_block_trade_ineligible. + advertiserBlockTradeIneligible, + /// advertiser_daily_limit. advertiserDailyLimit, /// advertiser_temp_ban. advertiserTempBan, } - /// P2p advert info model class. abstract class P2pAdvertInfoModel { /// Initializes P2p advert info model class . @@ -360,6 +360,7 @@ abstract class P2pAdvertInfoModel { this.advertiserDetails, this.amount, this.amountDisplay, + this.blockTrade, this.contactInfo, this.counterpartyType, this.country, @@ -381,6 +382,7 @@ abstract class P2pAdvertInfoModel { this.minOrderAmountDisplay, this.minOrderAmountLimit, this.minOrderAmountLimitDisplay, + this.orderExpiryPeriod, this.paymentInfo, this.paymentMethod, this.paymentMethodDetails, @@ -411,6 +413,9 @@ abstract class P2pAdvertInfoModel { /// The total amount specified in advert, in `account_currency`, formatted to appropriate decimal places. It is only visible to the advert owner. final String? amountDisplay; + /// Indicates if this is block trade advert or not. + final bool? blockTrade; + /// Advertiser contact information. Only applicable for 'sell adverts'. final String? contactInfo; @@ -474,6 +479,9 @@ abstract class P2pAdvertInfoModel { /// Minimum order amount at this time, in `account_currency`, formatted to appropriate decimal places. final String? minOrderAmountLimitDisplay; + /// Expiry period (seconds) for order created against this ad. + final int? orderExpiryPeriod; + /// Payment instructions. Only applicable for 'sell adverts'. final String? paymentInfo; @@ -518,6 +526,7 @@ abstract class P2pAdvertInfoModel { /// - `advertiser_ads_paused`: the advertiser has paused all adverts. /// - `advertiser_approval`: the advertiser's proof of identity is not verified. /// - `advertiser_balance`: the advertiser's P2P balance is less than the minimum order. + /// - `advertiser_block_trade_ineligible`: the advertiser is not currently eligible for block trading. /// - `advertiser_daily_limit`: the advertiser's remaining daily limit is less than the minimum order. /// - `advertiser_temp_ban`: the advertiser is temporarily banned from P2P. final List? visibilityStatus; @@ -527,86 +536,48 @@ abstract class P2pAdvertInfoModel { class P2pAdvertInfo extends P2pAdvertInfoModel { /// Initializes P2p advert info class. const P2pAdvertInfo({ - String? accountCurrency, - int? activeOrders, - AdvertiserDetails? advertiserDetails, - double? amount, - String? amountDisplay, - String? contactInfo, - CounterpartyTypeEnum? counterpartyType, - String? country, - DateTime? createdTime, - int? daysUntilArchive, - int? deleted, - String? description, - double? effectiveRate, - String? effectiveRateDisplay, - String? id, - bool? isActive, - bool? isVisible, - String? localCurrency, - double? maxOrderAmount, - String? maxOrderAmountDisplay, - double? maxOrderAmountLimit, - String? maxOrderAmountLimitDisplay, - double? minOrderAmount, - String? minOrderAmountDisplay, - double? minOrderAmountLimit, - String? minOrderAmountLimitDisplay, - String? paymentInfo, - String? paymentMethod, - Map? paymentMethodDetails, - List? paymentMethodNames, - double? price, - String? priceDisplay, - double? rate, - String? rateDisplay, - RateTypeEnum? rateType, - double? remainingAmount, - String? remainingAmountDisplay, - P2pAdvertInfoTypeEnum? type, - List? visibilityStatus, - }) : super( - accountCurrency: accountCurrency, - activeOrders: activeOrders, - advertiserDetails: advertiserDetails, - amount: amount, - amountDisplay: amountDisplay, - contactInfo: contactInfo, - counterpartyType: counterpartyType, - country: country, - createdTime: createdTime, - daysUntilArchive: daysUntilArchive, - deleted: deleted, - description: description, - effectiveRate: effectiveRate, - effectiveRateDisplay: effectiveRateDisplay, - id: id, - isActive: isActive, - isVisible: isVisible, - localCurrency: localCurrency, - maxOrderAmount: maxOrderAmount, - maxOrderAmountDisplay: maxOrderAmountDisplay, - maxOrderAmountLimit: maxOrderAmountLimit, - maxOrderAmountLimitDisplay: maxOrderAmountLimitDisplay, - minOrderAmount: minOrderAmount, - minOrderAmountDisplay: minOrderAmountDisplay, - minOrderAmountLimit: minOrderAmountLimit, - minOrderAmountLimitDisplay: minOrderAmountLimitDisplay, - paymentInfo: paymentInfo, - paymentMethod: paymentMethod, - paymentMethodDetails: paymentMethodDetails, - paymentMethodNames: paymentMethodNames, - price: price, - priceDisplay: priceDisplay, - rate: rate, - rateDisplay: rateDisplay, - rateType: rateType, - remainingAmount: remainingAmount, - remainingAmountDisplay: remainingAmountDisplay, - type: type, - visibilityStatus: visibilityStatus, - ); + super.accountCurrency, + super.activeOrders, + super.advertiserDetails, + super.amount, + super.amountDisplay, + super.blockTrade, + super.contactInfo, + super.counterpartyType, + super.country, + super.createdTime, + super.daysUntilArchive, + super.deleted, + super.description, + super.effectiveRate, + super.effectiveRateDisplay, + super.id, + super.isActive, + super.isVisible, + super.localCurrency, + super.maxOrderAmount, + super.maxOrderAmountDisplay, + super.maxOrderAmountLimit, + super.maxOrderAmountLimitDisplay, + super.minOrderAmount, + super.minOrderAmountDisplay, + super.minOrderAmountLimit, + super.minOrderAmountLimitDisplay, + super.orderExpiryPeriod, + super.paymentInfo, + super.paymentMethod, + super.paymentMethodDetails, + super.paymentMethodNames, + super.price, + super.priceDisplay, + super.rate, + super.rateDisplay, + super.rateType, + super.remainingAmount, + super.remainingAmountDisplay, + super.type, + super.visibilityStatus, + }); /// Creates an instance from JSON. factory P2pAdvertInfo.fromJson(Map json) => P2pAdvertInfo( @@ -617,6 +588,7 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { : AdvertiserDetails.fromJson(json['advertiser_details']), amount: getDouble(json['amount']), amountDisplay: json['amount_display'], + blockTrade: getBool(json['block_trade']), contactInfo: json['contact_info'], counterpartyType: json['counterparty_type'] == null ? null @@ -640,6 +612,7 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { minOrderAmountDisplay: json['min_order_amount_display'], minOrderAmountLimit: getDouble(json['min_order_amount_limit']), minOrderAmountLimitDisplay: json['min_order_amount_limit_display'], + orderExpiryPeriod: json['order_expiry_period'], paymentInfo: json['payment_info'], paymentMethod: json['payment_method'], paymentMethodDetails: json['payment_method_details'] == null @@ -694,6 +667,7 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { } resultMap['amount'] = amount; resultMap['amount_display'] = amountDisplay; + resultMap['block_trade'] = blockTrade; resultMap['contact_info'] = contactInfo; resultMap['counterparty_type'] = counterpartyTypeEnumMapper.entries .firstWhere((MapEntry entry) => @@ -718,6 +692,7 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { resultMap['min_order_amount_display'] = minOrderAmountDisplay; resultMap['min_order_amount_limit'] = minOrderAmountLimit; resultMap['min_order_amount_limit_display'] = minOrderAmountLimitDisplay; + resultMap['order_expiry_period'] = orderExpiryPeriod; resultMap['payment_info'] = paymentInfo; resultMap['payment_method'] = paymentMethod; resultMap['payment_method_details'] = paymentMethodDetails; @@ -765,6 +740,7 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { AdvertiserDetails? advertiserDetails, double? amount, String? amountDisplay, + bool? blockTrade, String? contactInfo, CounterpartyTypeEnum? counterpartyType, String? country, @@ -786,6 +762,7 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { String? minOrderAmountDisplay, double? minOrderAmountLimit, String? minOrderAmountLimitDisplay, + int? orderExpiryPeriod, String? paymentInfo, String? paymentMethod, Map? paymentMethodDetails, @@ -806,6 +783,7 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { advertiserDetails: advertiserDetails ?? this.advertiserDetails, amount: amount ?? this.amount, amountDisplay: amountDisplay ?? this.amountDisplay, + blockTrade: blockTrade ?? this.blockTrade, contactInfo: contactInfo ?? this.contactInfo, counterpartyType: counterpartyType ?? this.counterpartyType, country: country ?? this.country, @@ -831,6 +809,7 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { minOrderAmountLimit: minOrderAmountLimit ?? this.minOrderAmountLimit, minOrderAmountLimitDisplay: minOrderAmountLimitDisplay ?? this.minOrderAmountLimitDisplay, + orderExpiryPeriod: orderExpiryPeriod ?? this.orderExpiryPeriod, paymentInfo: paymentInfo ?? this.paymentInfo, paymentMethod: paymentMethod ?? this.paymentMethod, paymentMethodDetails: paymentMethodDetails ?? this.paymentMethodDetails, @@ -847,7 +826,6 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { visibilityStatus: visibilityStatus ?? this.visibilityStatus, ); } - /// Advertiser details model class. abstract class AdvertiserDetailsModel { /// Initializes Advertiser details model class . @@ -919,38 +897,22 @@ abstract class AdvertiserDetailsModel { class AdvertiserDetails extends AdvertiserDetailsModel { /// Initializes Advertiser details class. const AdvertiserDetails({ - required int completedOrdersCount, - required String id, - required bool isOnline, - required String name, - required int ratingCount, - String? firstName, - bool? isBlocked, - bool? isFavourite, - int? isRecommended, - String? lastName, - DateTime? lastOnlineTime, - double? ratingAverage, - double? recommendedAverage, - int? recommendedCount, - double? totalCompletionRate, - }) : super( - completedOrdersCount: completedOrdersCount, - id: id, - isOnline: isOnline, - name: name, - ratingCount: ratingCount, - firstName: firstName, - isBlocked: isBlocked, - isFavourite: isFavourite, - isRecommended: isRecommended, - lastName: lastName, - lastOnlineTime: lastOnlineTime, - ratingAverage: ratingAverage, - recommendedAverage: recommendedAverage, - recommendedCount: recommendedCount, - totalCompletionRate: totalCompletionRate, - ); + required super.completedOrdersCount, + required super.id, + required super.isOnline, + required super.name, + required super.ratingCount, + super.firstName, + super.isBlocked, + super.isFavourite, + super.isRecommended, + super.lastName, + super.lastOnlineTime, + super.ratingAverage, + super.recommendedAverage, + super.recommendedCount, + super.totalCompletionRate, + }); /// Creates an instance from JSON. factory AdvertiserDetails.fromJson(Map json) => @@ -1032,7 +994,6 @@ class AdvertiserDetails extends AdvertiserDetailsModel { totalCompletionRate: totalCompletionRate ?? this.totalCompletionRate, ); } - /// Payment method details property model class. abstract class PaymentMethodDetailsPropertyModel { /// Initializes Payment method details property model class . @@ -1072,22 +1033,14 @@ abstract class PaymentMethodDetailsPropertyModel { class PaymentMethodDetailsProperty extends PaymentMethodDetailsPropertyModel { /// Initializes Payment method details property class. const PaymentMethodDetailsProperty({ - required Map fields, - required bool isEnabled, - required String method, - required PaymentMethodDetailsPropertyTypeEnum type, - String? displayName, - List? usedByAdverts, - List? usedByOrders, - }) : super( - fields: fields, - isEnabled: isEnabled, - method: method, - type: type, - displayName: displayName, - usedByAdverts: usedByAdverts, - usedByOrders: usedByOrders, - ); + required super.fields, + required super.isEnabled, + required super.method, + required super.type, + super.displayName, + super.usedByAdverts, + super.usedByOrders, + }); /// Creates an instance from JSON. factory PaymentMethodDetailsProperty.fromJson(Map json) => @@ -1169,7 +1122,6 @@ class PaymentMethodDetailsProperty extends PaymentMethodDetailsPropertyModel { usedByOrders: usedByOrders ?? this.usedByOrders, ); } - /// Fields property model class. abstract class FieldsPropertyModel { /// Initializes Fields property model class . @@ -1197,16 +1149,11 @@ abstract class FieldsPropertyModel { class FieldsProperty extends FieldsPropertyModel { /// Initializes Fields property class. const FieldsProperty({ - required String displayName, - required int required, - required TypeEnum type, - required String value, - }) : super( - displayName: displayName, - required: required, - type: type, - value: value, - ); + required super.displayName, + required super.required, + required super.type, + required super.value, + }); /// Creates an instance from JSON. factory FieldsProperty.fromJson(Map json) => FieldsProperty( @@ -1244,7 +1191,6 @@ class FieldsProperty extends FieldsPropertyModel { value: value ?? this.value, ); } - /// Subscription model class. abstract class SubscriptionModel { /// Initializes Subscription model class . @@ -1260,10 +1206,8 @@ abstract class SubscriptionModel { class Subscription extends SubscriptionModel { /// Initializes Subscription class. const Subscription({ - required String id, - }) : super( - id: id, - ); + required super.id, + }); /// Creates an instance from JSON. factory Subscription.fromJson(Map json) => Subscription( diff --git a/lib/api/response/p2p_advert_list_response_result.dart b/lib/api/response/p2p_advert_list_response_result.dart index a42934b371..2f4d2bf0a2 100644 --- a/lib/api/response/p2p_advert_list_response_result.dart +++ b/lib/api/response/p2p_advert_list_response_result.dart @@ -1,8 +1,8 @@ // ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import import 'package:equatable/equatable.dart'; -import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/api/exceptions/base_api_exception.dart'; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_receive.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_send.dart'; @@ -25,10 +25,8 @@ abstract class P2pAdvertListResponseModel { class P2pAdvertListResponse extends P2pAdvertListResponseModel { /// Initializes P2p advert list response class. const P2pAdvertListResponse({ - P2pAdvertList? p2pAdvertList, - }) : super( - p2pAdvertList: p2pAdvertList, - ); + super.p2pAdvertList, + }); /// Creates an instance from JSON. factory P2pAdvertListResponse.fromJson( @@ -148,6 +146,8 @@ final Map visibilityStatusItemEnumMapper = "advertiser_ads_paused": VisibilityStatusItemEnum.advertiserAdsPaused, "advertiser_approval": VisibilityStatusItemEnum.advertiserApproval, "advertiser_balance": VisibilityStatusItemEnum.advertiserBalance, + "advertiser_block_trade_ineligible": + VisibilityStatusItemEnum.advertiserBlockTradeIneligible, "advertiser_daily_limit": VisibilityStatusItemEnum.advertiserDailyLimit, "advertiser_temp_ban": VisibilityStatusItemEnum.advertiserTempBan, }; @@ -175,6 +175,9 @@ enum VisibilityStatusItemEnum { /// advertiser_balance. advertiserBalance, + /// advertiser_block_trade_ineligible. + advertiserBlockTradeIneligible, + /// advertiser_daily_limit. advertiserDailyLimit, @@ -197,10 +200,8 @@ abstract class P2pAdvertListModel { class P2pAdvertList extends P2pAdvertListModel { /// Initializes P2p advert list class. const P2pAdvertList({ - required List list, - }) : super( - list: list, - ); + required super.list, + }); /// Creates an instance from JSON. factory P2pAdvertList.fromJson(Map json) => P2pAdvertList( @@ -241,6 +242,7 @@ abstract class ListItemModel { required this.rateType, required this.rateDisplay, required this.rate, + required this.orderExpiryPeriod, required this.minOrderAmountLimitDisplay, required this.minOrderAmountLimit, required this.maxOrderAmountLimitDisplay, @@ -253,6 +255,7 @@ abstract class ListItemModel { required this.createdTime, required this.country, required this.counterpartyType, + required this.blockTrade, required this.advertiserDetails, required this.accountCurrency, this.activeOrders, @@ -288,6 +291,9 @@ abstract class ListItemModel { /// Conversion rate from advertiser's account currency to `local_currency`. An absolute rate value (fixed), or percentage offset from current market rate (floating). final double rate; + /// Expiry period (seconds) for order created against this ad. + final int orderExpiryPeriod; + /// Minimum order amount at this time, in `account_currency`, formatted to appropriate decimal places. final String minOrderAmountLimitDisplay; @@ -324,6 +330,9 @@ abstract class ListItemModel { /// Type of transaction from the opposite party's perspective. final CounterpartyTypeEnum counterpartyType; + /// Indicates if this is block trade advert or not. + final bool blockTrade; + /// Details of the advertiser for this advert. final AdvertiserDetails advertiserDetails; @@ -392,6 +401,7 @@ abstract class ListItemModel { /// - `advertiser_ads_paused`: the advertiser has paused all adverts. /// - `advertiser_approval`: the advertiser's proof of identity is not verified. /// - `advertiser_balance`: the advertiser's P2P balance is less than the minimum order. + /// - `advertiser_block_trade_ineligible`: the advertiser is not currently eligible for block trading. /// - `advertiser_daily_limit`: the advertiser's remaining daily limit is less than the minimum order. /// - `advertiser_temp_ban`: the advertiser is temporarily banned from P2P. final List? visibilityStatus; @@ -401,88 +411,53 @@ abstract class ListItemModel { class ListItem extends ListItemModel { /// Initializes List item class. const ListItem({ - required String accountCurrency, - required AdvertiserDetails advertiserDetails, - required CounterpartyTypeEnum counterpartyType, - required String country, - required DateTime createdTime, - required String description, - required String id, - required bool isActive, - required bool isVisible, - required String localCurrency, - required double maxOrderAmountLimit, - required String maxOrderAmountLimitDisplay, - required double minOrderAmountLimit, - required String minOrderAmountLimitDisplay, - required double rate, - required String rateDisplay, - required RateTypeEnum rateType, - required TypeEnum type, - int? activeOrders, - double? amount, - String? amountDisplay, - String? contactInfo, - int? daysUntilArchive, - double? effectiveRate, - String? effectiveRateDisplay, - double? maxOrderAmount, - String? maxOrderAmountDisplay, - double? minOrderAmount, - String? minOrderAmountDisplay, - String? paymentInfo, - String? paymentMethod, - List? paymentMethodNames, - double? price, - String? priceDisplay, - double? remainingAmount, - String? remainingAmountDisplay, - List? visibilityStatus, - }) : super( - accountCurrency: accountCurrency, - advertiserDetails: advertiserDetails, - counterpartyType: counterpartyType, - country: country, - createdTime: createdTime, - description: description, - id: id, - isActive: isActive, - isVisible: isVisible, - localCurrency: localCurrency, - maxOrderAmountLimit: maxOrderAmountLimit, - maxOrderAmountLimitDisplay: maxOrderAmountLimitDisplay, - minOrderAmountLimit: minOrderAmountLimit, - minOrderAmountLimitDisplay: minOrderAmountLimitDisplay, - rate: rate, - rateDisplay: rateDisplay, - rateType: rateType, - type: type, - activeOrders: activeOrders, - amount: amount, - amountDisplay: amountDisplay, - contactInfo: contactInfo, - daysUntilArchive: daysUntilArchive, - effectiveRate: effectiveRate, - effectiveRateDisplay: effectiveRateDisplay, - maxOrderAmount: maxOrderAmount, - maxOrderAmountDisplay: maxOrderAmountDisplay, - minOrderAmount: minOrderAmount, - minOrderAmountDisplay: minOrderAmountDisplay, - paymentInfo: paymentInfo, - paymentMethod: paymentMethod, - paymentMethodNames: paymentMethodNames, - price: price, - priceDisplay: priceDisplay, - remainingAmount: remainingAmount, - remainingAmountDisplay: remainingAmountDisplay, - visibilityStatus: visibilityStatus, - ); + required super.accountCurrency, + required super.advertiserDetails, + required super.blockTrade, + required super.counterpartyType, + required super.country, + required super.createdTime, + required super.description, + required super.id, + required super.isActive, + required super.isVisible, + required super.localCurrency, + required super.maxOrderAmountLimit, + required super.maxOrderAmountLimitDisplay, + required super.minOrderAmountLimit, + required super.minOrderAmountLimitDisplay, + required super.orderExpiryPeriod, + required super.rate, + required super.rateDisplay, + required super.rateType, + required super.type, + super.activeOrders, + super.amount, + super.amountDisplay, + super.contactInfo, + super.daysUntilArchive, + super.effectiveRate, + super.effectiveRateDisplay, + super.maxOrderAmount, + super.maxOrderAmountDisplay, + super.minOrderAmount, + super.minOrderAmountDisplay, + super.paymentInfo, + super.paymentMethod, + super.paymentMethodNames, + super.price, + super.priceDisplay, + super.remainingAmount, + super.remainingAmountDisplay, + super.visibilityStatus, + }); /// Creates an instance from JSON. factory ListItem.fromJson(Map json) => ListItem( accountCurrency: json['account_currency'], advertiserDetails: AdvertiserDetails.fromJson(json['advertiser_details']), + blockTrade: getBool(json['block_trade'])!, counterpartyType: counterpartyTypeEnumMapper[json['counterparty_type']]!, country: json['country'], @@ -496,6 +471,7 @@ class ListItem extends ListItemModel { maxOrderAmountLimitDisplay: json['max_order_amount_limit_display'], minOrderAmountLimit: getDouble(json['min_order_amount_limit'])!, minOrderAmountLimitDisplay: json['min_order_amount_limit_display'], + orderExpiryPeriod: json['order_expiry_period'], rate: getDouble(json['rate'])!, rateDisplay: json['rate_display'], rateType: rateTypeEnumMapper[json['rate_type']]!, @@ -542,6 +518,7 @@ class ListItem extends ListItemModel { resultMap['account_currency'] = accountCurrency; resultMap['advertiser_details'] = advertiserDetails.toJson(); + resultMap['block_trade'] = blockTrade; resultMap['counterparty_type'] = counterpartyTypeEnumMapper.entries .firstWhere((MapEntry entry) => entry.value == counterpartyType) @@ -557,6 +534,7 @@ class ListItem extends ListItemModel { resultMap['max_order_amount_limit_display'] = maxOrderAmountLimitDisplay; resultMap['min_order_amount_limit'] = minOrderAmountLimit; resultMap['min_order_amount_limit_display'] = minOrderAmountLimitDisplay; + resultMap['order_expiry_period'] = orderExpiryPeriod; resultMap['rate'] = rate; resultMap['rate_display'] = rateDisplay; resultMap['rate_type'] = rateTypeEnumMapper.entries @@ -610,6 +588,7 @@ class ListItem extends ListItemModel { ListItem copyWith({ String? accountCurrency, AdvertiserDetails? advertiserDetails, + bool? blockTrade, CounterpartyTypeEnum? counterpartyType, String? country, DateTime? createdTime, @@ -622,6 +601,7 @@ class ListItem extends ListItemModel { String? maxOrderAmountLimitDisplay, double? minOrderAmountLimit, String? minOrderAmountLimitDisplay, + int? orderExpiryPeriod, double? rate, String? rateDisplay, RateTypeEnum? rateType, @@ -649,6 +629,7 @@ class ListItem extends ListItemModel { ListItem( accountCurrency: accountCurrency ?? this.accountCurrency, advertiserDetails: advertiserDetails ?? this.advertiserDetails, + blockTrade: blockTrade ?? this.blockTrade, counterpartyType: counterpartyType ?? this.counterpartyType, country: country ?? this.country, createdTime: createdTime ?? this.createdTime, @@ -663,6 +644,7 @@ class ListItem extends ListItemModel { minOrderAmountLimit: minOrderAmountLimit ?? this.minOrderAmountLimit, minOrderAmountLimitDisplay: minOrderAmountLimitDisplay ?? this.minOrderAmountLimitDisplay, + orderExpiryPeriod: orderExpiryPeriod ?? this.orderExpiryPeriod, rate: rate ?? this.rate, rateDisplay: rateDisplay ?? this.rateDisplay, rateType: rateType ?? this.rateType, @@ -763,38 +745,22 @@ abstract class AdvertiserDetailsModel { class AdvertiserDetails extends AdvertiserDetailsModel { /// Initializes Advertiser details class. const AdvertiserDetails({ - required int completedOrdersCount, - required String id, - required bool isOnline, - required String name, - required int ratingCount, - String? firstName, - int? isBlocked, - bool? isFavourite, - int? isRecommended, - String? lastName, - DateTime? lastOnlineTime, - double? ratingAverage, - double? recommendedAverage, - double? recommendedCount, - double? totalCompletionRate, - }) : super( - completedOrdersCount: completedOrdersCount, - id: id, - isOnline: isOnline, - name: name, - ratingCount: ratingCount, - firstName: firstName, - isBlocked: isBlocked, - isFavourite: isFavourite, - isRecommended: isRecommended, - lastName: lastName, - lastOnlineTime: lastOnlineTime, - ratingAverage: ratingAverage, - recommendedAverage: recommendedAverage, - recommendedCount: recommendedCount, - totalCompletionRate: totalCompletionRate, - ); + required super.completedOrdersCount, + required super.id, + required super.isOnline, + required super.name, + required super.ratingCount, + super.firstName, + super.isBlocked, + super.isFavourite, + super.isRecommended, + super.lastName, + super.lastOnlineTime, + super.ratingAverage, + super.recommendedAverage, + super.recommendedCount, + super.totalCompletionRate, + }); /// Creates an instance from JSON. factory AdvertiserDetails.fromJson(Map json) => diff --git a/lib/api/response/p2p_advert_update_response_result.dart b/lib/api/response/p2p_advert_update_response_result.dart index 7c0c1ff086..29dda903dd 100644 --- a/lib/api/response/p2p_advert_update_response_result.dart +++ b/lib/api/response/p2p_advert_update_response_result.dart @@ -25,10 +25,8 @@ abstract class P2pAdvertUpdateResponseModel { class P2pAdvertUpdateResponse extends P2pAdvertUpdateResponseModel { /// Initializes P2p advert update response class. const P2pAdvertUpdateResponse({ - P2pAdvertUpdate? p2pAdvertUpdate, - }) : super( - p2pAdvertUpdate: p2pAdvertUpdate, - ); + super.p2pAdvertUpdate, + }); /// Creates an instance from JSON. factory P2pAdvertUpdateResponse.fromJson( @@ -185,6 +183,8 @@ final Map visibilityStatusItemEnumMapper = "advertiser_ads_paused": VisibilityStatusItemEnum.advertiserAdsPaused, "advertiser_approval": VisibilityStatusItemEnum.advertiserApproval, "advertiser_balance": VisibilityStatusItemEnum.advertiserBalance, + "advertiser_block_trade_ineligible": + VisibilityStatusItemEnum.advertiserBlockTradeIneligible, "advertiser_daily_limit": VisibilityStatusItemEnum.advertiserDailyLimit, "advertiser_temp_ban": VisibilityStatusItemEnum.advertiserTempBan, }; @@ -212,13 +212,15 @@ enum VisibilityStatusItemEnum { /// advertiser_balance. advertiserBalance, + /// advertiser_block_trade_ineligible. + advertiserBlockTradeIneligible, + /// advertiser_daily_limit. advertiserDailyLimit, /// advertiser_temp_ban. advertiserTempBan, } - /// P2p advert update model class. abstract class P2pAdvertUpdateModel { /// Initializes P2p advert update model class . @@ -229,6 +231,7 @@ abstract class P2pAdvertUpdateModel { this.advertiserDetails, this.amount, this.amountDisplay, + this.blockTrade, this.contactInfo, this.counterpartyType, this.country, @@ -249,6 +252,7 @@ abstract class P2pAdvertUpdateModel { this.minOrderAmountDisplay, this.minOrderAmountLimit, this.minOrderAmountLimitDisplay, + this.orderExpiryPeriod, this.paymentInfo, this.paymentMethod, this.paymentMethodDetails, @@ -282,6 +286,9 @@ abstract class P2pAdvertUpdateModel { /// The total amount specified in advert, in `account_currency`, formatted to appropriate decimal places. final String? amountDisplay; + /// Indicates if this is block trade advert or not. + final bool? blockTrade; + /// Advertiser contact information. Only applicable for 'sell adverts'. final String? contactInfo; @@ -342,6 +349,9 @@ abstract class P2pAdvertUpdateModel { /// Minimum order amount at this time, in `account_currency`, formatted to appropriate decimal places. final String? minOrderAmountLimitDisplay; + /// Expiry period (seconds) for order created against this ad. + final int? orderExpiryPeriod; + /// Payment instructions. Only applicable for 'sell adverts'. final String? paymentInfo; @@ -386,6 +396,7 @@ abstract class P2pAdvertUpdateModel { /// - `advertiser_ads_paused`: the advertiser has paused all adverts. /// - `advertiser_approval`: the advertiser's proof of identity is not verified. /// - `advertiser_balance`: the advertiser's P2P balance is less than the minimum order. + /// - `advertiser_block_trade_ineligible`: the advertiser is not currently eligible for block trading. /// - `advertiser_daily_limit`: the advertiser's remaining daily limit is less than the minimum order. /// - `advertiser_temp_ban`: the advertiser is temporarily banned from P2P. final List? visibilityStatus; @@ -395,86 +406,48 @@ abstract class P2pAdvertUpdateModel { class P2pAdvertUpdate extends P2pAdvertUpdateModel { /// Initializes P2p advert update class. const P2pAdvertUpdate({ - required String id, - String? accountCurrency, - int? activeOrders, - AdvertiserDetails? advertiserDetails, - double? amount, - String? amountDisplay, - String? contactInfo, - CounterpartyTypeEnum? counterpartyType, - String? country, - DateTime? createdTime, - int? daysUntilArchive, - int? deleted, - String? description, - double? effectiveRate, - String? effectiveRateDisplay, - bool? isActive, - bool? isVisible, - String? localCurrency, - double? maxOrderAmount, - String? maxOrderAmountDisplay, - double? maxOrderAmountLimit, - String? maxOrderAmountLimitDisplay, - double? minOrderAmount, - String? minOrderAmountDisplay, - double? minOrderAmountLimit, - String? minOrderAmountLimitDisplay, - String? paymentInfo, - String? paymentMethod, - Map? paymentMethodDetails, - List? paymentMethodNames, - double? price, - String? priceDisplay, - double? rate, - String? rateDisplay, - RateTypeEnum? rateType, - double? remainingAmount, - String? remainingAmountDisplay, - P2pAdvertUpdateTypeEnum? type, - List? visibilityStatus, - }) : super( - id: id, - accountCurrency: accountCurrency, - activeOrders: activeOrders, - advertiserDetails: advertiserDetails, - amount: amount, - amountDisplay: amountDisplay, - contactInfo: contactInfo, - counterpartyType: counterpartyType, - country: country, - createdTime: createdTime, - daysUntilArchive: daysUntilArchive, - deleted: deleted, - description: description, - effectiveRate: effectiveRate, - effectiveRateDisplay: effectiveRateDisplay, - isActive: isActive, - isVisible: isVisible, - localCurrency: localCurrency, - maxOrderAmount: maxOrderAmount, - maxOrderAmountDisplay: maxOrderAmountDisplay, - maxOrderAmountLimit: maxOrderAmountLimit, - maxOrderAmountLimitDisplay: maxOrderAmountLimitDisplay, - minOrderAmount: minOrderAmount, - minOrderAmountDisplay: minOrderAmountDisplay, - minOrderAmountLimit: minOrderAmountLimit, - minOrderAmountLimitDisplay: minOrderAmountLimitDisplay, - paymentInfo: paymentInfo, - paymentMethod: paymentMethod, - paymentMethodDetails: paymentMethodDetails, - paymentMethodNames: paymentMethodNames, - price: price, - priceDisplay: priceDisplay, - rate: rate, - rateDisplay: rateDisplay, - rateType: rateType, - remainingAmount: remainingAmount, - remainingAmountDisplay: remainingAmountDisplay, - type: type, - visibilityStatus: visibilityStatus, - ); + required super.id, + super.accountCurrency, + super.activeOrders, + super.advertiserDetails, + super.amount, + super.amountDisplay, + super.blockTrade, + super.contactInfo, + super.counterpartyType, + super.country, + super.createdTime, + super.daysUntilArchive, + super.deleted, + super.description, + super.effectiveRate, + super.effectiveRateDisplay, + super.isActive, + super.isVisible, + super.localCurrency, + super.maxOrderAmount, + super.maxOrderAmountDisplay, + super.maxOrderAmountLimit, + super.maxOrderAmountLimitDisplay, + super.minOrderAmount, + super.minOrderAmountDisplay, + super.minOrderAmountLimit, + super.minOrderAmountLimitDisplay, + super.orderExpiryPeriod, + super.paymentInfo, + super.paymentMethod, + super.paymentMethodDetails, + super.paymentMethodNames, + super.price, + super.priceDisplay, + super.rate, + super.rateDisplay, + super.rateType, + super.remainingAmount, + super.remainingAmountDisplay, + super.type, + super.visibilityStatus, + }); /// Creates an instance from JSON. factory P2pAdvertUpdate.fromJson(Map json) => @@ -487,6 +460,7 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { : AdvertiserDetails.fromJson(json['advertiser_details']), amount: getDouble(json['amount']), amountDisplay: json['amount_display'], + blockTrade: getBool(json['block_trade']), contactInfo: json['contact_info'], counterpartyType: json['counterparty_type'] == null ? null @@ -509,6 +483,7 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { minOrderAmountDisplay: json['min_order_amount_display'], minOrderAmountLimit: getDouble(json['min_order_amount_limit']), minOrderAmountLimitDisplay: json['min_order_amount_limit_display'], + orderExpiryPeriod: json['order_expiry_period'], paymentInfo: json['payment_info'], paymentMethod: json['payment_method'], paymentMethodDetails: json['payment_method_details'] == null @@ -564,6 +539,7 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { } resultMap['amount'] = amount; resultMap['amount_display'] = amountDisplay; + resultMap['block_trade'] = blockTrade; resultMap['contact_info'] = contactInfo; resultMap['counterparty_type'] = counterpartyTypeEnumMapper.entries .firstWhere((MapEntry entry) => @@ -587,6 +563,7 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { resultMap['min_order_amount_display'] = minOrderAmountDisplay; resultMap['min_order_amount_limit'] = minOrderAmountLimit; resultMap['min_order_amount_limit_display'] = minOrderAmountLimitDisplay; + resultMap['order_expiry_period'] = orderExpiryPeriod; resultMap['payment_info'] = paymentInfo; resultMap['payment_method'] = paymentMethod; resultMap['payment_method_details'] = paymentMethodDetails; @@ -635,6 +612,7 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { AdvertiserDetails? advertiserDetails, double? amount, String? amountDisplay, + bool? blockTrade, String? contactInfo, CounterpartyTypeEnum? counterpartyType, String? country, @@ -655,6 +633,7 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { String? minOrderAmountDisplay, double? minOrderAmountLimit, String? minOrderAmountLimitDisplay, + int? orderExpiryPeriod, String? paymentInfo, String? paymentMethod, Map? paymentMethodDetails, @@ -676,6 +655,7 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { advertiserDetails: advertiserDetails ?? this.advertiserDetails, amount: amount ?? this.amount, amountDisplay: amountDisplay ?? this.amountDisplay, + blockTrade: blockTrade ?? this.blockTrade, contactInfo: contactInfo ?? this.contactInfo, counterpartyType: counterpartyType ?? this.counterpartyType, country: country ?? this.country, @@ -700,6 +680,7 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { minOrderAmountLimit: minOrderAmountLimit ?? this.minOrderAmountLimit, minOrderAmountLimitDisplay: minOrderAmountLimitDisplay ?? this.minOrderAmountLimitDisplay, + orderExpiryPeriod: orderExpiryPeriod ?? this.orderExpiryPeriod, paymentInfo: paymentInfo ?? this.paymentInfo, paymentMethod: paymentMethod ?? this.paymentMethod, paymentMethodDetails: paymentMethodDetails ?? this.paymentMethodDetails, @@ -716,7 +697,6 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { visibilityStatus: visibilityStatus ?? this.visibilityStatus, ); } - /// Advertiser details model class. abstract class AdvertiserDetailsModel { /// Initializes Advertiser details model class . @@ -776,32 +756,19 @@ abstract class AdvertiserDetailsModel { class AdvertiserDetails extends AdvertiserDetailsModel { /// Initializes Advertiser details class. const AdvertiserDetails({ - required int completedOrdersCount, - required String id, - required bool isOnline, - required String name, - required int ratingCount, - String? firstName, - String? lastName, - DateTime? lastOnlineTime, - double? ratingAverage, - double? recommendedAverage, - int? recommendedCount, - double? totalCompletionRate, - }) : super( - completedOrdersCount: completedOrdersCount, - id: id, - isOnline: isOnline, - name: name, - ratingCount: ratingCount, - firstName: firstName, - lastName: lastName, - lastOnlineTime: lastOnlineTime, - ratingAverage: ratingAverage, - recommendedAverage: recommendedAverage, - recommendedCount: recommendedCount, - totalCompletionRate: totalCompletionRate, - ); + required super.completedOrdersCount, + required super.id, + required super.isOnline, + required super.name, + required super.ratingCount, + super.firstName, + super.lastName, + super.lastOnlineTime, + super.ratingAverage, + super.recommendedAverage, + super.recommendedCount, + super.totalCompletionRate, + }); /// Creates an instance from JSON. factory AdvertiserDetails.fromJson(Map json) => @@ -871,7 +838,6 @@ class AdvertiserDetails extends AdvertiserDetailsModel { totalCompletionRate: totalCompletionRate ?? this.totalCompletionRate, ); } - /// Payment method details property model class. abstract class PaymentMethodDetailsPropertyModel { /// Initializes Payment method details property model class . @@ -911,22 +877,14 @@ abstract class PaymentMethodDetailsPropertyModel { class PaymentMethodDetailsProperty extends PaymentMethodDetailsPropertyModel { /// Initializes Payment method details property class. const PaymentMethodDetailsProperty({ - required Map fields, - required bool isEnabled, - required String method, - required PaymentMethodDetailsPropertyTypeEnum type, - String? displayName, - List? usedByAdverts, - List? usedByOrders, - }) : super( - fields: fields, - isEnabled: isEnabled, - method: method, - type: type, - displayName: displayName, - usedByAdverts: usedByAdverts, - usedByOrders: usedByOrders, - ); + required super.fields, + required super.isEnabled, + required super.method, + required super.type, + super.displayName, + super.usedByAdverts, + super.usedByOrders, + }); /// Creates an instance from JSON. factory PaymentMethodDetailsProperty.fromJson(Map json) => @@ -1008,7 +966,6 @@ class PaymentMethodDetailsProperty extends PaymentMethodDetailsPropertyModel { usedByOrders: usedByOrders ?? this.usedByOrders, ); } - /// Fields property model class. abstract class FieldsPropertyModel { /// Initializes Fields property model class . @@ -1036,16 +993,11 @@ abstract class FieldsPropertyModel { class FieldsProperty extends FieldsPropertyModel { /// Initializes Fields property class. const FieldsProperty({ - required String displayName, - required int required, - required TypeEnum type, - required String value, - }) : super( - displayName: displayName, - required: required, - type: type, - value: value, - ); + required super.displayName, + required super.required, + required super.type, + required super.value, + }); /// Creates an instance from JSON. factory FieldsProperty.fromJson(Map json) => FieldsProperty( diff --git a/lib/api/response/p2p_advertiser_adverts_response_result.dart b/lib/api/response/p2p_advertiser_adverts_response_result.dart index 4830ba2a78..89334957f2 100644 --- a/lib/api/response/p2p_advertiser_adverts_response_result.dart +++ b/lib/api/response/p2p_advertiser_adverts_response_result.dart @@ -25,10 +25,8 @@ abstract class P2pAdvertiserAdvertsResponseModel { class P2pAdvertiserAdvertsResponse extends P2pAdvertiserAdvertsResponseModel { /// Initializes P2p advertiser adverts response class. const P2pAdvertiserAdvertsResponse({ - P2pAdvertiserAdverts? p2pAdvertiserAdverts, - }) : super( - p2pAdvertiserAdverts: p2pAdvertiserAdverts, - ); + super.p2pAdvertiserAdverts, + }); /// Creates an instance from JSON. factory P2pAdvertiserAdvertsResponse.fromJson( @@ -148,6 +146,8 @@ final Map visibilityStatusItemEnumMapper = "advertiser_ads_paused": VisibilityStatusItemEnum.advertiserAdsPaused, "advertiser_approval": VisibilityStatusItemEnum.advertiserApproval, "advertiser_balance": VisibilityStatusItemEnum.advertiserBalance, + "advertiser_block_trade_ineligible": + VisibilityStatusItemEnum.advertiserBlockTradeIneligible, "advertiser_daily_limit": VisibilityStatusItemEnum.advertiserDailyLimit, "advertiser_temp_ban": VisibilityStatusItemEnum.advertiserTempBan, }; @@ -175,13 +175,15 @@ enum VisibilityStatusItemEnum { /// advertiser_balance. advertiserBalance, + /// advertiser_block_trade_ineligible. + advertiserBlockTradeIneligible, + /// advertiser_daily_limit. advertiserDailyLimit, /// advertiser_temp_ban. advertiserTempBan, } - /// P2p advertiser adverts model class. abstract class P2pAdvertiserAdvertsModel { /// Initializes P2p advertiser adverts model class . @@ -197,10 +199,8 @@ abstract class P2pAdvertiserAdvertsModel { class P2pAdvertiserAdverts extends P2pAdvertiserAdvertsModel { /// Initializes P2p advertiser adverts class. const P2pAdvertiserAdverts({ - required List list, - }) : super( - list: list, - ); + required super.list, + }); /// Creates an instance from JSON. factory P2pAdvertiserAdverts.fromJson(Map json) => @@ -233,7 +233,6 @@ class P2pAdvertiserAdverts extends P2pAdvertiserAdvertsModel { list: list ?? this.list, ); } - /// List item model class. abstract class ListItemModel { /// Initializes List item model class . @@ -245,6 +244,7 @@ abstract class ListItemModel { required this.rateDisplay, required this.rate, required this.paymentInfo, + required this.orderExpiryPeriod, required this.minOrderAmountLimitDisplay, required this.minOrderAmountLimit, required this.minOrderAmountDisplay, @@ -262,6 +262,7 @@ abstract class ListItemModel { required this.country, required this.counterpartyType, required this.contactInfo, + required this.blockTrade, required this.amountDisplay, required this.amount, required this.advertiserDetails, @@ -298,6 +299,9 @@ abstract class ListItemModel { /// Payment instructions. Only applicable for 'sell adverts'. final String paymentInfo; + /// Expiry period (seconds) for order created against this ad. + final int orderExpiryPeriod; + /// Minimum order amount at this time, in `account_currency`, formatted to appropriate decimal places. final String minOrderAmountLimitDisplay; @@ -349,6 +353,9 @@ abstract class ListItemModel { /// Advertiser contact information. Only applicable for 'sell adverts'. final String contactInfo; + /// Indicates if this is block trade advert or not. + final bool blockTrade; + /// The total amount specified in advert, in `account_currency`, formatted to appropriate decimal places. final String amountDisplay; @@ -393,6 +400,7 @@ abstract class ListItemModel { /// - `advertiser_ads_paused`: the advertiser has paused all adverts. /// - `advertiser_approval`: the advertiser's proof of identity is not verified. /// - `advertiser_balance`: the advertiser's P2P balance is less than the minimum order. + /// - `advertiser_block_trade_ineligible`: the advertiser is not currently eligible for block trading. /// - `advertiser_daily_limit`: the advertiser's remaining daily limit is less than the minimum order. /// - `advertiser_temp_ban`: the advertiser is temporarily banned from P2P. final List? visibilityStatus; @@ -402,82 +410,46 @@ abstract class ListItemModel { class ListItem extends ListItemModel { /// Initializes List item class. const ListItem({ - required String accountCurrency, - required int activeOrders, - required AdvertiserDetails advertiserDetails, - required double amount, - required String amountDisplay, - required String contactInfo, - required CounterpartyTypeEnum counterpartyType, - required String country, - required DateTime createdTime, - required String description, - required String id, - required bool isActive, - required bool isVisible, - required String localCurrency, - required double maxOrderAmount, - required String maxOrderAmountDisplay, - required double maxOrderAmountLimit, - required String maxOrderAmountLimitDisplay, - required double minOrderAmount, - required String minOrderAmountDisplay, - required double minOrderAmountLimit, - required String minOrderAmountLimitDisplay, - required String paymentInfo, - required double rate, - required String rateDisplay, - required RateTypeEnum rateType, - required double remainingAmount, - required String remainingAmountDisplay, - required TypeEnum type, - int? daysUntilArchive, - double? effectiveRate, - String? effectiveRateDisplay, - String? paymentMethod, - List? paymentMethodNames, - double? price, - String? priceDisplay, - List? visibilityStatus, - }) : super( - accountCurrency: accountCurrency, - activeOrders: activeOrders, - advertiserDetails: advertiserDetails, - amount: amount, - amountDisplay: amountDisplay, - contactInfo: contactInfo, - counterpartyType: counterpartyType, - country: country, - createdTime: createdTime, - description: description, - id: id, - isActive: isActive, - isVisible: isVisible, - localCurrency: localCurrency, - maxOrderAmount: maxOrderAmount, - maxOrderAmountDisplay: maxOrderAmountDisplay, - maxOrderAmountLimit: maxOrderAmountLimit, - maxOrderAmountLimitDisplay: maxOrderAmountLimitDisplay, - minOrderAmount: minOrderAmount, - minOrderAmountDisplay: minOrderAmountDisplay, - minOrderAmountLimit: minOrderAmountLimit, - minOrderAmountLimitDisplay: minOrderAmountLimitDisplay, - paymentInfo: paymentInfo, - rate: rate, - rateDisplay: rateDisplay, - rateType: rateType, - remainingAmount: remainingAmount, - remainingAmountDisplay: remainingAmountDisplay, - type: type, - daysUntilArchive: daysUntilArchive, - effectiveRate: effectiveRate, - effectiveRateDisplay: effectiveRateDisplay, - paymentMethod: paymentMethod, - paymentMethodNames: paymentMethodNames, - price: price, - priceDisplay: priceDisplay, - visibilityStatus: visibilityStatus, - ); + required super.accountCurrency, + required super.activeOrders, + required super.advertiserDetails, + required super.amount, + required super.amountDisplay, + required super.blockTrade, + required super.contactInfo, + required super.counterpartyType, + required super.country, + required super.createdTime, + required super.description, + required super.id, + required super.isActive, + required super.isVisible, + required super.localCurrency, + required super.maxOrderAmount, + required super.maxOrderAmountDisplay, + required super.maxOrderAmountLimit, + required super.maxOrderAmountLimitDisplay, + required super.minOrderAmount, + required super.minOrderAmountDisplay, + required super.minOrderAmountLimit, + required super.minOrderAmountLimitDisplay, + required super.orderExpiryPeriod, + required super.paymentInfo, + required super.rate, + required super.rateDisplay, + required super.rateType, + required super.remainingAmount, + required super.remainingAmountDisplay, + required super.type, + super.daysUntilArchive, + super.effectiveRate, + super.effectiveRateDisplay, + super.paymentMethod, + super.paymentMethodNames, + super.price, + super.priceDisplay, + super.visibilityStatus, + }); /// Creates an instance from JSON. factory ListItem.fromJson(Map json) => ListItem( @@ -487,6 +459,7 @@ class ListItem extends ListItemModel { AdvertiserDetails.fromJson(json['advertiser_details']), amount: getDouble(json['amount'])!, amountDisplay: json['amount_display'], + blockTrade: getBool(json['block_trade'])!, contactInfo: json['contact_info'], counterpartyType: counterpartyTypeEnumMapper[json['counterparty_type']]!, @@ -505,6 +478,7 @@ class ListItem extends ListItemModel { minOrderAmountDisplay: json['min_order_amount_display'], minOrderAmountLimit: getDouble(json['min_order_amount_limit'])!, minOrderAmountLimitDisplay: json['min_order_amount_limit_display'], + orderExpiryPeriod: json['order_expiry_period'], paymentInfo: json['payment_info'], rate: getDouble(json['rate'])!, rateDisplay: json['rate_display'], @@ -546,6 +520,7 @@ class ListItem extends ListItemModel { resultMap['amount'] = amount; resultMap['amount_display'] = amountDisplay; + resultMap['block_trade'] = blockTrade; resultMap['contact_info'] = contactInfo; resultMap['counterparty_type'] = counterpartyTypeEnumMapper.entries .firstWhere((MapEntry entry) => @@ -566,6 +541,7 @@ class ListItem extends ListItemModel { resultMap['min_order_amount_display'] = minOrderAmountDisplay; resultMap['min_order_amount_limit'] = minOrderAmountLimit; resultMap['min_order_amount_limit_display'] = minOrderAmountLimitDisplay; + resultMap['order_expiry_period'] = orderExpiryPeriod; resultMap['payment_info'] = paymentInfo; resultMap['rate'] = rate; resultMap['rate_display'] = rateDisplay; @@ -614,6 +590,7 @@ class ListItem extends ListItemModel { AdvertiserDetails? advertiserDetails, double? amount, String? amountDisplay, + bool? blockTrade, String? contactInfo, CounterpartyTypeEnum? counterpartyType, String? country, @@ -631,6 +608,7 @@ class ListItem extends ListItemModel { String? minOrderAmountDisplay, double? minOrderAmountLimit, String? minOrderAmountLimitDisplay, + int? orderExpiryPeriod, String? paymentInfo, double? rate, String? rateDisplay, @@ -653,6 +631,7 @@ class ListItem extends ListItemModel { advertiserDetails: advertiserDetails ?? this.advertiserDetails, amount: amount ?? this.amount, amountDisplay: amountDisplay ?? this.amountDisplay, + blockTrade: blockTrade ?? this.blockTrade, contactInfo: contactInfo ?? this.contactInfo, counterpartyType: counterpartyType ?? this.counterpartyType, country: country ?? this.country, @@ -674,6 +653,7 @@ class ListItem extends ListItemModel { minOrderAmountLimit: minOrderAmountLimit ?? this.minOrderAmountLimit, minOrderAmountLimitDisplay: minOrderAmountLimitDisplay ?? this.minOrderAmountLimitDisplay, + orderExpiryPeriod: orderExpiryPeriod ?? this.orderExpiryPeriod, paymentInfo: paymentInfo ?? this.paymentInfo, rate: rate ?? this.rate, rateDisplay: rateDisplay ?? this.rateDisplay, @@ -692,7 +672,6 @@ class ListItem extends ListItemModel { visibilityStatus: visibilityStatus ?? this.visibilityStatus, ); } - /// Advertiser details model class. abstract class AdvertiserDetailsModel { /// Initializes Advertiser details model class . @@ -752,32 +731,19 @@ abstract class AdvertiserDetailsModel { class AdvertiserDetails extends AdvertiserDetailsModel { /// Initializes Advertiser details class. const AdvertiserDetails({ - required int completedOrdersCount, - required String id, - required bool isOnline, - required String name, - required int ratingCount, - String? firstName, - String? lastName, - DateTime? lastOnlineTime, - double? ratingAverage, - double? recommendedAverage, - int? recommendedCount, - double? totalCompletionRate, - }) : super( - completedOrdersCount: completedOrdersCount, - id: id, - isOnline: isOnline, - name: name, - ratingCount: ratingCount, - firstName: firstName, - lastName: lastName, - lastOnlineTime: lastOnlineTime, - ratingAverage: ratingAverage, - recommendedAverage: recommendedAverage, - recommendedCount: recommendedCount, - totalCompletionRate: totalCompletionRate, - ); + required super.completedOrdersCount, + required super.id, + required super.isOnline, + required super.name, + required super.ratingCount, + super.firstName, + super.lastName, + super.lastOnlineTime, + super.ratingAverage, + super.recommendedAverage, + super.recommendedCount, + super.totalCompletionRate, + }); /// Creates an instance from JSON. factory AdvertiserDetails.fromJson(Map json) => diff --git a/lib/basic_api/generated/p2p_advert_create_send.dart b/lib/basic_api/generated/p2p_advert_create_send.dart index 09ad0891d8..e3a405655c 100644 --- a/lib/basic_api/generated/p2p_advert_create_send.dart +++ b/lib/basic_api/generated/p2p_advert_create_send.dart @@ -9,11 +9,13 @@ class P2pAdvertCreateRequest extends Request { /// Initialize P2pAdvertCreateRequest. const P2pAdvertCreateRequest({ required this.amount, + this.blockTrade, this.contactInfo, this.description, this.localCurrency, required this.maxOrderAmount, required this.minOrderAmount, + this.orderExpiryPeriod, this.p2pAdvertCreate = true, this.paymentInfo, this.paymentMethod, @@ -22,23 +24,23 @@ class P2pAdvertCreateRequest extends Request { required this.rate, required this.rateType, required this.type, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_advert_create', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_advert_create', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertCreateRequest.fromJson(Map json) => P2pAdvertCreateRequest( amount: json['amount'] as num?, + blockTrade: + json['block_trade'] == null ? null : json['block_trade'] == 1, contactInfo: json['contact_info'] as String?, description: json['description'] as String?, localCurrency: json['local_currency'] as String?, maxOrderAmount: json['max_order_amount'] as num?, minOrderAmount: json['min_order_amount'] as num?, + orderExpiryPeriod: json['order_expiry_period'] as int?, p2pAdvertCreate: json['p2p_advert_create'] == null ? null : json['p2p_advert_create'] == 1, @@ -60,6 +62,9 @@ class P2pAdvertCreateRequest extends Request { /// The total amount of the advert, in advertiser's account currency. final num? amount; + /// [Optional] Indicates if this is block trade ad or not. Default: `false`. + final bool? blockTrade; + /// [Optional] Advertiser contact information. final String? contactInfo; @@ -75,6 +80,9 @@ class P2pAdvertCreateRequest extends Request { /// Minimum allowed amount for the orders of this advert, in advertiser's `account_currency`. Should be less than or equal to `max_order_amount`. final num? minOrderAmount; + /// [Optional] Expiry period (seconds) for order created against this ad. + final int? orderExpiryPeriod; + /// Must be `true` final bool? p2pAdvertCreate; @@ -103,11 +111,17 @@ class P2pAdvertCreateRequest extends Request { @override Map toJson() => { 'amount': amount, + 'block_trade': blockTrade == null + ? null + : blockTrade! + ? 1 + : 0, 'contact_info': contactInfo, 'description': description, 'local_currency': localCurrency, 'max_order_amount': maxOrderAmount, 'min_order_amount': minOrderAmount, + 'order_expiry_period': orderExpiryPeriod, 'p2p_advert_create': p2pAdvertCreate == null ? null : p2pAdvertCreate! @@ -128,11 +142,13 @@ class P2pAdvertCreateRequest extends Request { @override P2pAdvertCreateRequest copyWith({ num? amount, + bool? blockTrade, String? contactInfo, String? description, String? localCurrency, num? maxOrderAmount, num? minOrderAmount, + int? orderExpiryPeriod, bool? p2pAdvertCreate, String? paymentInfo, String? paymentMethod, @@ -146,11 +162,13 @@ class P2pAdvertCreateRequest extends Request { }) => P2pAdvertCreateRequest( amount: amount ?? this.amount, + blockTrade: blockTrade ?? this.blockTrade, contactInfo: contactInfo ?? this.contactInfo, description: description ?? this.description, localCurrency: localCurrency ?? this.localCurrency, maxOrderAmount: maxOrderAmount ?? this.maxOrderAmount, minOrderAmount: minOrderAmount ?? this.minOrderAmount, + orderExpiryPeriod: orderExpiryPeriod ?? this.orderExpiryPeriod, p2pAdvertCreate: p2pAdvertCreate ?? this.p2pAdvertCreate, paymentInfo: paymentInfo ?? this.paymentInfo, paymentMethod: paymentMethod ?? this.paymentMethod, diff --git a/lib/basic_api/generated/p2p_advert_update_send.dart b/lib/basic_api/generated/p2p_advert_update_send.dart index 79859f96d5..586a0f2c91 100644 --- a/lib/basic_api/generated/p2p_advert_update_send.dart +++ b/lib/basic_api/generated/p2p_advert_update_send.dart @@ -16,6 +16,7 @@ class P2pAdvertUpdateRequest extends Request { this.localCurrency, this.maxOrderAmount, this.minOrderAmount, + this.orderExpiryPeriod, this.p2pAdvertUpdate = true, this.paymentInfo, this.paymentMethodIds, @@ -23,13 +24,10 @@ class P2pAdvertUpdateRequest extends Request { this.rate, this.rateType, this.remainingAmount, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_advert_update', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_advert_update', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertUpdateRequest.fromJson(Map json) => @@ -42,6 +40,7 @@ class P2pAdvertUpdateRequest extends Request { localCurrency: json['local_currency'] as String?, maxOrderAmount: json['max_order_amount'] as num?, minOrderAmount: json['min_order_amount'] as num?, + orderExpiryPeriod: json['order_expiry_period'] as int?, p2pAdvertUpdate: json['p2p_advert_update'] == null ? null : json['p2p_advert_update'] == 1, @@ -83,6 +82,9 @@ class P2pAdvertUpdateRequest extends Request { /// [Optional] Minimum allowed amount for the orders of this advert, in advertiser's `account_currency`. Should be less than or equal to `max_order_amount`. final num? minOrderAmount; + /// [Optional] Expiry period (seconds) for order created against this ad. + final int? orderExpiryPeriod; + /// Must be `true` final bool? p2pAdvertUpdate; @@ -123,6 +125,7 @@ class P2pAdvertUpdateRequest extends Request { 'local_currency': localCurrency, 'max_order_amount': maxOrderAmount, 'min_order_amount': minOrderAmount, + 'order_expiry_period': orderExpiryPeriod, 'p2p_advert_update': p2pAdvertUpdate == null ? null : p2pAdvertUpdate! @@ -149,6 +152,7 @@ class P2pAdvertUpdateRequest extends Request { String? localCurrency, num? maxOrderAmount, num? minOrderAmount, + int? orderExpiryPeriod, bool? p2pAdvertUpdate, String? paymentInfo, List? paymentMethodIds, @@ -168,6 +172,7 @@ class P2pAdvertUpdateRequest extends Request { localCurrency: localCurrency ?? this.localCurrency, maxOrderAmount: maxOrderAmount ?? this.maxOrderAmount, minOrderAmount: minOrderAmount ?? this.minOrderAmount, + orderExpiryPeriod: orderExpiryPeriod ?? this.orderExpiryPeriod, p2pAdvertUpdate: p2pAdvertUpdate ?? this.p2pAdvertUpdate, paymentInfo: paymentInfo ?? this.paymentInfo, paymentMethodIds: paymentMethodIds ?? this.paymentMethodIds, diff --git a/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_create_response.dart b/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_create_response.dart index 40ee999f43..96d87a6f4a 100644 --- a/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_create_response.dart +++ b/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_create_response.dart @@ -22,6 +22,7 @@ const String p2pAdvertCreateResponse = ''' }, "amount": 100, "amount_display": "100.00", + "block_trade": 1, "contact_info": "Please transfer to account number 1234", "counterparty_type": "buy", "country": "za", @@ -40,6 +41,7 @@ const String p2pAdvertCreateResponse = ''' "max_order_amount_display": "50.00", "min_order_amount": 20, "min_order_amount_display": "20.00", + "order_expiry_period": 3600, "payment_info": "it is a sell order", "payment_method": "bank_transfer", "price": 2.3, diff --git a/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_list_response.dart b/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_list_response.dart index fe0d70be50..e27468536a 100644 --- a/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_list_response.dart +++ b/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_list_response.dart @@ -17,6 +17,7 @@ const String p2pAdvertListResponse = ''' "rating_count" : 0, "is_online": true }, + "block_trade": 1, "counterparty_type": "sell", "country": "za", "created_time": 1589270475, @@ -29,6 +30,7 @@ const String p2pAdvertListResponse = ''' "max_order_amount_limit_display": "100.00", "min_order_amount_limit": 10, "min_order_amount_limit_display": "10.00", + "order_expiry_period": 3600, "payment_method": "bank_transfer", "price": 14500, "price_display": "14500.00", @@ -47,6 +49,7 @@ const String p2pAdvertListResponse = ''' "rating_count" : 0, "is_online": true }, + "block_trade": 1, "counterparty_type": "sell", "country": "za", "created_time": 1589275813, @@ -59,6 +62,7 @@ const String p2pAdvertListResponse = ''' "max_order_amount_limit_display": "100.00", "min_order_amount_limit": 10, "min_order_amount_limit_display": "10.00", + "order_expiry_period": 3600, "payment_method": "bank_transfer", "price": 14500, "price_display": "14500.00", diff --git a/lib/services/connection/api_manager/mock_data/p2p/p2p_order_create_response.dart b/lib/services/connection/api_manager/mock_data/p2p/p2p_order_create_response.dart index c9b03004fb..3cb9f95062 100644 --- a/lib/services/connection/api_manager/mock_data/p2p/p2p_order_create_response.dart +++ b/lib/services/connection/api_manager/mock_data/p2p/p2p_order_create_response.dart @@ -9,8 +9,10 @@ const String p2pOrderCreateResponse = '''{ "p2p_order_create": { "account_currency": "USD", "advert_details": { + "block_trade": 1, "description": "Please contact via whatsapp 1234", "id": "6", + "order_expiry_period": 3600, "payment_method": "bank_transfer", "type": "sell" }, diff --git a/test/api/p2p/p2p_advert/p2p_advert_test.dart b/test/api/p2p/p2p_advert/p2p_advert_test.dart index 631eaee2b7..a9aad382e3 100644 --- a/test/api/p2p/p2p_advert/p2p_advert_test.dart +++ b/test/api/p2p/p2p_advert/p2p_advert_test.dart @@ -1,5 +1,4 @@ -import 'package:flutter_test/flutter_test.dart'; - +import 'package:deriv_dependency_injector/dependency_injector.dart'; import 'package:flutter_deriv_api/api/api_initializer.dart'; import 'package:flutter_deriv_api/api/response/p2p_advert_create_response_result.dart' as advert_create; @@ -14,9 +13,9 @@ import 'package:flutter_deriv_api/api/response/p2p_order_create_response_result. import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_send.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_info_send.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_send.dart'; -import 'package:flutter_deriv_api/services/connection/api_manager/mock_api.dart'; -import 'package:deriv_dependency_injector/dependency_injector.dart'; import 'package:flutter_deriv_api/helpers/helpers.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/mock_api.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { setUp(() => APIInitializer().initialize(api: MockAPI())); @@ -81,6 +80,8 @@ void main() { 'advertiser CR90000018', ); + expect(adverts.first.blockTrade, true); + expect(adverts.first.orderExpiryPeriod, 3600); expect(adverts.first.counterpartyType, advert_list.CounterpartyTypeEnum.sell); expect(adverts.first.country, 'za'); From 10e56080f5bcfd6862cc121cf3c57933d48f826e Mon Sep 17 00:00:00 2001 From: sahani-deriv <125638269+sahani-deriv@users.noreply.github.com> Date: Wed, 6 Dec 2023 10:23:38 +0800 Subject: [PATCH 19/64] fix: deriv_dependency_injector versioning (#284) From 816783533800ca17daa363de2844c255baa6a7c9 Mon Sep 17 00:00:00 2001 From: akhil-deriv Date: Fri, 8 Dec 2023 14:59:27 +0400 Subject: [PATCH 20/64] added available_accounts API endpoint --- binary-websocket-api | 2 +- example/lib/sample_app.dart | 8 +- .../available_accounts_response_result.dart | 191 ++++++++++++++++++ .../generated/available_accounts_receive.dart | 61 ++++++ .../generated/available_accounts_send.dart | 76 +++++++ .../available_accounts_receive_methods.json | 4 + 6 files changed, 337 insertions(+), 5 deletions(-) create mode 100644 lib/api/response/available_accounts_response_result.dart create mode 100644 lib/basic_api/generated/available_accounts_receive.dart create mode 100644 lib/basic_api/generated/available_accounts_send.dart create mode 100644 lib/basic_api/generated/methods/available_accounts_receive_methods.json diff --git a/binary-websocket-api b/binary-websocket-api index 815af08a17..4a2ead83f9 160000 --- a/binary-websocket-api +++ b/binary-websocket-api @@ -1 +1 @@ -Subproject commit 815af08a17a6f3933923fc45d2f0f125721d57ed +Subproject commit 4a2ead83f9323d0b8bfe762710b2898060a9c98f diff --git a/example/lib/sample_app.dart b/example/lib/sample_app.dart index 19286bf8e3..6308b7081b 100644 --- a/example/lib/sample_app.dart +++ b/example/lib/sample_app.dart @@ -21,10 +21,10 @@ class _SampleAppState extends State { _connectionCubit = api_connection.ConnectionCubit( ConnectionInformation( - appId: '1089', - brand: 'binary', - endpoint: 'frontend.binaryws.com', - ), + appId: '1089', + brand: 'binary', + endpoint: 'frontend.binaryws.com', + authEndpoint: ''), ); } diff --git a/lib/api/response/available_accounts_response_result.dart b/lib/api/response/available_accounts_response_result.dart new file mode 100644 index 0000000000..b02d7c3c86 --- /dev/null +++ b/lib/api/response/available_accounts_response_result.dart @@ -0,0 +1,191 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Available accounts response model class. +abstract class AvailableAccountsResponseModel { + /// Initializes Available accounts response model class . + const AvailableAccountsResponseModel({ + this.availableAccounts, + }); + + /// Returns list of accounts that are available to be created - limited to wallets and can be extended + final AvailableAccounts? availableAccounts; +} + +/// Available accounts response class. +class AvailableAccountsResponse extends AvailableAccountsResponseModel { + /// Initializes Available accounts response class. + const AvailableAccountsResponse({ + super.availableAccounts, + }); + + /// Creates an instance from JSON. + factory AvailableAccountsResponse.fromJson( + dynamic availableAccountsJson, + ) => + AvailableAccountsResponse( + availableAccounts: availableAccountsJson == null + ? null + : AvailableAccounts.fromJson(availableAccountsJson), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (availableAccounts != null) { + resultMap['available_accounts'] = availableAccounts!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + AvailableAccountsResponse copyWith({ + AvailableAccounts? availableAccounts, + }) => + AvailableAccountsResponse( + availableAccounts: availableAccounts ?? this.availableAccounts, + ); +} + +/// AccountTypeEnum mapper. +final Map accountTypeEnumMapper = + { + "doughflow": AccountTypeEnum.doughflow, + "crypto": AccountTypeEnum.crypto, + "paymentagent": AccountTypeEnum.paymentagent, + "paymentagent_client": AccountTypeEnum.paymentagentClient, + "p2p": AccountTypeEnum.p2p, +}; + +/// AccountType Enum. +enum AccountTypeEnum { + /// doughflow. + doughflow, + + /// crypto. + crypto, + + /// paymentagent. + paymentagent, + + /// paymentagent_client. + paymentagentClient, + + /// p2p. + p2p, +} +/// Available accounts model class. +abstract class AvailableAccountsModel { + /// Initializes Available accounts model class . + const AvailableAccountsModel({ + required this.wallets, + }); + + /// Wallet account types that are available to be created + final List wallets; +} + +/// Available accounts class. +class AvailableAccounts extends AvailableAccountsModel { + /// Initializes Available accounts class. + const AvailableAccounts({ + required super.wallets, + }); + + /// Creates an instance from JSON. + factory AvailableAccounts.fromJson(Map json) => + AvailableAccounts( + wallets: List.from( + json['wallets'].map( + (dynamic item) => WalletsItem.fromJson(item), + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['wallets'] = wallets + .map( + (WalletsItem item) => item.toJson(), + ) + .toList(); + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + AvailableAccounts copyWith({ + List? wallets, + }) => + AvailableAccounts( + wallets: wallets ?? this.wallets, + ); +} +/// Wallets item model class. +abstract class WalletsItemModel { + /// Initializes Wallets item model class . + const WalletsItemModel({ + required this.landingCompany, + required this.currency, + required this.accountType, + }); + + /// Landing Company of wallet. + final String landingCompany; + + /// Currency of wallet + final String currency; + + /// Account type of wallet + final AccountTypeEnum accountType; +} + +/// Wallets item class. +class WalletsItem extends WalletsItemModel { + /// Initializes Wallets item class. + const WalletsItem({ + required super.accountType, + required super.currency, + required super.landingCompany, + }); + + /// Creates an instance from JSON. + factory WalletsItem.fromJson(Map json) => WalletsItem( + accountType: accountTypeEnumMapper[json['account_type']]!, + currency: json['currency'], + landingCompany: json['landing_company'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['account_type'] = accountTypeEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == accountType) + .key; + resultMap['currency'] = currency; + resultMap['landing_company'] = landingCompany; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + WalletsItem copyWith({ + AccountTypeEnum? accountType, + String? currency, + String? landingCompany, + }) => + WalletsItem( + accountType: accountType ?? this.accountType, + currency: currency ?? this.currency, + landingCompany: landingCompany ?? this.landingCompany, + ); +} diff --git a/lib/basic_api/generated/available_accounts_receive.dart b/lib/basic_api/generated/available_accounts_receive.dart new file mode 100644 index 0000000000..e0d69942b7 --- /dev/null +++ b/lib/basic_api/generated/available_accounts_receive.dart @@ -0,0 +1,61 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/available_accounts_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Available accounts receive class. +class AvailableAccountsReceive extends Response { + /// Initialize AvailableAccountsReceive. + const AvailableAccountsReceive({ + this.availableAccounts, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory AvailableAccountsReceive.fromJson(Map json) => + AvailableAccountsReceive( + availableAccounts: json['available_accounts'] as Map?, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// Returns list of accounts that are available to be created - limited to wallets and can be extended + final Map? availableAccounts; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'available_accounts': availableAccounts, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + AvailableAccountsReceive copyWith({ + Map? availableAccounts, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + AvailableAccountsReceive( + availableAccounts: availableAccounts ?? this.availableAccounts, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/available_accounts_send.dart b/lib/basic_api/generated/available_accounts_send.dart new file mode 100644 index 0000000000..a1bfe8fc4a --- /dev/null +++ b/lib/basic_api/generated/available_accounts_send.dart @@ -0,0 +1,76 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/available_accounts_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Available accounts request class. +class AvailableAccountsRequest extends Request { + /// Initialize AvailableAccountsRequest. + const AvailableAccountsRequest({ + this.availableAccounts = true, + required this.categories, + this.loginid, + super.msgType = 'available_accounts', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory AvailableAccountsRequest.fromJson(Map json) => + AvailableAccountsRequest( + availableAccounts: json['available_accounts'] == null + ? null + : json['available_accounts'] == 1, + categories: (json['categories'] as List?) + ?.map((dynamic item) => item as String) + .toList(), + loginid: json['loginid'] as String?, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// Must be `true` + final bool? availableAccounts; + + /// List of account categories that needs to received. + final List? categories; + + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'available_accounts': availableAccounts == null + ? null + : availableAccounts! + ? 1 + : 0, + 'categories': categories, + 'loginid': loginid, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + AvailableAccountsRequest copyWith({ + bool? availableAccounts, + List? categories, + String? loginid, + Map? passthrough, + int? reqId, + }) => + AvailableAccountsRequest( + availableAccounts: availableAccounts ?? this.availableAccounts, + categories: categories ?? this.categories, + loginid: loginid ?? this.loginid, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/methods/available_accounts_receive_methods.json b/lib/basic_api/generated/methods/available_accounts_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/available_accounts_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file From a96d28ef287de9fd0ccca20b4612c8694ade7327 Mon Sep 17 00:00:00 2001 From: akhil-deriv Date: Mon, 11 Dec 2023 09:08:48 +0400 Subject: [PATCH 21/64] updated sample app --- example/lib/sample_app.dart | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/example/lib/sample_app.dart b/example/lib/sample_app.dart index 6308b7081b..a3799bfe71 100644 --- a/example/lib/sample_app.dart +++ b/example/lib/sample_app.dart @@ -21,10 +21,11 @@ class _SampleAppState extends State { _connectionCubit = api_connection.ConnectionCubit( ConnectionInformation( - appId: '1089', - brand: 'binary', - endpoint: 'frontend.binaryws.com', - authEndpoint: ''), + appId: '1089', + brand: 'binary', + endpoint: 'frontend.binaryws.com', + authEndpoint: '', + ), ); } From e2c7c76cba9918bcdb22bee2eb88133eec05c78d Mon Sep 17 00:00:00 2001 From: John <139219226+akhil-deriv@users.noreply.github.com> Date: Mon, 11 Dec 2023 12:09:27 +0400 Subject: [PATCH 22/64] Update lib/basic_api/generated/methods/available_accounts_receive_methods.json --- .../generated/methods/available_accounts_receive_methods.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/basic_api/generated/methods/available_accounts_receive_methods.json b/lib/basic_api/generated/methods/available_accounts_receive_methods.json index 76f788430c..640034becf 100644 --- a/lib/basic_api/generated/methods/available_accounts_receive_methods.json +++ b/lib/basic_api/generated/methods/available_accounts_receive_methods.json @@ -1,4 +1,4 @@ { "methods": "", "imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" -} \ No newline at end of file +} From 686a96bb0706fb120bd09da0816b92a348356e95 Mon Sep 17 00:00:00 2001 From: akhil-deriv Date: Wed, 13 Dec 2023 09:19:06 +0400 Subject: [PATCH 23/64] added available accounts response extended --- .../available_accounts_response_extended.dart | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lib/api/response/available_accounts_response_extended.dart diff --git a/lib/api/response/available_accounts_response_extended.dart b/lib/api/response/available_accounts_response_extended.dart new file mode 100644 index 0000000000..ddc494b386 --- /dev/null +++ b/lib/api/response/available_accounts_response_extended.dart @@ -0,0 +1,28 @@ +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/api/response/available_accounts_response_result.dart'; +import 'package:flutter_deriv_api/basic_api/generated/available_accounts_receive.dart'; +import 'package:flutter_deriv_api/basic_api/generated/available_accounts_send.dart'; +import 'package:flutter_deriv_api/helpers/helpers.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; + +/// The extended version of the [AvailableAccountsResponse] class to implement +/// the API call methods. +class AvailableAccountsResponseExtended extends AvailableAccountsResponse { + static final BaseAPI _api = Injector()(); + + /// Fetches the cashier payments. + static Future fetchCashierPayments({ + required AvailableAccountsRequest request, + }) async { + final AvailableAccountsReceive response = await _api.call(request: request); + + checkException( + response: response, + exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => + BaseAPIException(baseExceptionModel: baseExceptionModel), + ); + + return AvailableAccountsResponse.fromJson(response.availableAccounts); + } +} From d1b4762d67be235630dc98e2c2bcaafdf1b9f0b1 Mon Sep 17 00:00:00 2001 From: John <139219226+akhil-deriv@users.noreply.github.com> Date: Wed, 13 Dec 2023 09:21:27 +0400 Subject: [PATCH 24/64] Update lib/api/response/available_accounts_response_extended.dart --- lib/api/response/available_accounts_response_extended.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/api/response/available_accounts_response_extended.dart b/lib/api/response/available_accounts_response_extended.dart index ddc494b386..c961d72e4b 100644 --- a/lib/api/response/available_accounts_response_extended.dart +++ b/lib/api/response/available_accounts_response_extended.dart @@ -12,7 +12,7 @@ class AvailableAccountsResponseExtended extends AvailableAccountsResponse { static final BaseAPI _api = Injector()(); /// Fetches the cashier payments. - static Future fetchCashierPayments({ + static Future fetchAvailableWalletsToCreate({ required AvailableAccountsRequest request, }) async { final AvailableAccountsReceive response = await _api.call(request: request); From 42d1d21f563e4f8873147939c02322d19a299c67 Mon Sep 17 00:00:00 2001 From: John <139219226+akhil-deriv@users.noreply.github.com> Date: Wed, 13 Dec 2023 09:21:57 +0400 Subject: [PATCH 25/64] Update lib/api/response/available_accounts_response_extended.dart --- lib/api/response/available_accounts_response_extended.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/api/response/available_accounts_response_extended.dart b/lib/api/response/available_accounts_response_extended.dart index c961d72e4b..c7faf3c3e8 100644 --- a/lib/api/response/available_accounts_response_extended.dart +++ b/lib/api/response/available_accounts_response_extended.dart @@ -11,7 +11,7 @@ import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart' class AvailableAccountsResponseExtended extends AvailableAccountsResponse { static final BaseAPI _api = Injector()(); - /// Fetches the cashier payments. + /// Fetches the available wallets that can be created static Future fetchAvailableWalletsToCreate({ required AvailableAccountsRequest request, }) async { From df2df687c66c4ca26e8e720b33baf82981ed1381 Mon Sep 17 00:00:00 2001 From: naif-deriv <112558231+naif-deriv@users.noreply.github.com> Date: Tue, 21 Feb 2023 11:14:36 +0400 Subject: [PATCH 26/64] naif/add_dart_new_features_to_code_generator (#244) - add dart new features to the code generator --- api_builder.dart | 41 +++++++++++-------- .../helpers/constructor_helper.dart | 22 +--------- lib/widgets/snack_bar/snack_bar.dart | 2 +- .../top_snack_bar/top_snack_bar.dart | 2 +- .../top_snack_bar/top_snack_bar_widget.dart | 2 +- pubspec.yaml | 14 +++---- 6 files changed, 36 insertions(+), 47 deletions(-) diff --git a/api_builder.dart b/api_builder.dart index 8871a141b5..3c424add6f 100644 --- a/api_builder.dart +++ b/api_builder.dart @@ -122,8 +122,8 @@ class APIBuilder extends Builder { /// Initialize $classFullName. const $classFullName({ ${_getConstructorParameters(methodName, schema, schemaType, properties)} - ${_getSuperClassParameters(schemaType)}, - }): super(${_getSuperClassCallParameters(schemaType, methodName)},); + ${_getSuperClassConstructorParameters(schemaType, methodName)}, + }); ${_getFromJsonMethod(classFullName, schema, schemaType, properties)} @@ -169,6 +169,7 @@ class APIBuilder extends Builder { return '${_isFieldRequired(key, schemaType, property) ? 'required ' : ''} this.${ReCase(key).camelCase}'; }, ).join(', '); + return fields.isEmpty ? result : '$result , '; } @@ -380,6 +381,7 @@ class APIBuilder extends Builder { fields.map( (String key) { final String name = ReCase(key).camelCase; + return '$name: $name ?? this.$name'; }, ).join(', '), @@ -388,40 +390,45 @@ class APIBuilder extends Builder { ..write('${_getSupperClassAssignments(schemaType)},);'); } - static String _getSuperClassParameters(String? schemaType) { + static String _getSuperClassParameters(String schemaType) { final Map superClassFields = _getSuperClassFields(schemaType); - return superClassFields.keys - .map((String key) => - '${typeMap[superClassFields[key]!]} ${ReCase(key).camelCase}') - .join(', '); + final Iterable parameters = superClassFields.keys.map((String key) { + final String type = typeMap[superClassFields[key]!] ?? 'dynamic'; + final String parameterName = ReCase(key).camelCase; + + return '$type $parameterName'; + }); + + return parameters.join(', '); } - static String _getSuperClassCallParameters( + static String _getSuperClassConstructorParameters( String schemaType, String methodName, ) { - final StringBuffer superCallParameters = StringBuffer(); + final Map superClassFields = + _getSuperClassFields(schemaType); + final StringBuffer superClassParameters = StringBuffer(); if (schemaType == 'send') { - superCallParameters.write('msgType: \'$methodName\','); + superClassParameters.write('super.msgType = \'$methodName\', '); } - superCallParameters.write(_getSuperClassFields(schemaType).keys.map( - (String key) { - final String parameterName = ReCase(key).camelCase; - return '$parameterName: $parameterName'; - }, - ).join(', ')); + final Iterable parameters = superClassFields.keys + .map((String key) => 'super.${ReCase(key).camelCase}'); - return superCallParameters.toString(); + superClassParameters.write(parameters.join(', ')); + + return superClassParameters.toString(); } static String _getSupperClassAssignments(String schemaType) => _getSuperClassFields(schemaType).keys.map( (String key) { final String propertyName = ReCase(key).camelCase; + return '$propertyName: $propertyName ?? this.$propertyName'; }, ).join(', '); diff --git a/lib/tools/schema_parser/helpers/constructor_helper.dart b/lib/tools/schema_parser/helpers/constructor_helper.dart index 38842d76de..1346bab9a9 100644 --- a/lib/tools/schema_parser/helpers/constructor_helper.dart +++ b/lib/tools/schema_parser/helpers/constructor_helper.dart @@ -23,32 +23,14 @@ StringBuffer _generateConstructor( } for (final SchemaModel model in children) { - final String typePostfix = model.classType == 'dynamic' - ? '' - : model.isRequired - ? '' - : '?'; - result ..write('${model.isRequired ? 'required' : ''} ') ..write( - isSubclass - ? '${model.classType}$typePostfix ${model.fieldName},' - : 'this.${model.fieldName},', + isSubclass ? 'super.${model.fieldName},' : 'this.${model.fieldName},', ); } - if (isSubclass) { - result.write('}) : super('); - - for (final SchemaModel model in children) { - result.write('${model.fieldName}: ${model.fieldName},'); - } - - result.write(');'); - } else { - result.write('});'); - } + result.write('});'); return result; } diff --git a/lib/widgets/snack_bar/snack_bar.dart b/lib/widgets/snack_bar/snack_bar.dart index 04b1ea6fb8..2e110c84eb 100644 --- a/lib/widgets/snack_bar/snack_bar.dart +++ b/lib/widgets/snack_bar/snack_bar.dart @@ -51,7 +51,7 @@ class SnackBarNotification { /// shows appropriate snack bar based on the [position] specified void show() { - WidgetsBinding.instance!.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) { if (position == SnackBarPosition.bottom) { ScaffoldMessenger.of(context).showSnackBar( _buildSnackBar(), diff --git a/lib/widgets/snack_bar/top_snack_bar/top_snack_bar.dart b/lib/widgets/snack_bar/top_snack_bar/top_snack_bar.dart index 3bbff9f37e..0b9a1e0657 100644 --- a/lib/widgets/snack_bar/top_snack_bar/top_snack_bar.dart +++ b/lib/widgets/snack_bar/top_snack_bar/top_snack_bar.dart @@ -55,7 +55,7 @@ class TopSnackBar { /// Adds [_overlayEntry] to the Overlay void addToOverlay() { - WidgetsBinding.instance!.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) { Overlay.of(context)!.insert(_overlayEntry); snackController.addStatusListener((AnimationStatus status) { if (status == AnimationStatus.dismissed) { diff --git a/lib/widgets/snack_bar/top_snack_bar/top_snack_bar_widget.dart b/lib/widgets/snack_bar/top_snack_bar/top_snack_bar_widget.dart index bef3b82396..7da4440a67 100644 --- a/lib/widgets/snack_bar/top_snack_bar/top_snack_bar_widget.dart +++ b/lib/widgets/snack_bar/top_snack_bar/top_snack_bar_widget.dart @@ -57,7 +57,7 @@ class _TopSnackBarWidgetState extends State { _dismissible = widget.dismissible ?? true; _duration = widget.duration ?? const Duration(seconds: 2); - WidgetsBinding.instance!.addPostFrameCallback((_) => _calculateSizes()); + WidgetsBinding.instance.addPostFrameCallback((_) => _calculateSizes()); widget.snackAnimationController.addListener(() { setState(() {}); diff --git a/pubspec.yaml b/pubspec.yaml index 9fb31c75d3..67aed53900 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,7 +7,7 @@ homepage: https://developers.binary.com publish_to: "none" environment: - sdk: ">=2.12.0 <3.0.0" + sdk: ">=2.17.0 <3.0.0" dependencies: flutter: @@ -19,20 +19,20 @@ dependencies: path: packages/deriv_dependency_injector ref: dev - build: ^2.3.0 + build: ^2.3.1 dart_style: ^2.2.1 equatable: ^2.0.3 flutter_bloc: ^7.0.0 http: ^0.13.4 - intl: ^0.17.0 - meta: ^1.7.0 + intl: ^0.18.0 + meta: ^1.8.0 recase: ^4.0.0 rxdart: ^0.27.4 web_socket_channel: ^2.2.0 - collection: ^1.15.0 + collection: ^1.16.0 device_info: ^2.0.3 package_info: ^2.0.2 - connectivity_plus: 2.3.9 + connectivity_plus: ^3.0.3 dev_dependencies: flutter_test: @@ -41,7 +41,7 @@ dev_dependencies: bloc_test: ^8.0.0 code_builder: ^4.1.0 build_config: ^1.0.0 - build_runner: ^2.1.11 + build_runner: ^2.3.0 build_test: ^2.1.5 json_schema2: ^2.0.2 path: ^1.8.0 From 8ee2f8f002b2b92d2b19dd1850983764c72a2af1 Mon Sep 17 00:00:00 2001 From: sahani-deriv <125638269+sahani-deriv@users.noreply.github.com> Date: Wed, 19 Apr 2023 10:10:27 +0800 Subject: [PATCH 27/64] sahani/upgrade_deriv_api_to_flutter_version_3 (#251) - upgrade deriv api to flutter version 3 --- .../active_symbols/active_symbols_bloc.dart | 59 ++++++++++-------- .../available_contracts_bloc.dart | 61 +++++++++++-------- .../price_proposal/price_proposal_bloc.dart | 41 +++++++------ example/lib/blocs/ticks/ticks_bloc.dart | 39 ++++++------ example/pubspec.yaml | 4 +- lib/api/exceptions/exceptions.dart | 1 - lib/helpers/miscellaneous_helper.dart | 4 +- .../top_snack_bar/top_snack_bar.dart | 2 +- pubspec.yaml | 20 +++--- 9 files changed, 128 insertions(+), 103 deletions(-) diff --git a/example/lib/blocs/active_symbols/active_symbols_bloc.dart b/example/lib/blocs/active_symbols/active_symbols_bloc.dart index 10201adfb5..0375e7f75d 100644 --- a/example/lib/blocs/active_symbols/active_symbols_bloc.dart +++ b/example/lib/blocs/active_symbols/active_symbols_bloc.dart @@ -11,31 +11,40 @@ part 'active_symbols_state.dart'; /// ActiveSymbolsBloc class ActiveSymbolsBloc extends Bloc { /// ActiveSymbolsBloc initializer - ActiveSymbolsBloc() : super(ActiveSymbolsLoading()); - - @override - Stream mapEventToState(ActiveSymbolsEvent event) async* { - if (event is FetchActiveSymbols) { - yield ActiveSymbolsLoading(); - - try { - final ActiveSymbolsResponse symbols = await _fetchActiveSymbols(); - yield ActiveSymbolsLoaded(activeSymbols: symbols.activeSymbols!); - } on ActiveSymbolsException catch (error) { - yield ActiveSymbolsError(error.message); - } - } else if (event is SelectActiveSymbol) { - if (state is ActiveSymbolsLoaded) { - final ActiveSymbolsLoaded loadedState = state as ActiveSymbolsLoaded; - - yield ActiveSymbolsLoaded( - activeSymbols: loadedState.activeSymbols, - selectedSymbol: loadedState.activeSymbols[event.index], - ); - } else { - yield ActiveSymbolsLoading(); - add(FetchActiveSymbols()); - } + ActiveSymbolsBloc() : super(ActiveSymbolsLoading()) { + on( + (FetchActiveSymbols event, Emitter emit) => + _handleFetchActiveSymbols(event, emit)); + + on( + (SelectActiveSymbol event, Emitter emit) => + _handleSelectActiveSymbol(event, emit)); + } + + Future _handleFetchActiveSymbols( + FetchActiveSymbols event, Emitter emit) async { + emit(ActiveSymbolsLoading()); + + try { + final ActiveSymbolsResponse symbols = await _fetchActiveSymbols(); + emit(ActiveSymbolsLoaded(activeSymbols: symbols.activeSymbols!)); + } on ActiveSymbolsException catch (error) { + emit(ActiveSymbolsError(error.message)); + } + } + + Future _handleSelectActiveSymbol( + SelectActiveSymbol event, Emitter emit) async { + if (state is ActiveSymbolsLoaded) { + final ActiveSymbolsLoaded loadedState = state as ActiveSymbolsLoaded; + + emit(ActiveSymbolsLoaded( + activeSymbols: loadedState.activeSymbols, + selectedSymbol: loadedState.activeSymbols[event.index], + )); + } else { + emit(ActiveSymbolsLoading()); + add(FetchActiveSymbols()); } } diff --git a/example/lib/blocs/available_contracts/available_contracts_bloc.dart b/example/lib/blocs/available_contracts/available_contracts_bloc.dart index a9a4dfc211..f9cb225f65 100644 --- a/example/lib/blocs/available_contracts/available_contracts_bloc.dart +++ b/example/lib/blocs/available_contracts/available_contracts_bloc.dart @@ -26,36 +26,47 @@ class AvailableContractsBloc ); } }); + + on((FetchAvailableContracts event, + Emitter emit) => + _handleFetchAvailableContracts(event, emit)); + + on( + (SelectContract event, Emitter emit) => + _handleSelectContract(event, emit)); } - @override - Stream mapEventToState( - AvailableContractsEvent event, - ) async* { - if (event is FetchAvailableContracts) { - yield AvailableContractsLoading(); + Future _handleFetchAvailableContracts( + FetchAvailableContracts event, + Emitter emit, + ) async { + emit(AvailableContractsLoading()); - try { - final ContractsForResponse contracts = - await _fetchAvailableContracts(event.activeSymbol); + try { + final ContractsForResponse contracts = + await _fetchAvailableContracts(event.activeSymbol); - yield AvailableContractsLoaded(contracts: contracts.contractsFor!); - } on ContractsForSymbolException catch (error) { - yield AvailableContractsError(error.message); - } - } else if (event is SelectContract) { - if (state is AvailableContractsLoaded) { - final AvailableContractsLoaded loadedState = - state as AvailableContractsLoaded; + emit(AvailableContractsLoaded(contracts: contracts.contractsFor!)); + } on ContractsForSymbolException catch (error) { + emit(AvailableContractsError(error.message)); + } + } - yield AvailableContractsLoaded( - contracts: loadedState.contracts, - selectedContract: loadedState.contracts.available[event.index], - ); - } else { - yield AvailableContractsLoading(); - add(FetchAvailableContracts()); - } + void _handleSelectContract( + SelectContract event, + Emitter emit, + ) { + if (state is AvailableContractsLoaded) { + final AvailableContractsLoaded loadedState = + state as AvailableContractsLoaded; + + emit(AvailableContractsLoaded( + contracts: loadedState.contracts, + selectedContract: loadedState.contracts.available[event.index], + )); + } else { + emit(AvailableContractsLoading()); + add(FetchAvailableContracts()); } } diff --git a/example/lib/blocs/price_proposal/price_proposal_bloc.dart b/example/lib/blocs/price_proposal/price_proposal_bloc.dart index 60320abc7e..9b57971e76 100644 --- a/example/lib/blocs/price_proposal/price_proposal_bloc.dart +++ b/example/lib/blocs/price_proposal/price_proposal_bloc.dart @@ -22,28 +22,33 @@ class PriceProposalBloc extends Bloc { add(SubscribeProposal(state.selectedContract)); } }); + + on( + (SubscribeProposal event, Emitter emit) => + _handleSubscribeProposal(event, emit)); + + on( + (YieldProposalLoaded event, Emitter emit) => + emit(PriceProposalLoaded(event.proposal.proposal))); + + on((YieldError event, Emitter emit) => + emit(PriceProposalError(event.message))); } - @override - Stream mapEventToState( - PriceProposalEvent event, - ) async* { - if (event is SubscribeProposal) { - yield PriceProposalLoading(); + Future _handleSubscribeProposal( + SubscribeProposal event, + Emitter emit, + ) async { + emit(PriceProposalLoading()); - await _unsubscribeProposal(); + await _unsubscribeProposal(); - _subscribeProposal(event) - .handleError((dynamic error) => error is ContractOperationException - ? add(YieldError(error.message)) - : add(YieldError(error.toString()))) - .listen((ProposalResponse? proposal) => - add(YieldProposalLoaded(proposal!))); - } else if (event is YieldProposalLoaded) { - yield PriceProposalLoaded(event.proposal.proposal); - } else if (event is YieldError) { - yield PriceProposalError(event.message); - } + _subscribeProposal(event) + .handleError((dynamic error) => error is ContractOperationException + ? add(YieldError(error.message)) + : add(YieldError(error.toString()))) + .listen((ProposalResponse? proposal) => + add(YieldProposalLoaded(proposal!))); } Stream _subscribeProposal(SubscribeProposal event) => diff --git a/example/lib/blocs/ticks/ticks_bloc.dart b/example/lib/blocs/ticks/ticks_bloc.dart index 14b4b067da..02a3329701 100644 --- a/example/lib/blocs/ticks/ticks_bloc.dart +++ b/example/lib/blocs/ticks/ticks_bloc.dart @@ -22,27 +22,28 @@ class TicksBloc extends Bloc { add(SubscribeTicks(activeSymbolsState.selectedSymbol)); } }); + + on((SubscribeTicks event, Emitter emit) => + _handleSubscribeTicks(event, emit)); + + on((YieldTick event, Emitter emit) => + emit(TicksLoaded(event.tick?.tick))); + + on((YieldError event, Emitter emit) => + emit(TicksError(event.message))); } - @override - Stream mapEventToState( - TicksEvent event, - ) async* { - if (event is SubscribeTicks) { - yield TicksLoading(); - - await _unsubscribeTick(); - - _subscribeTick(event.selectedSymbol!) - .handleError((dynamic error) => error is TickException - ? add(YieldError(error.message)) - : add(YieldError(error.toString()))) - .listen((TicksResponse? tick) => add(YieldTick(tick))); - } else if (event is YieldTick) { - yield TicksLoaded(event.tick?.tick); - } else if (event is YieldError) { - yield TicksError(event.message); - } + Future _handleSubscribeTicks( + SubscribeTicks event, Emitter emit) async { + emit(TicksLoading()); + + await _unsubscribeTick(); + + _subscribeTick(event.selectedSymbol!) + .handleError((dynamic error) => error is TickException + ? add(YieldError(error.message)) + : add(YieldError(error.toString()))) + .listen((TicksResponse? tick) => add(YieldTick(tick))); } Stream _subscribeTick(ActiveSymbolsItem selectedSymbol) => diff --git a/example/pubspec.yaml b/example/pubspec.yaml index e3f31c3d38..86a830ab48 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -9,8 +9,8 @@ dependencies: flutter: sdk: flutter - rxdart: ^0.27.4 - flutter_bloc: ^7.0.0 + rxdart: ^0.27.7 + flutter_bloc: ^8.1.2 dev_dependencies: flutter_test: diff --git a/lib/api/exceptions/exceptions.dart b/lib/api/exceptions/exceptions.dart index 82d3e82e47..8e452fb9f9 100644 --- a/lib/api/exceptions/exceptions.dart +++ b/lib/api/exceptions/exceptions.dart @@ -24,7 +24,6 @@ export 'landing_company_exception.dart'; export 'mt5_exception.dart'; export 'new_account_exception.dart'; export 'p2p_advert_exception.dart'; -export 'p2p_advert_exception.dart'; export 'p2p_advertiser_exception.dart'; export 'p2p_advertiser_stats_exception.dart'; export 'p2p_chat_exception.dart'; diff --git a/lib/helpers/miscellaneous_helper.dart b/lib/helpers/miscellaneous_helper.dart index ebf571ab18..6d75cf53df 100644 --- a/lib/helpers/miscellaneous_helper.dart +++ b/lib/helpers/miscellaneous_helper.dart @@ -1,12 +1,12 @@ import 'dart:io'; -import 'package:device_info/device_info.dart'; +import 'package:device_info_plus/device_info_plus.dart'; import 'package:flutter_deriv_api/api/exceptions/api_base_exception.dart'; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/basic_api/response.dart'; -import 'package:package_info/package_info.dart'; +import 'package:package_info_plus/package_info_plus.dart'; /// Parses the [url] and gets the endpoint out of it String? parseWebSocketUrl(String? url, {bool isAuthUrl = false}) { diff --git a/lib/widgets/snack_bar/top_snack_bar/top_snack_bar.dart b/lib/widgets/snack_bar/top_snack_bar/top_snack_bar.dart index 0b9a1e0657..cb7baf06a5 100644 --- a/lib/widgets/snack_bar/top_snack_bar/top_snack_bar.dart +++ b/lib/widgets/snack_bar/top_snack_bar/top_snack_bar.dart @@ -56,7 +56,7 @@ class TopSnackBar { /// Adds [_overlayEntry] to the Overlay void addToOverlay() { WidgetsBinding.instance.addPostFrameCallback((_) { - Overlay.of(context)!.insert(_overlayEntry); + Overlay.of(context).insert(_overlayEntry); snackController.addStatusListener((AnimationStatus status) { if (status == AnimationStatus.dismissed) { _overlayEntry.remove(); diff --git a/pubspec.yaml b/pubspec.yaml index 67aed53900..46b2d01023 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,7 +7,8 @@ homepage: https://developers.binary.com publish_to: "none" environment: - sdk: ">=2.17.0 <3.0.0" + sdk: ">=2.19.5 <3.0.0" + flutter: "3.7.8" dependencies: flutter: @@ -20,25 +21,24 @@ dependencies: ref: dev build: ^2.3.1 - dart_style: ^2.2.1 + dart_style: ^2.3.0 equatable: ^2.0.3 - flutter_bloc: ^7.0.0 + flutter_bloc: ^8.1.2 http: ^0.13.4 - intl: ^0.18.0 + intl: ^0.17.0 meta: ^1.8.0 recase: ^4.0.0 - rxdart: ^0.27.4 - web_socket_channel: ^2.2.0 - collection: ^1.16.0 - device_info: ^2.0.3 - package_info: ^2.0.2 + rxdart: ^0.27.7 + web_socket_channel: ^2.3.0 + device_info_plus: ^8.1.0 + package_info_plus: ^3.0.3 connectivity_plus: ^3.0.3 dev_dependencies: flutter_test: sdk: flutter - bloc_test: ^8.0.0 + bloc_test: ^9.1.1 code_builder: ^4.1.0 build_config: ^1.0.0 build_runner: ^2.3.0 From 2ced8249628897b1c6797a489d6ed51c0b35ac86 Mon Sep 17 00:00:00 2001 From: Bassam El Obeid <127500305+bassam-deriv@users.noreply.github.com> Date: Thu, 25 May 2023 06:30:40 +0400 Subject: [PATCH 28/64] bassam/upgrade_to_flutter_3.10.0 (#254) - upgrade to flutter 3.10.0 --- analysis_options.yaml | 7 +++---- api_builder.dart | 2 +- pubspec.yaml | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index b949a79255..b8565f8cb7 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -2,9 +2,9 @@ analyzer: exclude: - lib/basic_api/generated/api.dart - strong-mode: - implicit-dynamic: false - + language: + strict-raw-types: true + errors: todo: ignore missing_required_param: warning @@ -92,7 +92,6 @@ linter: - prefer_const_literals_to_create_immutables - prefer_constructors_over_static_methods - prefer_contains - - prefer_equal_for_default_values - prefer_expression_function_bodies # https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods - prefer_final_fields - prefer_final_in_for_each diff --git a/api_builder.dart b/api_builder.dart index 3c424add6f..d6fe0154b4 100644 --- a/api_builder.dart +++ b/api_builder.dart @@ -465,7 +465,7 @@ class APIBuilder extends Builder { } } -class GeneratedResponseJson extends Comparable { +class GeneratedResponseJson implements Comparable { GeneratedResponseJson({ this.msgType, this.fileName, diff --git a/pubspec.yaml b/pubspec.yaml index 46b2d01023..0c9949dc29 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,8 +7,8 @@ homepage: https://developers.binary.com publish_to: "none" environment: - sdk: ">=2.19.5 <3.0.0" - flutter: "3.7.8" + sdk: ">=3.0.0" + flutter: ">=3.10.0" dependencies: flutter: @@ -25,7 +25,7 @@ dependencies: equatable: ^2.0.3 flutter_bloc: ^8.1.2 http: ^0.13.4 - intl: ^0.17.0 + intl: ^0.18.0 meta: ^1.8.0 recase: ^4.0.0 rxdart: ^0.27.7 From aa703cdbaead0789e23dbfab3a327d3112ddc2ed Mon Sep 17 00:00:00 2001 From: Hamed Rezaee <57184669+hamed-deriv@users.noreply.github.com> Date: Thu, 1 Jun 2023 15:03:25 +0800 Subject: [PATCH 29/64] hamed/update_dependencies (#264) - update dependencies --- example/pubspec.yaml | 3 ++- pubspec.yaml | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 86a830ab48..7839397ea0 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -3,7 +3,8 @@ description: Demonstrates how to use the flutter_deriv_api plugin. publish_to: "none" environment: - sdk: ">=2.12.0 <3.0.0" + sdk: ">=3.0.0" + flutter: "3.10.2" dependencies: flutter: diff --git a/pubspec.yaml b/pubspec.yaml index 0c9949dc29..9612ac8ed5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -8,7 +8,7 @@ publish_to: "none" environment: sdk: ">=3.0.0" - flutter: ">=3.10.0" + flutter: "3.10.2" dependencies: flutter: @@ -18,7 +18,7 @@ dependencies: git: url: git@github.com:regentmarkets/flutter-deriv-packages.git path: packages/deriv_dependency_injector - ref: dev + ref: flutter-version-3 build: ^2.3.1 dart_style: ^2.3.0 From 39f2221b7033c8b3794569782d61adf10e06ffb1 Mon Sep 17 00:00:00 2001 From: sahani-deriv <125638269+sahani-deriv@users.noreply.github.com> Date: Mon, 12 Jun 2023 09:50:21 +0800 Subject: [PATCH 30/64] sahani/ upgrade_kotlin_version (#266) - upgrade kotlin version --- android/build.gradle | 4 ++-- android/gradle/wrapper/gradle-wrapper.properties | 2 +- example/android/app/build.gradle | 2 +- example/android/build.gradle | 6 +++--- example/android/gradle/wrapper/gradle-wrapper.properties | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index a1d9341b0f..aa8bae7a4b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -2,14 +2,14 @@ group 'com.deriv.flutter_deriv_api' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.7.10' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:7.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 019065d1d6..ceccc3a854 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index fad92a4f20..94759d7825 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 28 + compileSdkVersion 33 sourceSets { main.java.srcDirs += 'src/main/kotlin' diff --git a/example/android/build.gradle b/example/android/build.gradle index 3100ad2d55..e0e4f0a765 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.7.10' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:7.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 296b146b73..cfe88f6904 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip From b755d0b61ac78ab26a7de0c309a85b123fabb35a Mon Sep 17 00:00:00 2001 From: Hamed Rezaee <57184669+hamed-deriv@users.noreply.github.com> Date: Thu, 15 Jun 2023 11:35:08 +0800 Subject: [PATCH 31/64] hamed/improve_test_coverage (#265) - improve test coverage --- .../active_symbols/active_symbols_bloc.dart | 2 +- .../available_contracts_bloc.dart | 2 +- .../price_proposal/price_proposal_bloc.dart | 2 +- example/lib/blocs/ticks/ticks_bloc.dart | 2 +- .../account_currency_exception.dart | 11 - lib/api/exceptions/account_exception.dart | 10 - .../exceptions/account_limits_exception.dart | 11 - .../account_settings_exception.dart | 11 - .../exceptions/account_status_exception.dart | 11 - .../exceptions/active_symbols_exception.dart | 11 - lib/api/exceptions/api_token_exception.dart | 11 - lib/api/exceptions/app_exception.dart | 10 - lib/api/exceptions/asset_index_exception.dart | 11 - lib/api/exceptions/authorize_exception.dart | 11 - lib/api/exceptions/balance_exception.dart | 11 - ...exception.dart => base_api_exception.dart} | 12 +- lib/api/exceptions/cashier_exception.dart | 10 - lib/api/exceptions/common_exception.dart | 10 - lib/api/exceptions/contract_exception.dart | 10 - .../contract_for_symbol_exception.dart | 10 - .../contract_operations_exception.dart | 10 - .../exceptions/copy_trading_exception.dart | 11 - lib/api/exceptions/exceptions.dart | 51 +---- lib/api/exceptions/exchange_exception.dart | 11 - .../financial_assessment_exception.dart | 11 - lib/api/exceptions/forget_exception.dart | 11 - .../exceptions/landing_company_exception.dart | 11 - lib/api/exceptions/mt5_exception.dart | 10 - lib/api/exceptions/new_account_exception.dart | 11 - lib/api/exceptions/p2p_advert_exception.dart | 11 - .../exceptions/p2p_advertiser_exception.dart | 11 - .../p2p_advertiser_stats_exception.dart | 11 - lib/api/exceptions/p2p_chat_exception.dart | 11 - lib/api/exceptions/p2p_exception.dart | 10 - lib/api/exceptions/p2p_order_exception.dart | 11 - .../exceptions/payment_agent_exception.dart | 11 - lib/api/exceptions/payment_exception.dart | 11 - .../exceptions/payout_currency_exception.dart | 12 - lib/api/exceptions/ping_exception.dart | 11 - lib/api/exceptions/portfolio_exception.dart | 11 - .../exceptions/profit_table_exception.dart | 11 - .../exceptions/reality_check_exception.dart | 11 - lib/api/exceptions/residence_exception.dart | 11 - .../exceptions/self_exclusion_exception.dart | 11 - lib/api/exceptions/server_time_exception.dart | 11 - lib/api/exceptions/state_exception.dart | 11 - lib/api/exceptions/statement_exception.dart | 11 - lib/api/exceptions/tick_exception.dart | 11 - .../exceptions/top_up_virtual_exception.dart | 11 - lib/api/exceptions/trading_exception.dart | 11 - .../trading_platform_exception.dart | 11 - .../exceptions/transactions_exception.dart | 10 - lib/api/exceptions/transfer_exception.dart | 11 - lib/api/exceptions/user_exception.dart | 10 - .../exceptions/website_status_exception.dart | 11 - lib/api/manually/ohlc_response_result.dart | 4 +- lib/api/manually/tick.dart | 8 +- lib/api/manually/tick_base.dart | 4 +- .../manually/tick_history_subscription.dart | 4 +- .../active_symbols_response_result.dart | 4 +- .../response/api_token_response_result.dart | 8 +- .../response/app_delete_response_result.dart | 4 +- lib/api/response/app_get_response_result.dart | 8 +- .../response/app_list_response_result.dart | 4 +- .../app_markup_details_response_result.dart | 4 +- .../app_register_response_result.dart | 4 +- .../response/app_update_response_result.dart | 4 +- .../response/asset_index_response_result.dart | 4 +- .../response/authorize_response_result.dart | 17 +- lib/api/response/balance_response_result.dart | 16 +- lib/api/response/buy_response_result.dart | 15 +- lib/api/response/cancel_response_result.dart | 4 +- lib/api/response/cashier_response_result.dart | 2 +- ...ntract_update_history_response_result.dart | 4 +- .../contract_update_response_result.dart | 4 +- .../contracts_for_response_result.dart | 4 +- .../response/copy_start_response_result.dart | 4 +- .../response/copy_stop_response_result.dart | 4 +- .../copytrading_list_response_result.dart | 4 +- ...opytrading_statistics_response_result.dart | 4 +- .../exchange_rates_response_result.dart | 6 +- .../response/forget_all_response_result.dart | 4 +- lib/api/response/forget_response_result.dart | 4 +- .../get_account_status_response_result.dart | 6 +- ..._financial_assessment_response_result.dart | 4 +- .../response/get_limits_response_result.dart | 4 +- .../get_self_exclusion_response_result.dart | 12 +- .../get_settings_response_result.dart | 12 +- .../landing_company_response_result.dart | 8 +- .../login_history_response_result.dart | 4 +- lib/api/response/logout_response_result.dart | 6 +- .../response/mt5_deposit_response_result.dart | 4 +- .../mt5_get_settings_response_result.dart | 4 +- .../mt5_login_list_response_result.dart | 4 +- .../mt5_new_account_response_result.dart | 16 +- .../mt5_password_change_response_result.dart | 4 +- .../mt5_password_check_response_result.dart | 4 +- .../mt5_password_reset_response_result.dart | 4 +- .../mt5_withdrawal_response_result.dart | 4 +- .../new_account_real_response_result.dart | 4 +- .../new_account_virtual_response_result.dart | 4 +- .../response/oauth_apps_response_result.dart | 4 +- .../p2p_advert_create_response_result.dart | 8 +- .../p2p_advert_info_response_result.dart | 26 +-- .../p2p_advert_list_response_result.dart | 8 +- .../p2p_advert_update_response_result.dart | 6 +- ...2p_advertiser_adverts_response_result.dart | 2 +- ...p2p_advertiser_create_response_result.dart | 4 +- .../p2p_advertiser_info_response_result.dart | 14 +- .../p2p_advertiser_list_response_result.dart | 2 +- ...tiser_payment_methods_response_result.dart | 6 +- ..._advertiser_relations_response_result.dart | 6 +- ...p2p_advertiser_update_response_result.dart | 2 +- .../p2p_chat_create_response_result.dart | 2 +- .../p2p_order_cancel_response_result.dart | 6 +- .../p2p_order_confirm_response_result.dart | 6 +- .../p2p_order_create_response_result.dart | 8 +- .../p2p_order_dispute_response_result.dart | 6 +- .../p2p_order_info_response_result.dart | 32 +-- .../p2p_order_list_response_result.dart | 10 +- .../p2p_order_review_response_result.dart | 6 +- .../p2p_payment_methods_response_result.dart | 2 +- .../payment_methods_response_result.dart | 4 +- .../paymentagent_list_response_result.dart | 4 +- ...paymentagent_transfer_response_result.dart | 4 +- ...paymentagent_withdraw_response_result.dart | 4 +- .../payout_currencies_response_result.dart | 4 +- lib/api/response/ping_response_result.dart | 6 +- .../response/portfolio_response_result.dart | 4 +- .../profit_table_response_result.dart | 4 +- ...roposal_open_contract_response_result.dart | 21 +- .../response/proposal_response_result.dart | 24 +- .../reality_check_response_result.dart | 4 +- .../reset_password_response_result.dart | 2 +- .../residence_list_response_result.dart | 4 +- .../revoke_oauth_app_response_result.dart | 4 +- lib/api/response/sell_response_result.dart | 8 +- .../service_token_response_result.dart | 6 +- .../set_account_currency_response_result.dart | 4 +- ..._financial_assessment_response_result.dart | 4 +- .../set_self_exclusion_response_result.dart | 4 +- .../set_settings_response_result.dart | 4 +- .../response/statement_response_result.dart | 4 +- .../response/states_list_response_result.dart | 4 +- .../ticks_history_response_result.dart | 10 +- lib/api/response/ticks_response_result.dart | 8 +- lib/api/response/time_response_result.dart | 2 +- .../tnc_approval_response_result.dart | 4 +- .../topup_virtual_response_result.dart | 4 +- .../trading_durations_response_result.dart | 4 +- ...ing_platform_accounts_response_result.dart | 4 +- ...ding_platform_deposit_response_result.dart | 4 +- ..._platform_new_account_response_result.dart | 4 +- .../trading_servers_response_result.dart | 4 +- .../trading_times_response_result.dart | 4 +- .../response/transaction_response_result.dart | 12 +- ...sfer_between_accounts_response_result.dart | 4 +- .../verify_email_response_result.dart | 4 +- .../website_status_response_result.dart | 22 +- .../active_symbols_receive_methods.json | 2 +- .../methods/api_token_receive_methods.json | 2 +- .../methods/app_delete_receive_methods.json | 2 +- .../methods/app_get_receive_methods.json | 2 +- .../methods/app_list_receive_methods.json | 2 +- .../app_markup_details_receive_methods.json | 2 +- .../methods/app_register_receive_methods.json | 2 +- .../methods/app_update_receive_methods.json | 2 +- .../methods/asset_index_receive_methods.json | 2 +- .../methods/authorize_receive_methods.json | 2 +- .../methods/balance_receive_methods.json | 2 +- .../methods/buy_receive_methods.json | 2 +- .../methods/cancel_receive_methods.json | 2 +- .../methods/cashier_receive_methods.json | 2 +- ...ntract_update_history_receive_methods.json | 2 +- .../contract_update_receive_methods.json | 2 +- .../contracts_for_receive_methods.json | 2 +- .../methods/copy_start_receive_methods.json | 2 +- .../methods/copy_stop_receive_methods.json | 2 +- .../copytrading_list_receive_methods.json | 2 +- ...opytrading_statistics_receive_methods.json | 2 +- .../exchange_rates_receive_methods.json | 2 +- .../methods/forget_all_receive_methods.json | 2 +- .../methods/forget_receive_methods.json | 2 +- .../get_account_status_receive_methods.json | 2 +- ..._financial_assessment_receive_methods.json | 2 +- .../methods/get_limits_receive_methods.json | 2 +- .../get_self_exclusion_receive_methods.json | 2 +- .../methods/get_settings_receive_methods.json | 2 +- .../landing_company_receive_methods.json | 2 +- .../login_history_receive_methods.json | 2 +- .../methods/logout_receive_methods.json | 2 +- .../methods/mt5_deposit_receive_methods.json | 2 +- .../mt5_get_settings_receive_methods.json | 2 +- .../mt5_login_list_receive_methods.json | 2 +- .../mt5_new_account_receive_methods.json | 2 +- .../mt5_password_change_receive_methods.json | 2 +- .../mt5_password_check_receive_methods.json | 2 +- .../mt5_password_reset_receive_methods.json | 2 +- .../mt5_withdrawal_receive_methods.json | 2 +- .../new_account_real_receive_methods.json | 2 +- .../new_account_virtual_receive_methods.json | 2 +- .../methods/oauth_apps_receive_methods.json | 2 +- .../p2p_advert_create_receive_methods.json | 2 +- .../p2p_advert_info_receive_methods.json | 2 +- .../p2p_advert_list_receive_methods.json | 2 +- .../p2p_advert_update_receive_methods.json | 2 +- ...2p_advertiser_adverts_receive_methods.json | 2 +- ...p2p_advertiser_create_receive_methods.json | 2 +- .../p2p_advertiser_info_receive_methods.json | 2 +- .../p2p_advertiser_list_receive_methods.json | 2 +- ...tiser_payment_methods_receive_methods.json | 2 +- ..._advertiser_relations_receive_methods.json | 2 +- ...p2p_advertiser_update_receive_methods.json | 2 +- .../p2p_chat_create_receive_methods.json | 2 +- .../p2p_order_cancel_receive_methods.json | 2 +- .../p2p_order_confirm_receive_methods.json | 2 +- .../p2p_order_create_receive_methods.json | 2 +- .../p2p_order_dispute_receive_methods.json | 2 +- .../p2p_order_info_receive_methods.json | 2 +- .../p2p_order_list_receive_methods.json | 2 +- .../p2p_order_review_receive_methods.json | 2 +- .../p2p_payment_methods_receive_methods.json | 2 +- .../payment_methods_receive_methods.json | 2 +- .../paymentagent_list_receive_methods.json | 2 +- ...paymentagent_transfer_receive_methods.json | 2 +- ...paymentagent_withdraw_receive_methods.json | 2 +- .../payout_currencies_receive_methods.json | 2 +- .../methods/ping_receive_methods.json | 2 +- .../methods/portfolio_receive_methods.json | 2 +- .../methods/profit_table_receive_methods.json | 2 +- ...roposal_open_contract_receive_methods.json | 2 +- .../methods/proposal_receive_methods.json | 2 +- .../reality_check_receive_methods.json | 2 +- .../reset_password_receive_methods.json | 2 +- .../residence_list_receive_methods.json | 2 +- .../revoke_oauth_app_receive_methods.json | 2 +- .../methods/sell_receive_methods.json | 2 +- .../service_token_receive_methods.json | 2 +- .../set_account_currency_receive_methods.json | 2 +- ..._financial_assessment_receive_methods.json | 2 +- .../set_self_exclusion_receive_methods.json | 2 +- .../methods/set_settings_receive_methods.json | 2 +- .../methods/statement_receive_methods.json | 2 +- .../methods/states_list_receive_methods.json | 2 +- .../ticks_history_receive_methods.json | 2 +- .../methods/ticks_receive_methods.json | 2 +- .../methods/tnc_approval_receive_methods.json | 2 +- .../topup_virtual_receive_methods.json | 2 +- .../trading_durations_receive_methods.json | 2 +- ...ing_platform_accounts_receive_methods.json | 2 +- ...ding_platform_deposit_receive_methods.json | 2 +- ..._platform_new_account_receive_methods.json | 2 +- .../trading_servers_receive_methods.json | 2 +- .../trading_times_receive_methods.json | 2 +- .../methods/transaction_receive_methods.json | 2 +- ...sfer_between_accounts_receive_methods.json | 2 +- .../methods/verify_email_receive_methods.json | 2 +- .../website_status_receive_methods.json | 2 +- lib/helpers/miscellaneous_helper.dart | 4 +- .../exceptions/api_base_exception_test.dart | 46 ++++ test/helpers/boolean_helper_test.dart | 49 ++++ test/helpers/date_time_helper_test.dart | 120 ++++++++++ test/helpers/enum_helper_test.dart | 208 +++++++++++++++++ test/helpers/map_helper_test.dart | 104 +++++++++ test/helpers/number_helper_test.dart | 212 ++++++++++++++++++ .../api_manager_exception_test.dart | 26 +++ 266 files changed, 1208 insertions(+), 1018 deletions(-) delete mode 100644 lib/api/exceptions/account_currency_exception.dart delete mode 100644 lib/api/exceptions/account_exception.dart delete mode 100644 lib/api/exceptions/account_limits_exception.dart delete mode 100644 lib/api/exceptions/account_settings_exception.dart delete mode 100644 lib/api/exceptions/account_status_exception.dart delete mode 100644 lib/api/exceptions/active_symbols_exception.dart delete mode 100644 lib/api/exceptions/api_token_exception.dart delete mode 100644 lib/api/exceptions/app_exception.dart delete mode 100644 lib/api/exceptions/asset_index_exception.dart delete mode 100644 lib/api/exceptions/authorize_exception.dart delete mode 100644 lib/api/exceptions/balance_exception.dart rename lib/api/exceptions/{api_base_exception.dart => base_api_exception.dart} (73%) delete mode 100644 lib/api/exceptions/cashier_exception.dart delete mode 100644 lib/api/exceptions/common_exception.dart delete mode 100644 lib/api/exceptions/contract_exception.dart delete mode 100644 lib/api/exceptions/contract_for_symbol_exception.dart delete mode 100644 lib/api/exceptions/contract_operations_exception.dart delete mode 100644 lib/api/exceptions/copy_trading_exception.dart delete mode 100644 lib/api/exceptions/exchange_exception.dart delete mode 100644 lib/api/exceptions/financial_assessment_exception.dart delete mode 100644 lib/api/exceptions/forget_exception.dart delete mode 100644 lib/api/exceptions/landing_company_exception.dart delete mode 100644 lib/api/exceptions/mt5_exception.dart delete mode 100644 lib/api/exceptions/new_account_exception.dart delete mode 100644 lib/api/exceptions/p2p_advert_exception.dart delete mode 100644 lib/api/exceptions/p2p_advertiser_exception.dart delete mode 100644 lib/api/exceptions/p2p_advertiser_stats_exception.dart delete mode 100644 lib/api/exceptions/p2p_chat_exception.dart delete mode 100644 lib/api/exceptions/p2p_exception.dart delete mode 100644 lib/api/exceptions/p2p_order_exception.dart delete mode 100644 lib/api/exceptions/payment_agent_exception.dart delete mode 100644 lib/api/exceptions/payment_exception.dart delete mode 100644 lib/api/exceptions/payout_currency_exception.dart delete mode 100644 lib/api/exceptions/ping_exception.dart delete mode 100644 lib/api/exceptions/portfolio_exception.dart delete mode 100644 lib/api/exceptions/profit_table_exception.dart delete mode 100644 lib/api/exceptions/reality_check_exception.dart delete mode 100644 lib/api/exceptions/residence_exception.dart delete mode 100644 lib/api/exceptions/self_exclusion_exception.dart delete mode 100644 lib/api/exceptions/server_time_exception.dart delete mode 100644 lib/api/exceptions/state_exception.dart delete mode 100644 lib/api/exceptions/statement_exception.dart delete mode 100644 lib/api/exceptions/tick_exception.dart delete mode 100644 lib/api/exceptions/top_up_virtual_exception.dart delete mode 100644 lib/api/exceptions/trading_exception.dart delete mode 100644 lib/api/exceptions/trading_platform_exception.dart delete mode 100644 lib/api/exceptions/transactions_exception.dart delete mode 100644 lib/api/exceptions/transfer_exception.dart delete mode 100644 lib/api/exceptions/user_exception.dart delete mode 100644 lib/api/exceptions/website_status_exception.dart create mode 100644 test/api/exceptions/api_base_exception_test.dart create mode 100644 test/helpers/boolean_helper_test.dart create mode 100644 test/helpers/date_time_helper_test.dart create mode 100644 test/helpers/enum_helper_test.dart create mode 100644 test/helpers/map_helper_test.dart create mode 100644 test/helpers/number_helper_test.dart create mode 100644 test/services/connection/api_manager/exceptions/api_manager_exception_test.dart diff --git a/example/lib/blocs/active_symbols/active_symbols_bloc.dart b/example/lib/blocs/active_symbols/active_symbols_bloc.dart index 0375e7f75d..0d28ae0db2 100644 --- a/example/lib/blocs/active_symbols/active_symbols_bloc.dart +++ b/example/lib/blocs/active_symbols/active_symbols_bloc.dart @@ -28,7 +28,7 @@ class ActiveSymbolsBloc extends Bloc { try { final ActiveSymbolsResponse symbols = await _fetchActiveSymbols(); emit(ActiveSymbolsLoaded(activeSymbols: symbols.activeSymbols!)); - } on ActiveSymbolsException catch (error) { + } on BaseAPIException catch (error) { emit(ActiveSymbolsError(error.message)); } } diff --git a/example/lib/blocs/available_contracts/available_contracts_bloc.dart b/example/lib/blocs/available_contracts/available_contracts_bloc.dart index f9cb225f65..47e631784a 100644 --- a/example/lib/blocs/available_contracts/available_contracts_bloc.dart +++ b/example/lib/blocs/available_contracts/available_contracts_bloc.dart @@ -47,7 +47,7 @@ class AvailableContractsBloc await _fetchAvailableContracts(event.activeSymbol); emit(AvailableContractsLoaded(contracts: contracts.contractsFor!)); - } on ContractsForSymbolException catch (error) { + } on BaseAPIException catch (error) { emit(AvailableContractsError(error.message)); } } diff --git a/example/lib/blocs/price_proposal/price_proposal_bloc.dart b/example/lib/blocs/price_proposal/price_proposal_bloc.dart index 9b57971e76..485478b58c 100644 --- a/example/lib/blocs/price_proposal/price_proposal_bloc.dart +++ b/example/lib/blocs/price_proposal/price_proposal_bloc.dart @@ -44,7 +44,7 @@ class PriceProposalBloc extends Bloc { await _unsubscribeProposal(); _subscribeProposal(event) - .handleError((dynamic error) => error is ContractOperationException + .handleError((dynamic error) => error is BaseAPIException ? add(YieldError(error.message)) : add(YieldError(error.toString()))) .listen((ProposalResponse? proposal) => diff --git a/example/lib/blocs/ticks/ticks_bloc.dart b/example/lib/blocs/ticks/ticks_bloc.dart index 02a3329701..742dcdbc06 100644 --- a/example/lib/blocs/ticks/ticks_bloc.dart +++ b/example/lib/blocs/ticks/ticks_bloc.dart @@ -40,7 +40,7 @@ class TicksBloc extends Bloc { await _unsubscribeTick(); _subscribeTick(event.selectedSymbol!) - .handleError((dynamic error) => error is TickException + .handleError((dynamic error) => error is BaseAPIException ? add(YieldError(error.message)) : add(YieldError(error.toString()))) .listen((TicksResponse? tick) => add(YieldTick(tick))); diff --git a/lib/api/exceptions/account_currency_exception.dart b/lib/api/exceptions/account_currency_exception.dart deleted file mode 100644 index db459fb8ee..0000000000 --- a/lib/api/exceptions/account_currency_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Account currency exception class -class AccountCurrencyException extends AccountException { - /// Initializes - AccountCurrencyException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/account_exception.dart b/lib/api/exceptions/account_exception.dart deleted file mode 100644 index 3086fc8bd8..0000000000 --- a/lib/api/exceptions/account_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/api_base_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// Account exception -class AccountException extends APIBaseException { - /// Initializes - AccountException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/account_limits_exception.dart b/lib/api/exceptions/account_limits_exception.dart deleted file mode 100644 index 57d2b5d937..0000000000 --- a/lib/api/exceptions/account_limits_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Account limits exception class -class AccountLimitsException extends AccountException { - /// Initializes - AccountLimitsException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/account_settings_exception.dart b/lib/api/exceptions/account_settings_exception.dart deleted file mode 100644 index 1c889a4d16..0000000000 --- a/lib/api/exceptions/account_settings_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Account settings exception class -class AccountSettingsException extends AccountException { - /// Initializes - AccountSettingsException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/account_status_exception.dart b/lib/api/exceptions/account_status_exception.dart deleted file mode 100644 index 9ef720b435..0000000000 --- a/lib/api/exceptions/account_status_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Exception class for account status calls -class AccountStatusException extends AccountException { - /// Initializes - AccountStatusException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/active_symbols_exception.dart b/lib/api/exceptions/active_symbols_exception.dart deleted file mode 100644 index f2477da035..0000000000 --- a/lib/api/exceptions/active_symbols_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Exception for active symbols request call -class ActiveSymbolsException extends CommonException { - /// Initializes - ActiveSymbolsException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/api_token_exception.dart b/lib/api/exceptions/api_token_exception.dart deleted file mode 100644 index 8798f6c162..0000000000 --- a/lib/api/exceptions/api_token_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Api token exception class -class APITokenException extends AccountException { - /// Initializes - APITokenException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/app_exception.dart b/lib/api/exceptions/app_exception.dart deleted file mode 100644 index 8544e702e4..0000000000 --- a/lib/api/exceptions/app_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/api_base_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// App exception -class AppException extends APIBaseException { - /// Initializes - AppException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/asset_index_exception.dart b/lib/api/exceptions/asset_index_exception.dart deleted file mode 100644 index b274275b31..0000000000 --- a/lib/api/exceptions/asset_index_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Exception class for asset index -class AssetIndexException extends CommonException { - /// Initializes - AssetIndexException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/authorize_exception.dart b/lib/api/exceptions/authorize_exception.dart deleted file mode 100644 index a2f05241f4..0000000000 --- a/lib/api/exceptions/authorize_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Authorize exception class -class AuthorizeException extends AccountException { - /// Initializes - AuthorizeException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/balance_exception.dart b/lib/api/exceptions/balance_exception.dart deleted file mode 100644 index e53535ed79..0000000000 --- a/lib/api/exceptions/balance_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Balance exception class -class BalanceException extends AccountException { - /// Initializes - BalanceException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/api_base_exception.dart b/lib/api/exceptions/base_api_exception.dart similarity index 73% rename from lib/api/exceptions/api_base_exception.dart rename to lib/api/exceptions/base_api_exception.dart index 36f6508ddf..3883ef6e44 100644 --- a/lib/api/exceptions/api_base_exception.dart +++ b/lib/api/exceptions/base_api_exception.dart @@ -3,11 +3,9 @@ import 'dart:developer' as dev; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; /// Base exception class for all API exceptions. -class APIBaseException implements Exception { - /// Initializes - APIBaseException({ - required this.baseExceptionModel, - }); +class BaseAPIException implements Exception { + /// Initializes an exception with the given [baseExceptionModel]. + BaseAPIException({required this.baseExceptionModel}); /// Exception code and message model from API response. final BaseExceptionModel? baseExceptionModel; @@ -23,9 +21,7 @@ class APIBaseException implements Exception { @override String toString() { - dev.log( - '$runtimeType(code: $code, message: $message)', - ); + dev.log('$runtimeType(code: $code, message: $message)'); return message ?? '$runtimeType: API unknown error.'; } diff --git a/lib/api/exceptions/cashier_exception.dart b/lib/api/exceptions/cashier_exception.dart deleted file mode 100644 index 8391a2c276..0000000000 --- a/lib/api/exceptions/cashier_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/api_base_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// Cashier exception -class CashierException extends APIBaseException { - /// Initializes - CashierException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/common_exception.dart b/lib/api/exceptions/common_exception.dart deleted file mode 100644 index 8d73514a82..0000000000 --- a/lib/api/exceptions/common_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/api_base_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// Common exception -class CommonException extends APIBaseException { - /// Initializes - CommonException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/contract_exception.dart b/lib/api/exceptions/contract_exception.dart deleted file mode 100644 index 9e25eb8559..0000000000 --- a/lib/api/exceptions/contract_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/api_base_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// Contract exception class -class ContractException extends APIBaseException { - /// Initializes - ContractException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/contract_for_symbol_exception.dart b/lib/api/exceptions/contract_for_symbol_exception.dart deleted file mode 100644 index d193b58930..0000000000 --- a/lib/api/exceptions/contract_for_symbol_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/contract_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// Exception for contract for symbol request call -class ContractsForSymbolException extends ContractException { - /// Initializes - ContractsForSymbolException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/contract_operations_exception.dart b/lib/api/exceptions/contract_operations_exception.dart deleted file mode 100644 index bdcd3a3285..0000000000 --- a/lib/api/exceptions/contract_operations_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/contract_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// Exception for price proposal request calls -class ContractOperationException extends ContractException { - /// Initializes - ContractOperationException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/copy_trading_exception.dart b/lib/api/exceptions/copy_trading_exception.dart deleted file mode 100644 index 970e2dbb2d..0000000000 --- a/lib/api/exceptions/copy_trading_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Exception for CopyTrading -class CopyTradingException extends AccountException { - /// Initializes - CopyTradingException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/exceptions.dart b/lib/api/exceptions/exceptions.dart index 8e452fb9f9..805351f3c9 100644 --- a/lib/api/exceptions/exceptions.dart +++ b/lib/api/exceptions/exceptions.dart @@ -1,51 +1,2 @@ export '../models/base_exception_model.dart'; -export 'account_currency_exception.dart'; -export 'account_exception.dart'; -export 'account_limits_exception.dart'; -export 'account_settings_exception.dart'; -export 'account_status_exception.dart'; -export 'active_symbols_exception.dart'; -export 'api_base_exception.dart'; -export 'api_token_exception.dart'; -export 'app_exception.dart'; -export 'asset_index_exception.dart'; -export 'authorize_exception.dart'; -export 'balance_exception.dart'; -export 'cashier_exception.dart'; -export 'common_exception.dart'; -export 'contract_exception.dart'; -export 'contract_for_symbol_exception.dart'; -export 'contract_operations_exception.dart'; -export 'copy_trading_exception.dart'; -export 'exchange_exception.dart'; -export 'financial_assessment_exception.dart'; -export 'forget_exception.dart'; -export 'landing_company_exception.dart'; -export 'mt5_exception.dart'; -export 'new_account_exception.dart'; -export 'p2p_advert_exception.dart'; -export 'p2p_advertiser_exception.dart'; -export 'p2p_advertiser_stats_exception.dart'; -export 'p2p_chat_exception.dart'; -export 'p2p_exception.dart'; -export 'p2p_order_exception.dart'; -export 'payment_agent_exception.dart'; -export 'payment_exception.dart'; -export 'payout_currency_exception.dart'; -export 'ping_exception.dart'; -export 'portfolio_exception.dart'; -export 'profit_table_exception.dart'; -export 'reality_check_exception.dart'; -export 'residence_exception.dart'; -export 'self_exclusion_exception.dart'; -export 'server_time_exception.dart'; -export 'state_exception.dart'; -export 'statement_exception.dart'; -export 'tick_exception.dart'; -export 'top_up_virtual_exception.dart'; -export 'trading_exception.dart'; -export 'trading_platform_exception.dart'; -export 'transactions_exception.dart'; -export 'transfer_exception.dart'; -export 'user_exception.dart'; -export 'website_status_exception.dart'; +export 'base_api_exception.dart'; diff --git a/lib/api/exceptions/exchange_exception.dart b/lib/api/exceptions/exchange_exception.dart deleted file mode 100644 index 975800095c..0000000000 --- a/lib/api/exceptions/exchange_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Exchange exception class -class ExchangeException extends CommonException { - /// Initializes - ExchangeException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/financial_assessment_exception.dart b/lib/api/exceptions/financial_assessment_exception.dart deleted file mode 100644 index 256b0fa4e7..0000000000 --- a/lib/api/exceptions/financial_assessment_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'user_exception.dart'; - -/// Financial assessment exception class -class FinancialAssessmentException extends UserException { - /// Initializes - FinancialAssessmentException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/forget_exception.dart b/lib/api/exceptions/forget_exception.dart deleted file mode 100644 index 4f0ee63bb7..0000000000 --- a/lib/api/exceptions/forget_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Forget exception class -class ForgetException extends CommonException { - /// Initializes - ForgetException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/landing_company_exception.dart b/lib/api/exceptions/landing_company_exception.dart deleted file mode 100644 index 3afb5e6b12..0000000000 --- a/lib/api/exceptions/landing_company_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Exception class for Landing company -class LandingCompanyException extends CommonException { - /// Initializes - LandingCompanyException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/mt5_exception.dart b/lib/api/exceptions/mt5_exception.dart deleted file mode 100644 index 0885e8abfd..0000000000 --- a/lib/api/exceptions/mt5_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/api_base_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// MT5 exception class -class MT5Exception extends APIBaseException { - /// Initializes - MT5Exception({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/new_account_exception.dart b/lib/api/exceptions/new_account_exception.dart deleted file mode 100644 index 4fc47a5760..0000000000 --- a/lib/api/exceptions/new_account_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'app_exception.dart'; - -/// New account exception -class NewAccountException extends AppException { - /// Initializes - NewAccountException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/p2p_advert_exception.dart b/lib/api/exceptions/p2p_advert_exception.dart deleted file mode 100644 index 9333868d67..0000000000 --- a/lib/api/exceptions/p2p_advert_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'p2p_exception.dart'; - -/// P2P advert exception class -class P2PAdvertException extends P2PException { - /// Initializes - P2PAdvertException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/p2p_advertiser_exception.dart b/lib/api/exceptions/p2p_advertiser_exception.dart deleted file mode 100644 index 4be8f458dc..0000000000 --- a/lib/api/exceptions/p2p_advertiser_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'p2p_exception.dart'; - -/// P2P advertiser exception class -class P2PAdvertiserException extends P2PException { - /// Initializes - P2PAdvertiserException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/p2p_advertiser_stats_exception.dart b/lib/api/exceptions/p2p_advertiser_stats_exception.dart deleted file mode 100644 index 421d8a8be2..0000000000 --- a/lib/api/exceptions/p2p_advertiser_stats_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'p2p_exception.dart'; - -/// P2P advertiser stats exception class -class P2PAdvertiserStatsException extends P2PException { - /// Initializes - P2PAdvertiserStatsException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/p2p_chat_exception.dart b/lib/api/exceptions/p2p_chat_exception.dart deleted file mode 100644 index 193acebf5e..0000000000 --- a/lib/api/exceptions/p2p_chat_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'p2p_exception.dart'; - -/// P2P chat exception -class P2PChatException extends P2PException { - /// Initializes - P2PChatException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/p2p_exception.dart b/lib/api/exceptions/p2p_exception.dart deleted file mode 100644 index 3f10f0dff0..0000000000 --- a/lib/api/exceptions/p2p_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/api_base_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// P2P exception -class P2PException extends APIBaseException { - /// Initializes - P2PException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/p2p_order_exception.dart b/lib/api/exceptions/p2p_order_exception.dart deleted file mode 100644 index 925a14427d..0000000000 --- a/lib/api/exceptions/p2p_order_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'p2p_exception.dart'; - -/// P2P Order exception class -class P2POrderException extends P2PException { - /// Initializes - P2POrderException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/payment_agent_exception.dart b/lib/api/exceptions/payment_agent_exception.dart deleted file mode 100644 index 7a2bb7ddc0..0000000000 --- a/lib/api/exceptions/payment_agent_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Payment agent exception -class PaymentAgentException extends CommonException { - /// Initializes - PaymentAgentException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/payment_exception.dart b/lib/api/exceptions/payment_exception.dart deleted file mode 100644 index 26e83ba931..0000000000 --- a/lib/api/exceptions/payment_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Payment exception -class PaymentException extends CommonException { - /// Initializes - PaymentException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/payout_currency_exception.dart b/lib/api/exceptions/payout_currency_exception.dart deleted file mode 100644 index ca3c675ba8..0000000000 --- a/lib/api/exceptions/payout_currency_exception.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - - -/// Payout currency exception class -class PayoutCurrencyException extends CommonException { - /// Initializes - PayoutCurrencyException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/ping_exception.dart b/lib/api/exceptions/ping_exception.dart deleted file mode 100644 index 6bdeb9abee..0000000000 --- a/lib/api/exceptions/ping_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Ping exception class -class PingException extends CommonException { - /// Initializes - PingException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/portfolio_exception.dart b/lib/api/exceptions/portfolio_exception.dart deleted file mode 100644 index 08438c5526..0000000000 --- a/lib/api/exceptions/portfolio_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Exception for portfolio -class PortfolioException extends AccountException { - /// Initializes - PortfolioException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/profit_table_exception.dart b/lib/api/exceptions/profit_table_exception.dart deleted file mode 100644 index 9a2053d792..0000000000 --- a/lib/api/exceptions/profit_table_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Profit table exception -class ProfitTableException extends AccountException { - /// Initializes - ProfitTableException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/reality_check_exception.dart b/lib/api/exceptions/reality_check_exception.dart deleted file mode 100644 index e7deb56020..0000000000 --- a/lib/api/exceptions/reality_check_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Reality check exception -class RealityCheckException extends AccountException { - /// Initializes - RealityCheckException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/residence_exception.dart b/lib/api/exceptions/residence_exception.dart deleted file mode 100644 index bc7fabffc0..0000000000 --- a/lib/api/exceptions/residence_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Exception for residence calls -class ResidenceException extends CommonException { - /// Initializes - ResidenceException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/self_exclusion_exception.dart b/lib/api/exceptions/self_exclusion_exception.dart deleted file mode 100644 index 5746024f20..0000000000 --- a/lib/api/exceptions/self_exclusion_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Self exclusion exception -class SelfExclusionException extends AccountException { - /// Initializes - SelfExclusionException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/server_time_exception.dart b/lib/api/exceptions/server_time_exception.dart deleted file mode 100644 index 9ed0d057b0..0000000000 --- a/lib/api/exceptions/server_time_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Server time exception -class ServerTimeException extends CommonException { - /// Initializes - ServerTimeException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/state_exception.dart b/lib/api/exceptions/state_exception.dart deleted file mode 100644 index bd9e767ec8..0000000000 --- a/lib/api/exceptions/state_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Exception for state call -class StateException extends CommonException { - /// Initializes - StateException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/statement_exception.dart b/lib/api/exceptions/statement_exception.dart deleted file mode 100644 index 931df56509..0000000000 --- a/lib/api/exceptions/statement_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Statement exception -class StatementException extends AccountException { - /// Initializes - StatementException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/tick_exception.dart b/lib/api/exceptions/tick_exception.dart deleted file mode 100644 index 6bcfa8a20e..0000000000 --- a/lib/api/exceptions/tick_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Exception class for Tick calls -class TickException extends CommonException { - /// Initializes - TickException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/top_up_virtual_exception.dart b/lib/api/exceptions/top_up_virtual_exception.dart deleted file mode 100644 index 1ae8288bb2..0000000000 --- a/lib/api/exceptions/top_up_virtual_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Top-Up virtual exception class -class TopUpVirtualException extends AccountException { - /// Initializes - TopUpVirtualException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/trading_exception.dart b/lib/api/exceptions/trading_exception.dart deleted file mode 100644 index 4539acb232..0000000000 --- a/lib/api/exceptions/trading_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Trading exception -class TradingException extends CommonException { - /// Initializes - TradingException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/trading_platform_exception.dart b/lib/api/exceptions/trading_platform_exception.dart deleted file mode 100644 index b90f5ef84a..0000000000 --- a/lib/api/exceptions/trading_platform_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'account_exception.dart'; - -/// Trading platform exception class. -class TradingPlatformException extends AccountException { - /// Initializes [TradingPlatformException]. - TradingPlatformException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/transactions_exception.dart b/lib/api/exceptions/transactions_exception.dart deleted file mode 100644 index 0d56f7a8ea..0000000000 --- a/lib/api/exceptions/transactions_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/contract_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// Exceptions for transaction call -class TransactionsException extends ContractException { - /// Initializes - TransactionsException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/transfer_exception.dart b/lib/api/exceptions/transfer_exception.dart deleted file mode 100644 index 5b5ede3fad..0000000000 --- a/lib/api/exceptions/transfer_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'user_exception.dart'; - -/// Transfer exception -class TransferException extends UserException { - /// Initializes - TransferException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/user_exception.dart b/lib/api/exceptions/user_exception.dart deleted file mode 100644 index a097571e89..0000000000 --- a/lib/api/exceptions/user_exception.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter_deriv_api/api/exceptions/api_base_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -/// User exception -class UserException extends APIBaseException { - /// Initializes - UserException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/exceptions/website_status_exception.dart b/lib/api/exceptions/website_status_exception.dart deleted file mode 100644 index 7d27dac6b4..0000000000 --- a/lib/api/exceptions/website_status_exception.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; - -import 'common_exception.dart'; - -/// Exception class for website status -class WebsiteStatusException extends CommonException { - /// Initializes - WebsiteStatusException({ - BaseExceptionModel? baseExceptionModel, - }) : super(baseExceptionModel: baseExceptionModel); -} diff --git a/lib/api/manually/ohlc_response_result.dart b/lib/api/manually/ohlc_response_result.dart index 0d83ea8e19..a1bac6734a 100644 --- a/lib/api/manually/ohlc_response_result.dart +++ b/lib/api/manually/ohlc_response_result.dart @@ -81,7 +81,7 @@ class OHLC extends TickBase { /// Unsubscribes all OHLC. /// - /// Throws a [TickException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future unsubscribeAllOHLC() async { final ForgetAllReceive response = await _api.unsubscribeAll(method: ForgetStreamType.candles); @@ -89,7 +89,7 @@ class OHLC extends TickBase { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TickException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetAllResponse.fromJson(response.forgetAll); diff --git a/lib/api/manually/tick.dart b/lib/api/manually/tick.dart index db92b083ed..f6aa7d3c29 100644 --- a/lib/api/manually/tick.dart +++ b/lib/api/manually/tick.dart @@ -60,7 +60,7 @@ class Tick extends TickBase { /// Subscribes to a tick for given [TickRequest] /// - /// Throws [TickException] if API response contains an error + /// Throws [BaseAPIException] if API response contains an error static Stream subscribeTick( TicksRequest tickRequest, { RequestCompareFunction? comparePredicate, @@ -72,7 +72,7 @@ class Tick extends TickBase { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TickException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is TicksReceive @@ -86,7 +86,7 @@ class Tick extends TickBase { /// Unsubscribes all ticks. /// - /// Throws a [TickException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future unsubscribeAllTicks() async { final ForgetAllReceive response = await _api.unsubscribeAll(method: ForgetStreamType.ticks); @@ -94,7 +94,7 @@ class Tick extends TickBase { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TickException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetAllResponse.fromJson(response); diff --git a/lib/api/manually/tick_base.dart b/lib/api/manually/tick_base.dart index 930e1a540a..3e30f9a367 100644 --- a/lib/api/manually/tick_base.dart +++ b/lib/api/manually/tick_base.dart @@ -68,7 +68,7 @@ class TickBase extends TickBaseModel { /// Unsubscribes from tick stream /// - /// Throws a [TickException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future unsubscribe() async { if (subscriptionInformation?.id == null) { return null; @@ -80,7 +80,7 @@ class TickBase extends TickBaseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TickException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetResponse.fromJson(response.forget); diff --git a/lib/api/manually/tick_history_subscription.dart b/lib/api/manually/tick_history_subscription.dart index 84476bc2d7..4ca904928c 100644 --- a/lib/api/manually/tick_history_subscription.dart +++ b/lib/api/manually/tick_history_subscription.dart @@ -23,7 +23,7 @@ class TickHistorySubscription { /// Unsubscribes from tick history stream /// - /// Throws a [TickException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future unsubscribe() async { if (tickHistory?.subscription == null) { return null; @@ -36,7 +36,7 @@ class TickHistorySubscription { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TickException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetResponse.fromJson(response.forget); diff --git a/lib/api/response/active_symbols_response_result.dart b/lib/api/response/active_symbols_response_result.dart index 08fd25d55f..d646bdf460 100644 --- a/lib/api/response/active_symbols_response_result.dart +++ b/lib/api/response/active_symbols_response_result.dart @@ -63,7 +63,7 @@ class ActiveSymbolsResponse extends ActiveSymbolsResponseModel { /// Gets the list of active symbols. /// /// For parameters information refer to [ActiveSymbolsRequest]. - /// Throws an [ActiveSymbolsException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future fetchActiveSymbols( ActiveSymbolsRequest request, ) async { @@ -74,7 +74,7 @@ class ActiveSymbolsResponse extends ActiveSymbolsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ActiveSymbolsException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ActiveSymbolsResponse.fromJson(response.activeSymbols); diff --git a/lib/api/response/api_token_response_result.dart b/lib/api/response/api_token_response_result.dart index 58ed812c6d..9a665700e3 100644 --- a/lib/api/response/api_token_response_result.dart +++ b/lib/api/response/api_token_response_result.dart @@ -56,7 +56,7 @@ class ApiTokenResponse extends ApiTokenResponseModel { /// [scopes] is a list of permission scopes to provide with the token. /// [validForCurrentIPOnly] is optional and if you set this parameter during token creation, /// then the token created will only work for the IP address that was used to create the token - /// Throws an [APITokenException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future create({ required String name, required List scopes, @@ -73,7 +73,7 @@ class ApiTokenResponse extends ApiTokenResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - APITokenException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ApiTokenResponse.fromJson(response.apiToken); @@ -81,7 +81,7 @@ class ApiTokenResponse extends ApiTokenResponseModel { /// Deletes the [token] /// - /// Throws an [APITokenException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future delete({ required String token, }) async { @@ -92,7 +92,7 @@ class ApiTokenResponse extends ApiTokenResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - APITokenException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ApiTokenResponse.fromJson(response.apiToken); diff --git a/lib/api/response/app_delete_response_result.dart b/lib/api/response/app_delete_response_result.dart index 3ddbcf61b7..c5945ec156 100644 --- a/lib/api/response/app_delete_response_result.dart +++ b/lib/api/response/app_delete_response_result.dart @@ -51,7 +51,7 @@ class AppDeleteResponse extends AppDeleteResponseModel { /// Deletes the application by appId specified in [AppDeleteRequest.appDelete]. /// /// For parameters information refer to [AppDeleteRequest]. - /// Throws an [AppException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future deleteApplication( AppDeleteRequest request) async { final AppDeleteReceive response = await _api.call(request: request); @@ -59,7 +59,7 @@ class AppDeleteResponse extends AppDeleteResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AppException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return AppDeleteResponse.fromJson(response.appDelete); diff --git a/lib/api/response/app_get_response_result.dart b/lib/api/response/app_get_response_result.dart index a54dd01b45..a914b47eb2 100644 --- a/lib/api/response/app_get_response_result.dart +++ b/lib/api/response/app_get_response_result.dart @@ -66,7 +66,7 @@ class AppGetResponse extends AppGetResponseModel { /// Gets the information of the OAuth application specified by [appId] in [request] /// /// For parameters information refer to [AppGetRequest]. - /// Throws an [AppException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future fetchApplicationDetails( AppGetRequest request, ) async { @@ -75,7 +75,7 @@ class AppGetResponse extends AppGetResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AppException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return AppGetResponse.fromJson(response.appGet); @@ -84,7 +84,7 @@ class AppGetResponse extends AppGetResponseModel { /// Gets all of the account's OAuth applications. /// /// For parameters information refer to [AppListRequest]. - /// Throws an [AppException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future?> fetchApplicationList( AppListRequest request, ) async { @@ -93,7 +93,7 @@ class AppGetResponse extends AppGetResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AppException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return getListFromMap( diff --git a/lib/api/response/app_list_response_result.dart b/lib/api/response/app_list_response_result.dart index c2b93a1b6b..7cb8fbe1b5 100644 --- a/lib/api/response/app_list_response_result.dart +++ b/lib/api/response/app_list_response_result.dart @@ -64,7 +64,7 @@ class AppListResponse extends AppListResponseModel { /// Gets all of the account's OAuth applications. /// /// For parameters information refer to [AppListRequest]. - /// Throws an [AppException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future fetchApplicationList( AppListRequest request, ) async { @@ -73,7 +73,7 @@ class AppListResponse extends AppListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AppException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return AppListResponse.fromJson(response.appList); diff --git a/lib/api/response/app_markup_details_response_result.dart b/lib/api/response/app_markup_details_response_result.dart index bfb45c2864..3e7075aa59 100644 --- a/lib/api/response/app_markup_details_response_result.dart +++ b/lib/api/response/app_markup_details_response_result.dart @@ -55,7 +55,7 @@ class AppMarkupDetailsResponse extends AppMarkupDetailsResponseModel { /// Retrieve details of app markup according to criteria specified. /// /// For parameters information refer to [AppMarkupDetailsRequest]. - /// Throws an [AppException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future fetchApplicationMarkupDetails( AppMarkupDetailsRequest request, ) async { @@ -64,7 +64,7 @@ class AppMarkupDetailsResponse extends AppMarkupDetailsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AppException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return AppMarkupDetailsResponse.fromJson(response.appMarkupDetails); diff --git a/lib/api/response/app_register_response_result.dart b/lib/api/response/app_register_response_result.dart index d1d5b2f837..082f4616cb 100644 --- a/lib/api/response/app_register_response_result.dart +++ b/lib/api/response/app_register_response_result.dart @@ -56,7 +56,7 @@ class AppRegisterResponse extends AppRegisterResponseModel { /// Registers a new OAuth application. /// /// For parameters information refer to [AppRegisterRequest]. - /// Throws an [AppException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future registerApplication( AppRegisterRequest request, ) async { @@ -65,7 +65,7 @@ class AppRegisterResponse extends AppRegisterResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AppException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return AppRegisterResponse.fromJson(response.appRegister); diff --git a/lib/api/response/app_update_response_result.dart b/lib/api/response/app_update_response_result.dart index 439871bffa..158ca4dcd9 100644 --- a/lib/api/response/app_update_response_result.dart +++ b/lib/api/response/app_update_response_result.dart @@ -55,7 +55,7 @@ class AppUpdateResponse extends AppUpdateResponseModel { /// Updates the application specified in [request]. /// /// For parameters information refer to [AppUpdateRequest]. - /// Throws an [AppException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future updateApplication( AppUpdateRequest request) async { final AppUpdateReceive response = await _api.call(request: request); @@ -63,7 +63,7 @@ class AppUpdateResponse extends AppUpdateResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AppException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return AppUpdateResponse.fromJson(response.appUpdate); diff --git a/lib/api/response/asset_index_response_result.dart b/lib/api/response/asset_index_response_result.dart index 31c8c16276..3747bd71b2 100644 --- a/lib/api/response/asset_index_response_result.dart +++ b/lib/api/response/asset_index_response_result.dart @@ -64,7 +64,7 @@ class AssetIndexResponse extends AssetIndexResponseModel { /// Retrieves a list of all available underlyings and the corresponding contract types and duration boundaries. /// /// If the user is logged in, only the assets available for that user's landing company will be returned. - /// Throws an [AssetIndexException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future fetchAssetIndices( AssetIndexRequest request, ) async { @@ -75,7 +75,7 @@ class AssetIndexResponse extends AssetIndexResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AssetIndexException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return AssetIndexResponse.fromJson(response.assetIndex); diff --git a/lib/api/response/authorize_response_result.dart b/lib/api/response/authorize_response_result.dart index d73633e0b0..9e844223e2 100644 --- a/lib/api/response/authorize_response_result.dart +++ b/lib/api/response/authorize_response_result.dart @@ -55,7 +55,7 @@ class AuthorizeResponse extends AuthorizeResponseModel { /// Authorizes current WebSocket session to act on behalf of the owner of a given token. /// /// For parameters information refer to [AuthorizeRequest]. - /// Throws an [AuthorizeException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future authorizeMethodRaw( AuthorizeRequest request, ) async { @@ -66,7 +66,7 @@ class AuthorizeResponse extends AuthorizeResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AuthorizeException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -75,7 +75,7 @@ class AuthorizeResponse extends AuthorizeResponseModel { /// Authorizes current WebSocket session to act on behalf of the owner of a given token. /// /// For parameters information refer to [AuthorizeRequest]. - /// Throws an [AuthorizeException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future authorizeMethod( AuthorizeRequest request, ) async { @@ -111,6 +111,7 @@ enum PlatformEnum { /// mt5. mt5, } + /// Authorize model class. abstract class AuthorizeModel { /// Initializes Authorize model class . @@ -368,6 +369,7 @@ class Authorize extends AuthorizeModel { wallet: wallet ?? this.wallet, ); } + /// Account list item model class. abstract class AccountListItemModel { /// Initializes Account list item model class . @@ -506,6 +508,7 @@ class AccountListItem extends AccountListItemModel { wallet: wallet ?? this.wallet, ); } + /// Trading model class. abstract class TradingModel { /// Initializes Trading model class . @@ -560,6 +563,7 @@ class Trading extends TradingModel { linkedTo: linkedTo ?? this.linkedTo, ); } + /// Linked to item model class. abstract class LinkedToItemModel { /// Initializes Linked to item model class . @@ -632,6 +636,7 @@ class LinkedToItem extends LinkedToItemModel { paymentMethod: paymentMethod ?? this.paymentMethod, ); } + /// Wallet model class. abstract class WalletModel { /// Initializes Wallet model class . @@ -726,6 +731,7 @@ class Wallet extends WalletModel { paymentMethod: paymentMethod ?? this.paymentMethod, ); } + /// Wallet linked to item model class. abstract class WalletLinkedToItemModel { /// Initializes Wallet linked to item model class . @@ -804,6 +810,7 @@ class WalletLinkedToItem extends WalletLinkedToItemModel { platform: platform ?? this.platform, ); } + /// Local currencies property model class. abstract class LocalCurrenciesPropertyModel { /// Initializes Local currencies property model class . @@ -847,6 +854,7 @@ class LocalCurrenciesProperty extends LocalCurrenciesPropertyModel { fractionalDigits: fractionalDigits ?? this.fractionalDigits, ); } + /// Authorize trading model class. abstract class AuthorizeTradingModel { /// Initializes Authorize trading model class . @@ -902,6 +910,7 @@ class AuthorizeTrading extends AuthorizeTradingModel { linkedTo: linkedTo ?? this.linkedTo, ); } + /// Trading linked to item model class. abstract class TradingLinkedToItemModel { /// Initializes Trading linked to item model class . @@ -975,6 +984,7 @@ class TradingLinkedToItem extends TradingLinkedToItemModel { paymentMethod: paymentMethod ?? this.paymentMethod, ); } + /// Authorize wallet model class. abstract class AuthorizeWalletModel { /// Initializes Authorize wallet model class . @@ -1070,6 +1080,7 @@ class AuthorizeWallet extends AuthorizeWalletModel { paymentMethod: paymentMethod ?? this.paymentMethod, ); } + /// Wallet linked to item8 model class. abstract class WalletLinkedToItem8Model { /// Initializes Wallet linked to item8 model class . diff --git a/lib/api/response/balance_response_result.dart b/lib/api/response/balance_response_result.dart index 383ea43793..1ad7a4bf56 100644 --- a/lib/api/response/balance_response_result.dart +++ b/lib/api/response/balance_response_result.dart @@ -74,14 +74,14 @@ class BalanceResponse extends BalanceResponseModel { /// Gets the balance of account /// /// For parameters info refer to [BalanceRequest] - /// Throws a [BalanceException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchBalance(BalanceRequest request) async { final BalanceReceive response = await _api.call(request: request); checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - BalanceException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return BalanceResponse.fromJson(response.balance, response.subscription); @@ -89,7 +89,7 @@ class BalanceResponse extends BalanceResponseModel { /// Instead of one call [Balance.fetchBalance] gets stream of [Balance] /// - /// Throws a [BalanceException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Stream subscribeBalance( BalanceRequest request, { RequestCompareFunction? comparePredicate, @@ -100,7 +100,7 @@ class BalanceResponse extends BalanceResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - BalanceException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is BalanceReceive @@ -113,7 +113,7 @@ class BalanceResponse extends BalanceResponseModel { /// Unsubscribes from balance subscription. /// - /// Throws a [BalanceException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future unsubscribeBalance() async { if (subscription == null) { return null; @@ -125,7 +125,7 @@ class BalanceResponse extends BalanceResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - BalanceException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetResponse.fromJson(response.forget); @@ -133,7 +133,7 @@ class BalanceResponse extends BalanceResponseModel { /// Unsubscribes all balance subscriptions. /// - /// Throws a [BalanceException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future unsubscribeAllBalance() async { final ForgetAllReceive response = await _api.unsubscribeAll(method: ForgetStreamType.balance); @@ -141,7 +141,7 @@ class BalanceResponse extends BalanceResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - BalanceException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetAllResponse.fromJson(response.forgetAll); diff --git a/lib/api/response/buy_response_result.dart b/lib/api/response/buy_response_result.dart index 6045a80247..77d11d7a7e 100644 --- a/lib/api/response/buy_response_result.dart +++ b/lib/api/response/buy_response_result.dart @@ -73,7 +73,7 @@ class BuyResponse extends BuyResponseModel { /// Buys a contract with parameters specified in given [BuyRequest] /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future buyMethod(BuyRequest request) async { final BuyReceive response = await _api.call( request: request, @@ -82,7 +82,7 @@ class BuyResponse extends BuyResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return BuyResponse.fromJson(response.buy, response.subscription); @@ -90,7 +90,7 @@ class BuyResponse extends BuyResponseModel { /// Buys contract with parameters specified in request and subscribes to it. /// - /// Throws a [ContractOperationException] is API response contains an error + /// Throws a [BaseAPIException] is API response contains an error static Stream buyAndSubscribe( BuyRequest request, { RequestCompareFunction? comparePredicate, @@ -102,8 +102,7 @@ class BuyResponse extends BuyResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException( - baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is ProposalOpenContractReceive ? ProposalOpenContractResponse.fromJson( @@ -116,7 +115,7 @@ class BuyResponse extends BuyResponseModel { /// Gets the current spot of the this bought contract as [Contract]. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future fetchState() => ProposalOpenContractResponse.fetchContractState( ProposalOpenContractRequest( @@ -126,7 +125,7 @@ class BuyResponse extends BuyResponseModel { /// Subscribes to this bought contract spot and returns its spot update as [ContractBaseModel]. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Stream subscribeState({ RequestCompareFunction? comparePredicate, }) => @@ -139,7 +138,7 @@ class BuyResponse extends BuyResponseModel { /// /// New [stopLoss] value for a contract. To cancel, pass null. /// New [takeProfit] value for a contract. To cancel, pass null. - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future update({ double? stopLoss, double? takeProfit, diff --git a/lib/api/response/cancel_response_result.dart b/lib/api/response/cancel_response_result.dart index dadf3f58b4..5ebcdc8da8 100644 --- a/lib/api/response/cancel_response_result.dart +++ b/lib/api/response/cancel_response_result.dart @@ -53,14 +53,14 @@ class CancelResponse extends CancelResponseModel { /// Cancels a contract with parameters specified in [CancelRequest]. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future cancelContract(CancelRequest request) async { final CancelReceive response = await _api.call(request: request); checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return CancelResponse.fromJson(response.cancel); diff --git a/lib/api/response/cashier_response_result.dart b/lib/api/response/cashier_response_result.dart index 373335c940..a15605f57b 100644 --- a/lib/api/response/cashier_response_result.dart +++ b/lib/api/response/cashier_response_result.dart @@ -73,7 +73,7 @@ class CashierResponse extends CashierResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - CashierException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return CashierResponse.fromJson(response.cashier, response.cashier); diff --git a/lib/api/response/contract_update_history_response_result.dart b/lib/api/response/contract_update_history_response_result.dart index c1d9538bed..45bcc33ae2 100644 --- a/lib/api/response/contract_update_history_response_result.dart +++ b/lib/api/response/contract_update_history_response_result.dart @@ -63,7 +63,7 @@ class ContractUpdateHistoryResponse extends ContractUpdateHistoryResponseModel { /// Gets update history for contract as List of [HistorySpotPriceModel] /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchContractUpdateHistory( ContractUpdateHistoryRequest request, ) async { @@ -73,7 +73,7 @@ class ContractUpdateHistoryResponse extends ContractUpdateHistoryResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ContractUpdateHistoryResponse.fromJson( diff --git a/lib/api/response/contract_update_response_result.dart b/lib/api/response/contract_update_response_result.dart index ea7be773a1..4eb247d49f 100644 --- a/lib/api/response/contract_update_response_result.dart +++ b/lib/api/response/contract_update_response_result.dart @@ -55,7 +55,7 @@ class ContractUpdateResponse extends ContractUpdateResponseModel { /// updates a contract with parameters specified in [ContractUpdateRequest]. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future updateContract( ContractUpdateRequest request, ) async { @@ -64,7 +64,7 @@ class ContractUpdateResponse extends ContractUpdateResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ContractUpdateResponse.fromJson(response.contractUpdate); diff --git a/lib/api/response/contracts_for_response_result.dart b/lib/api/response/contracts_for_response_result.dart index 5bafb5871d..c8f9b535de 100644 --- a/lib/api/response/contracts_for_response_result.dart +++ b/lib/api/response/contracts_for_response_result.dart @@ -55,7 +55,7 @@ class ContractsForResponse extends ContractsForResponseModel { /// Gets available contracts for given symbol in [ContractsForRequest] /// - /// Throws a [ContractsForSymbolException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchContractsForSymbol( ContractsForRequest request, ) async { @@ -66,7 +66,7 @@ class ContractsForResponse extends ContractsForResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractsForSymbolException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ContractsForResponse.fromJson(response.contractsFor); diff --git a/lib/api/response/copy_start_response_result.dart b/lib/api/response/copy_start_response_result.dart index 827c5cff2e..9fceb8a8f7 100644 --- a/lib/api/response/copy_start_response_result.dart +++ b/lib/api/response/copy_start_response_result.dart @@ -52,14 +52,14 @@ class CopyStartResponse extends CopyStartResponseModel { /// Starts copy trader bets. /// /// For parameters information refer to [CopyStartRequest]. - /// Throws a [CopyTradingException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future start(CopyStartRequest request) async { final CopyStartReceive response = await _api.call(request: request); checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - CopyTradingException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return CopyStartResponse.fromJson(response.copyStart); diff --git a/lib/api/response/copy_stop_response_result.dart b/lib/api/response/copy_stop_response_result.dart index 6e523659ab..d53a3fa34b 100644 --- a/lib/api/response/copy_stop_response_result.dart +++ b/lib/api/response/copy_stop_response_result.dart @@ -52,14 +52,14 @@ class CopyStopResponse extends CopyStopResponseModel { /// Stops copy trader bets. /// /// For parameters information refer to [CopyStopRequest]. - /// Throws a [CopyTradingException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future stop(CopyStopRequest request) async { final CopyStopReceive response = await _api.call(request: request); checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - CopyTradingException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return CopyStopResponse.fromJson(response.copyStop); diff --git a/lib/api/response/copytrading_list_response_result.dart b/lib/api/response/copytrading_list_response_result.dart index 9be55a7766..158d91def9 100644 --- a/lib/api/response/copytrading_list_response_result.dart +++ b/lib/api/response/copytrading_list_response_result.dart @@ -55,7 +55,7 @@ class CopytradingListResponse extends CopytradingListResponseModel { /// Gets the list of active copiers and/or traders for Copy Trading /// - /// Throws a [CopyTradingException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchList([ CopytradingListRequest? request, ]) async { @@ -66,7 +66,7 @@ class CopytradingListResponse extends CopytradingListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - CopyTradingException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return CopytradingListResponse.fromJson(response.copytradingList); diff --git a/lib/api/response/copytrading_statistics_response_result.dart b/lib/api/response/copytrading_statistics_response_result.dart index 16451446f9..55c3cb30ec 100644 --- a/lib/api/response/copytrading_statistics_response_result.dart +++ b/lib/api/response/copytrading_statistics_response_result.dart @@ -55,7 +55,7 @@ class CopytradingStatisticsResponse extends CopytradingStatisticsResponseModel { /// Gets the copy trading statistics for given `traderId` in [request] /// - /// Throws a [CopyTradingException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchStatistics( CopytradingStatisticsRequest request, ) async { @@ -66,7 +66,7 @@ class CopytradingStatisticsResponse extends CopytradingStatisticsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - CopyTradingException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return CopytradingStatisticsResponse.fromJson( diff --git a/lib/api/response/exchange_rates_response_result.dart b/lib/api/response/exchange_rates_response_result.dart index a62f0171c9..62c1a9194b 100644 --- a/lib/api/response/exchange_rates_response_result.dart +++ b/lib/api/response/exchange_rates_response_result.dart @@ -69,7 +69,7 @@ class ExchangeRatesResponse extends ExchangeRatesResponseModel { /// Retrieves the exchange rates from a base currency to all currencies supported by the system. /// /// For parameters information refer to [ExchangeRatesRequest]. - /// Throws an [ExchangeException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future fetchExchangeRatesRaw( ExchangeRatesRequest request, ) async { @@ -78,7 +78,7 @@ class ExchangeRatesResponse extends ExchangeRatesResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ExchangeException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -87,7 +87,7 @@ class ExchangeRatesResponse extends ExchangeRatesResponseModel { /// Retrieves the exchange rates from a base currency to all currencies supported by the system. /// /// For parameters information refer to [ExchangeRatesRequest]. - /// Throws an [ExchangeException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future fetchExchangeRates( ExchangeRatesRequest request, ) async { diff --git a/lib/api/response/forget_all_response_result.dart b/lib/api/response/forget_all_response_result.dart index 3a6fd8e4d6..849c6ac321 100644 --- a/lib/api/response/forget_all_response_result.dart +++ b/lib/api/response/forget_all_response_result.dart @@ -64,7 +64,7 @@ class ForgetAllResponse extends ForgetAllResponseModel { /// Immediately cancels the real-time streams of messages of given type. /// /// For parameters information refer to [ForgetAllRequest]. - /// Throws a [ForgetException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future forgetAllMethod( ForgetAllRequest request, ) async { @@ -73,7 +73,7 @@ class ForgetAllResponse extends ForgetAllResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ForgetException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetAllResponse.fromJson(response.forgetAll); diff --git a/lib/api/response/forget_response_result.dart b/lib/api/response/forget_response_result.dart index 95312f3ff7..96087b4812 100644 --- a/lib/api/response/forget_response_result.dart +++ b/lib/api/response/forget_response_result.dart @@ -52,7 +52,7 @@ class ForgetResponse extends ForgetResponseModel { /// Immediately cancels the real-time stream of messages with a specific id. /// /// For parameters information refer to [ForgetRequest]. - /// Throws a [ForgetException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future forgetMethod( ForgetRequest request, ) async { @@ -61,7 +61,7 @@ class ForgetResponse extends ForgetResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ForgetException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetResponse.fromJson(response.forget); diff --git a/lib/api/response/get_account_status_response_result.dart b/lib/api/response/get_account_status_response_result.dart index 37887a3c83..8b1e4185fd 100644 --- a/lib/api/response/get_account_status_response_result.dart +++ b/lib/api/response/get_account_status_response_result.dart @@ -56,7 +56,7 @@ class GetAccountStatusResponse extends GetAccountStatusResponseModel { /// Gets the account's status. /// /// For parameters information refer to [GetAccountStatusRequest]. - /// Throws an [AccountStatusException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future fetchAccountStatusRaw() async { final GetAccountStatusReceive response = await _api.call( request: const GetAccountStatusRequest(), @@ -65,7 +65,7 @@ class GetAccountStatusResponse extends GetAccountStatusResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AccountStatusException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -74,7 +74,7 @@ class GetAccountStatusResponse extends GetAccountStatusResponseModel { /// Gets the account's status. /// /// For parameters information refer to [GetAccountStatusRequest]. - /// Throws an [AccountStatusException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future fetchAccountStatus() async { final GetAccountStatusReceive response = await fetchAccountStatusRaw(); diff --git a/lib/api/response/get_financial_assessment_response_result.dart b/lib/api/response/get_financial_assessment_response_result.dart index 7d45ce830b..e19869c19e 100644 --- a/lib/api/response/get_financial_assessment_response_result.dart +++ b/lib/api/response/get_financial_assessment_response_result.dart @@ -58,7 +58,7 @@ class GetFinancialAssessmentResponse /// /// The 'financial assessment' is a questionnaire that clients of certain Landing Companies need to complete, /// due to regulatory and KYC (know your client) requirements. - /// Throws a [FinancialAssessmentException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchAssessment( GetFinancialAssessmentRequest request, ) async { @@ -68,7 +68,7 @@ class GetFinancialAssessmentResponse checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - FinancialAssessmentException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return GetFinancialAssessmentResponse.fromJson( diff --git a/lib/api/response/get_limits_response_result.dart b/lib/api/response/get_limits_response_result.dart index 830e26f867..b1c4217b4d 100644 --- a/lib/api/response/get_limits_response_result.dart +++ b/lib/api/response/get_limits_response_result.dart @@ -54,7 +54,7 @@ class GetLimitsResponse extends GetLimitsResponseModel { /// Gets the trading and withdrawal limits for logged in account /// - /// Throws an [AccountLimitsException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future fetchAccountLimits([ GetLimitsRequest? request, ]) async { @@ -65,7 +65,7 @@ class GetLimitsResponse extends GetLimitsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AccountLimitsException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return GetLimitsResponse.fromJson(response.getLimits); diff --git a/lib/api/response/get_self_exclusion_response_result.dart b/lib/api/response/get_self_exclusion_response_result.dart index a1efd5829c..6a963c40dc 100644 --- a/lib/api/response/get_self_exclusion_response_result.dart +++ b/lib/api/response/get_self_exclusion_response_result.dart @@ -60,7 +60,7 @@ class GetSelfExclusionResponse extends GetSelfExclusionResponseModel { /// /// This facility is a regulatory requirement for certain Landing Companies. /// For parameters information refer to [GetSelfExclusionRequest]. - /// Throws a [SelfExclusionException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchSelfExclusion([ GetSelfExclusionRequest? request, ]) async { @@ -71,7 +71,7 @@ class GetSelfExclusionResponse extends GetSelfExclusionResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - SelfExclusionException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return GetSelfExclusionResponse.fromJson(response.getSelfExclusion); @@ -80,14 +80,14 @@ class GetSelfExclusionResponse extends GetSelfExclusionResponseModel { /// Sets Self-Exclusion (this call should be used in conjunction with [fetchSelfExclusion]) /// /// For parameters information refer to [SetSelfExclusionRequest]. - /// Throws a [SelfExclusionException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future setSelfExclusion(SetSelfExclusionRequest request) async { final SetSelfExclusionReceive response = await _api.call(request: request); checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - SelfExclusionException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return getBool(response.setSelfExclusion); @@ -96,7 +96,7 @@ class GetSelfExclusionResponse extends GetSelfExclusionResponseModel { /// Excludes user from the website based this parameters /// /// (this call should be used in conjunction with [fetchSelfExclusion]) - /// Throws a [SelfExclusionException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future exclude() async { final SetSelfExclusionReceive response = await _api.call( request: SetSelfExclusionRequest( @@ -121,7 +121,7 @@ class GetSelfExclusionResponse extends GetSelfExclusionResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - SelfExclusionException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return getBool(response.setSelfExclusion); diff --git a/lib/api/response/get_settings_response_result.dart b/lib/api/response/get_settings_response_result.dart index 349c1b1203..4d9fde44a8 100644 --- a/lib/api/response/get_settings_response_result.dart +++ b/lib/api/response/get_settings_response_result.dart @@ -59,7 +59,7 @@ class GetSettingsResponse extends GetSettingsResponseModel { /// Gets user's settings (email, date of birth, address etc). /// /// For parameters information refer to [GetSettingsRequest]. - /// Throws an [AccountSettingsException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future fetchAccountSettingRaw([ GetSettingsRequest? request, ]) async { @@ -70,7 +70,7 @@ class GetSettingsResponse extends GetSettingsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AccountSettingsException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -79,7 +79,7 @@ class GetSettingsResponse extends GetSettingsResponseModel { /// Gets user's settings (email, date of birth, address etc). /// /// For parameters information refer to [GetSettingsRequest]. - /// Throws an [AccountSettingsException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future changeAccountSettingRaw( SetSettingsRequest request, ) async { @@ -88,7 +88,7 @@ class GetSettingsResponse extends GetSettingsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AccountSettingsException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -96,7 +96,7 @@ class GetSettingsResponse extends GetSettingsResponseModel { /// Gets user's settings (email, date of birth, address etc). /// - /// Throws an [AccountSettingsException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future fetchAccountSetting([ GetSettingsRequest? request, ]) async { @@ -107,7 +107,7 @@ class GetSettingsResponse extends GetSettingsResponseModel { /// Changes the user's settings with parameters specified as [SetSettingsRequest]. /// - /// Throws an [AccountSettingsException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future changeAccountSetting( SetSettingsRequest request, ) async { diff --git a/lib/api/response/landing_company_response_result.dart b/lib/api/response/landing_company_response_result.dart index 65f777c437..2c5434b3b5 100644 --- a/lib/api/response/landing_company_response_result.dart +++ b/lib/api/response/landing_company_response_result.dart @@ -58,7 +58,7 @@ class LandingCompanyResponse extends LandingCompanyResponseModel { /// Gets landing companies for given [LandingCompanyRequest] /// - /// Throws a [LandingCompanyException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchLandingCompanies( LandingCompanyRequest request, ) async { @@ -67,7 +67,7 @@ class LandingCompanyResponse extends LandingCompanyResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - LandingCompanyException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return LandingCompanyResponse.fromJson(response.landingCompany); @@ -75,7 +75,7 @@ class LandingCompanyResponse extends LandingCompanyResponseModel { /// Gets details of a landing company specified in [LandingCompanyDetailsRequest] /// - /// Throws a [LandingCompanyException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchLandingCompanyDetails( LandingCompanyDetailsRequest request, ) async { @@ -86,7 +86,7 @@ class LandingCompanyResponse extends LandingCompanyResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - LandingCompanyException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return LandingCompanyDetailsResponse.fromJson( diff --git a/lib/api/response/login_history_response_result.dart b/lib/api/response/login_history_response_result.dart index 0e65ea6168..90f67743d8 100644 --- a/lib/api/response/login_history_response_result.dart +++ b/lib/api/response/login_history_response_result.dart @@ -64,7 +64,7 @@ class LoginHistoryResponse extends LoginHistoryResponseModel { /// Retrieves a summary of login history for user. /// /// For parameters information refer to [LoginHistory]. - /// Throws an [AuthorizeException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future fetchHistory([ LoginHistoryRequest? request, ]) async { @@ -75,7 +75,7 @@ class LoginHistoryResponse extends LoginHistoryResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AuthorizeException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return LoginHistoryResponse.fromJson(response.loginHistory); diff --git a/lib/api/response/logout_response_result.dart b/lib/api/response/logout_response_result.dart index 48a9e15500..c72f0a1235 100644 --- a/lib/api/response/logout_response_result.dart +++ b/lib/api/response/logout_response_result.dart @@ -52,7 +52,7 @@ class LogoutResponse extends LogoutResponseModel { /// Logs out from the web-socket's session. /// /// For parameters information refer to [LogoutRequest]. - /// Throws an [AuthorizeException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future logoutMethodRaw([LogoutRequest? request]) async { final LogoutReceive response = await _api.call(request: request ?? const LogoutRequest()); @@ -60,7 +60,7 @@ class LogoutResponse extends LogoutResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AuthorizeException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -69,7 +69,7 @@ class LogoutResponse extends LogoutResponseModel { /// Logs out from the web-socket's session. /// /// For parameters information refer to [LogoutRequest]. - /// Throws an [AuthorizeException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future logoutMethod([LogoutRequest? request]) async { final LogoutReceive response = await logoutMethodRaw(request); diff --git a/lib/api/response/mt5_deposit_response_result.dart b/lib/api/response/mt5_deposit_response_result.dart index 3944d1b990..594ba1936d 100644 --- a/lib/api/response/mt5_deposit_response_result.dart +++ b/lib/api/response/mt5_deposit_response_result.dart @@ -61,14 +61,14 @@ class Mt5DepositResponse extends Mt5DepositResponseModel { /// Allows deposit into MT5 account from binary account. /// /// For parameters information refer to [Mt5DepositRequest]. - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future deposit(Mt5DepositRequest request) async { final Mt5DepositReceive response = await _api.call(request: request); checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - MT5Exception(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return Mt5DepositResponse.fromJson( diff --git a/lib/api/response/mt5_get_settings_response_result.dart b/lib/api/response/mt5_get_settings_response_result.dart index 8430eaa0e0..0f4c73534d 100644 --- a/lib/api/response/mt5_get_settings_response_result.dart +++ b/lib/api/response/mt5_get_settings_response_result.dart @@ -56,7 +56,7 @@ class Mt5GetSettingsResponse extends Mt5GetSettingsResponseModel { /// Gets MT5 user account settings. /// /// For parameters information refer to [Mt5GetSettingsRequest]. - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchSettings( Mt5GetSettingsRequest request, ) async { @@ -65,7 +65,7 @@ class Mt5GetSettingsResponse extends Mt5GetSettingsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - MT5Exception(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return Mt5GetSettingsResponse.fromJson(response.mt5GetSettings); diff --git a/lib/api/response/mt5_login_list_response_result.dart b/lib/api/response/mt5_login_list_response_result.dart index 40dbd21955..2591f6af1b 100644 --- a/lib/api/response/mt5_login_list_response_result.dart +++ b/lib/api/response/mt5_login_list_response_result.dart @@ -64,7 +64,7 @@ class Mt5LoginListResponse extends Mt5LoginListResponseModel { /// Gets the list of MT5 accounts for client. /// /// For parameters information refer to [Mt5LoginListRequest]. - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchLoginList( Mt5LoginListRequest request, ) async { @@ -73,7 +73,7 @@ class Mt5LoginListResponse extends Mt5LoginListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - MT5Exception(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return Mt5LoginListResponse.fromJson(response.mt5LoginList); diff --git a/lib/api/response/mt5_new_account_response_result.dart b/lib/api/response/mt5_new_account_response_result.dart index bf6126eff7..3e3d158412 100644 --- a/lib/api/response/mt5_new_account_response_result.dart +++ b/lib/api/response/mt5_new_account_response_result.dart @@ -69,7 +69,7 @@ class Mt5NewAccountResponse extends Mt5NewAccountResponseModel { /// Creates new MT5 user, either demo or real money user. /// /// For parameters information refer to [Mt5NewAccountRequest]. - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future createNewAccount( Mt5NewAccountRequest request, ) async { @@ -78,7 +78,7 @@ class Mt5NewAccountResponse extends Mt5NewAccountResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - MT5Exception(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return Mt5NewAccountResponse.fromJson(response.mt5NewAccount); @@ -86,7 +86,7 @@ class Mt5NewAccountResponse extends Mt5NewAccountResponseModel { /// Allows deposit into MT5 account from binary account. /// - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future deposit({ required double amount, required String fromBinary, @@ -101,7 +101,7 @@ class Mt5NewAccountResponse extends Mt5NewAccountResponseModel { /// Changes password of the MT5 account. /// - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future changePassword({ required String newPassword, required String oldPassword, @@ -118,7 +118,7 @@ class Mt5NewAccountResponse extends Mt5NewAccountResponseModel { /// Validates the main password for the MT5 user. /// - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future checkPassword({ required String password, required PasswordType passwordType, @@ -133,7 +133,7 @@ class Mt5NewAccountResponse extends Mt5NewAccountResponseModel { /// Resets the password of MT5 account. /// - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future resetPassword({ required String newPassword, required PasswordType passwordType, @@ -150,14 +150,14 @@ class Mt5NewAccountResponse extends Mt5NewAccountResponseModel { /// Gets the MT5 user account settings. /// - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future fetchSettings() => Mt5GetSettingsResponse.fetchSettings( Mt5GetSettingsRequest(login: mt5NewAccount?.login)); /// Allows withdrawal from MT5 account to Binary account. /// - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future withdraw({ required double amount, required String toBinary, diff --git a/lib/api/response/mt5_password_change_response_result.dart b/lib/api/response/mt5_password_change_response_result.dart index 8f496ea504..a6ac7e462e 100644 --- a/lib/api/response/mt5_password_change_response_result.dart +++ b/lib/api/response/mt5_password_change_response_result.dart @@ -52,7 +52,7 @@ class Mt5PasswordChangeResponse extends Mt5PasswordChangeResponseModel { /// Changes the password of the MT5 account. /// /// For parameters information refer to [Mt5PasswordChangeRequest]. - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future changePassword( Mt5PasswordChangeRequest request, ) async { @@ -61,7 +61,7 @@ class Mt5PasswordChangeResponse extends Mt5PasswordChangeResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - MT5Exception(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return Mt5PasswordChangeResponse.fromJson(response.mt5PasswordChange); diff --git a/lib/api/response/mt5_password_check_response_result.dart b/lib/api/response/mt5_password_check_response_result.dart index 80884b7269..b534d8f80a 100644 --- a/lib/api/response/mt5_password_check_response_result.dart +++ b/lib/api/response/mt5_password_check_response_result.dart @@ -52,7 +52,7 @@ class Mt5PasswordCheckResponse extends Mt5PasswordCheckResponseModel { /// Validates the main password for the MT5 user. /// /// For parameters information refer to [Mt5PasswordCheckRequest]. - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future checkPassword( Mt5PasswordCheckRequest request) async { final Mt5PasswordCheckReceive response = await _api.call(request: request); @@ -60,7 +60,7 @@ class Mt5PasswordCheckResponse extends Mt5PasswordCheckResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - MT5Exception(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return Mt5PasswordCheckResponse.fromJson(response.mt5PasswordCheck); diff --git a/lib/api/response/mt5_password_reset_response_result.dart b/lib/api/response/mt5_password_reset_response_result.dart index b1c832805d..f83a757c16 100644 --- a/lib/api/response/mt5_password_reset_response_result.dart +++ b/lib/api/response/mt5_password_reset_response_result.dart @@ -52,7 +52,7 @@ class Mt5PasswordResetResponse extends Mt5PasswordResetResponseModel { /// Resets the password of MT5 account. /// /// For parameters information refer to [Mt5PasswordResetRequest]. - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future resetPassword( Mt5PasswordResetRequest request, ) async { @@ -61,7 +61,7 @@ class Mt5PasswordResetResponse extends Mt5PasswordResetResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - MT5Exception(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return Mt5PasswordResetResponse.fromJson(response.mt5PasswordReset); diff --git a/lib/api/response/mt5_withdrawal_response_result.dart b/lib/api/response/mt5_withdrawal_response_result.dart index e8c046f4bc..c123ca54b2 100644 --- a/lib/api/response/mt5_withdrawal_response_result.dart +++ b/lib/api/response/mt5_withdrawal_response_result.dart @@ -61,7 +61,7 @@ class Mt5WithdrawalResponse extends Mt5WithdrawalResponseModel { /// Allows withdrawal from MT5 account to Binary account. /// /// For parameters information refer to [Mt5WithdrawalRequest]. - /// Throws a [MT5Exception] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future withdraw( Mt5WithdrawalRequest request, ) async { @@ -70,7 +70,7 @@ class Mt5WithdrawalResponse extends Mt5WithdrawalResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - MT5Exception(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return Mt5WithdrawalResponse.fromJson( diff --git a/lib/api/response/new_account_real_response_result.dart b/lib/api/response/new_account_real_response_result.dart index a303547210..aa47f00328 100644 --- a/lib/api/response/new_account_real_response_result.dart +++ b/lib/api/response/new_account_real_response_result.dart @@ -56,7 +56,7 @@ class NewAccountRealResponse extends NewAccountRealResponseModel { /// Opens a new real account. /// /// For parameters information refer to [NewAccountRealRequest]. - /// Throws a [NewAccountException] ifAP + /// Throws a [BaseAPIException] ifAP static Future openNewRealAccount( NewAccountRealRequest request, ) async { @@ -65,7 +65,7 @@ class NewAccountRealResponse extends NewAccountRealResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - NewAccountException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return NewAccountRealResponse.fromJson(response.newAccountReal); diff --git a/lib/api/response/new_account_virtual_response_result.dart b/lib/api/response/new_account_virtual_response_result.dart index c4f22f7792..2b87d4a37b 100644 --- a/lib/api/response/new_account_virtual_response_result.dart +++ b/lib/api/response/new_account_virtual_response_result.dart @@ -56,7 +56,7 @@ class NewAccountVirtualResponse extends NewAccountVirtualResponseModel { /// Opens a new virtual account. /// /// For parameters information refer to [NewAccountVirtualRequest]. - /// Throws a [NewAccountException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future openNewVirtualAccount( NewAccountVirtualRequest request, ) async { @@ -65,7 +65,7 @@ class NewAccountVirtualResponse extends NewAccountVirtualResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - NewAccountException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return NewAccountVirtualResponse.fromJson(response.newAccountVirtual); diff --git a/lib/api/response/oauth_apps_response_result.dart b/lib/api/response/oauth_apps_response_result.dart index 2d0f2aafcc..3da3325f49 100644 --- a/lib/api/response/oauth_apps_response_result.dart +++ b/lib/api/response/oauth_apps_response_result.dart @@ -63,7 +63,7 @@ class OauthAppsResponse extends OauthAppsResponseModel { /// Gets oauth application that used for the authorized account. /// - /// Throws an [AppException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future fetchOauthApps([ OauthAppsRequest? request, ]) async { @@ -74,7 +74,7 @@ class OauthAppsResponse extends OauthAppsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AppException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return OauthAppsResponse.fromJson(response.oauthApps); diff --git a/lib/api/response/p2p_advert_create_response_result.dart b/lib/api/response/p2p_advert_create_response_result.dart index 9a99fecef5..2c41b1b0b9 100644 --- a/lib/api/response/p2p_advert_create_response_result.dart +++ b/lib/api/response/p2p_advert_create_response_result.dart @@ -1,8 +1,8 @@ // ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import import 'package:equatable/equatable.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; -import 'package:flutter_deriv_api/api/exceptions/p2p_advert_exception.dart'; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_receive.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_send.dart'; @@ -56,7 +56,7 @@ class P2pAdvertCreateResponse extends P2pAdvertCreateResponseModel { /// Creates a P2P (peer to peer) advert. Can only be used by an approved P2P advertiser. /// /// For parameters information refer to [P2pAdvertCreateRequest]. - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future createAdvert( P2pAdvertCreateRequest request, ) async { @@ -68,7 +68,7 @@ class P2pAdvertCreateResponse extends P2pAdvertCreateResponseModel { /// Creates a P2P (peer to peer) advert. Can only be used by an approved P2P advertiser. /// /// For parameters information refer to [P2pAdvertCreateRequest]. - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future createAdvertRaw( P2pAdvertCreateRequest request, ) async { @@ -77,7 +77,7 @@ class P2pAdvertCreateResponse extends P2pAdvertCreateResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/p2p_advert_info_response_result.dart b/lib/api/response/p2p_advert_info_response_result.dart index f2186228d3..561bc9bb6e 100644 --- a/lib/api/response/p2p_advert_info_response_result.dart +++ b/lib/api/response/p2p_advert_info_response_result.dart @@ -77,7 +77,7 @@ class P2pAdvertInfoResponse extends P2pAdvertInfoResponseModel { /// Retrieves information about a P2P (peer to peer) advert. /// /// For parameters information refer to [P2pAdvertInfoRequest]. - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchAdvert( P2pAdvertInfoRequest request, ) async { @@ -90,7 +90,7 @@ class P2pAdvertInfoResponse extends P2pAdvertInfoResponseModel { /// Retrieves information about a P2P (peer to peer) advert. /// /// For parameters information refer to [P2pAdvertInfoRequest]. - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchAdvertRaw( P2pAdvertInfoRequest request, ) async { @@ -99,7 +99,7 @@ class P2pAdvertInfoResponse extends P2pAdvertInfoResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -109,7 +109,7 @@ class P2pAdvertInfoResponse extends P2pAdvertInfoResponseModel { /// /// [delete] to permanently delete the advert /// [isActive] to activate or deactivate the advert - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future update({ bool? delete, bool? isActive, @@ -126,7 +126,7 @@ class P2pAdvertInfoResponse extends P2pAdvertInfoResponseModel { /// /// [delete] to permanently delete the advert /// [isActive] to activate or deactivate the advert - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future updateRaw({ bool? delete, bool? isActive, @@ -141,33 +141,33 @@ class P2pAdvertInfoResponse extends P2pAdvertInfoResponseModel { /// Deletes permanently a P2P (peer to peer) advert. Can only be used by the advertiser. /// - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future delete() => update(delete: true); /// Deletes permanently a P2P (peer to peer) advert. Can only be used by the advertiser. /// - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future deleteRaw() => updateRaw(delete: true); /// Activates a P2P (peer to peer) advert. Can only be used by the advertiser. /// - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future activate() async => update(isActive: true); /// Activates a P2P (peer to peer) advert. Can only be used by the advertiser. /// - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future activateRaw() async => updateRaw(isActive: true); /// Deactivates a P2P (peer to peer) advert. Can only be used by the advertiser. /// - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future deactivate() async => update(isActive: false); /// Deactivates a P2P (peer to peer) advert. Can only be used by the advertiser. /// - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future deactivateRaw() async => updateRaw(isActive: false); @@ -176,7 +176,7 @@ class P2pAdvertInfoResponse extends P2pAdvertInfoResponseModel { /// [amount] is the amount of currency to be bought or sold. /// [contactInfo] is seller contact information. Only applicable for [OrderType.sell]. /// [paymentInfo] is payment instructions. Only applicable for [OrderType.sell]. - /// Throws [P2POrderException] if API response contains an error. + /// Throws [BaseAPIException] if API response contains an error. Future createOrder({ required double amount, String? contactInfo, @@ -197,7 +197,7 @@ class P2pAdvertInfoResponse extends P2pAdvertInfoResponseModel { /// [amount] is the amount of currency to be bought or sold. /// [contactInfo] is seller contact information. Only applicable for [OrderType.sell]. /// [paymentInfo] is payment instructions. Only applicable for [OrderType.sell]. - /// Throws [P2POrderException] if API response contains an error. + /// Throws [BaseAPIException] if API response contains an error. Future createOrderRaw({ required double amount, String? contactInfo, diff --git a/lib/api/response/p2p_advert_list_response_result.dart b/lib/api/response/p2p_advert_list_response_result.dart index 0b6f31c80a..a42934b371 100644 --- a/lib/api/response/p2p_advert_list_response_result.dart +++ b/lib/api/response/p2p_advert_list_response_result.dart @@ -1,8 +1,8 @@ // ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import import 'package:equatable/equatable.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; -import 'package:flutter_deriv_api/api/exceptions/p2p_advert_exception.dart'; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_receive.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_send.dart'; @@ -56,7 +56,7 @@ class P2pAdvertListResponse extends P2pAdvertListResponseModel { /// Returns available adverts. /// /// For parameters information refer to [P2pAdvertListRequest]. - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchAdvertList( P2pAdvertListRequest request, ) async { @@ -68,7 +68,7 @@ class P2pAdvertListResponse extends P2pAdvertListResponseModel { /// Returns available adverts. /// /// For parameters information refer to [P2pAdvertListRequest]. - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchAdvertListRaw( P2pAdvertListRequest request, ) async { @@ -77,7 +77,7 @@ class P2pAdvertListResponse extends P2pAdvertListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/p2p_advert_update_response_result.dart b/lib/api/response/p2p_advert_update_response_result.dart index c4cf25b319..7c0c1ff086 100644 --- a/lib/api/response/p2p_advert_update_response_result.dart +++ b/lib/api/response/p2p_advert_update_response_result.dart @@ -56,7 +56,7 @@ class P2pAdvertUpdateResponse extends P2pAdvertUpdateResponseModel { /// Updates a P2P (peer to peer) advert. Can only be used by the advertiser. /// /// For parameters information refer to [P2pAdvertUpdateRequest]. - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future updateAdvert( P2pAdvertUpdateRequest request, ) async { @@ -68,7 +68,7 @@ class P2pAdvertUpdateResponse extends P2pAdvertUpdateResponseModel { /// Updates a P2P (peer to peer) advert. Can only be used by the advertiser. /// /// For parameters information refer to [P2pAdvertUpdateRequest]. - /// Throws a [P2PAdvertException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future updateAdvertRaw( P2pAdvertUpdateRequest request, ) async { @@ -77,7 +77,7 @@ class P2pAdvertUpdateResponse extends P2pAdvertUpdateResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/p2p_advertiser_adverts_response_result.dart b/lib/api/response/p2p_advertiser_adverts_response_result.dart index 009499b828..4830ba2a78 100644 --- a/lib/api/response/p2p_advertiser_adverts_response_result.dart +++ b/lib/api/response/p2p_advertiser_adverts_response_result.dart @@ -77,7 +77,7 @@ class P2pAdvertiserAdvertsResponse extends P2pAdvertiserAdvertsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertiserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/p2p_advertiser_create_response_result.dart b/lib/api/response/p2p_advertiser_create_response_result.dart index 68bcc98fc5..abb9fc5f7f 100644 --- a/lib/api/response/p2p_advertiser_create_response_result.dart +++ b/lib/api/response/p2p_advertiser_create_response_result.dart @@ -92,7 +92,7 @@ class P2pAdvertiserCreateResponse extends P2pAdvertiserCreateResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertiserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -129,7 +129,7 @@ class P2pAdvertiserCreateResponse extends P2pAdvertiserCreateResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertiserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is P2pAdvertiserCreateReceive ? response : null; diff --git a/lib/api/response/p2p_advertiser_info_response_result.dart b/lib/api/response/p2p_advertiser_info_response_result.dart index 77bfc31f50..7d0da5dc1e 100644 --- a/lib/api/response/p2p_advertiser_info_response_result.dart +++ b/lib/api/response/p2p_advertiser_info_response_result.dart @@ -76,7 +76,7 @@ class P2pAdvertiserInfoResponse extends P2pAdvertiserInfoResponseModel { /// Retrieves information about a P2P (peer to peer) advertiser. /// /// For parameters information refer to [P2pAdvertiserInfoRequest]. - /// Throws a [P2PAdvertiserException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future fetchAdvertiserInformation( P2pAdvertiserInfoRequest request, ) async { @@ -90,7 +90,7 @@ class P2pAdvertiserInfoResponse extends P2pAdvertiserInfoResponseModel { /// Retrieves information about a P2P (peer to peer) advertiser. /// /// For parameters information refer to [P2pAdvertiserInfoRequest]. - /// Throws a [P2PAdvertiserException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future fetchAdvertiserInformationRaw( P2pAdvertiserInfoRequest request, ) async { @@ -132,7 +132,7 @@ class P2pAdvertiserInfoResponse extends P2pAdvertiserInfoResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertiserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is P2pAdvertiserInfoReceive ? response : null; @@ -141,7 +141,7 @@ class P2pAdvertiserInfoResponse extends P2pAdvertiserInfoResponseModel { /// Unsubscribes from P2P (peer to peer) advertiser information. /// - /// Throws a [P2PAdvertiserException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. Future unsubscribeAdvertiser() async { if (subscription == null) { return null; @@ -153,7 +153,7 @@ class P2pAdvertiserInfoResponse extends P2pAdvertiserInfoResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertiserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetResponse.fromJson(response.forget); @@ -161,7 +161,7 @@ class P2pAdvertiserInfoResponse extends P2pAdvertiserInfoResponseModel { /// Unsubscribes all P2P (peer to peer) advertisers. /// - /// Throws a [P2PAdvertiserException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future unsubscribeAllAdvertiser() async { final ForgetAllReceive response = await _api.unsubscribeAll(method: ForgetStreamType.p2pAdvertiser); @@ -169,7 +169,7 @@ class P2pAdvertiserInfoResponse extends P2pAdvertiserInfoResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertiserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetAllResponse.fromJson(response.forgetAll); diff --git a/lib/api/response/p2p_advertiser_list_response_result.dart b/lib/api/response/p2p_advertiser_list_response_result.dart index c32c40ee20..3f08084852 100644 --- a/lib/api/response/p2p_advertiser_list_response_result.dart +++ b/lib/api/response/p2p_advertiser_list_response_result.dart @@ -62,7 +62,7 @@ class P2pAdvertiserListResponse extends P2pAdvertiserListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertiserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/p2p_advertiser_payment_methods_response_result.dart b/lib/api/response/p2p_advertiser_payment_methods_response_result.dart index 6207a8c885..5b86419857 100644 --- a/lib/api/response/p2p_advertiser_payment_methods_response_result.dart +++ b/lib/api/response/p2p_advertiser_payment_methods_response_result.dart @@ -64,7 +64,7 @@ class P2pAdvertiserPaymentMethodsResponse /// Manage or list P2P advertiser payment methods. /// /// For parameters information refer to [P2pAdvertiserPaymentMethodsRequest]. - /// Throws an [P2PAdvertiserException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future fetchMethodsRaw( P2pAdvertiserPaymentMethodsRequest request, ) async { @@ -74,7 +74,7 @@ class P2pAdvertiserPaymentMethodsResponse checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertiserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -83,7 +83,7 @@ class P2pAdvertiserPaymentMethodsResponse /// Manage or list P2P advertiser payment methods. /// /// For parameters information refer to [P2pAdvertiserPaymentMethodsRequest]. - /// Throws an [P2PAdvertiserException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future fetchMethods( P2pAdvertiserPaymentMethodsRequest request, ) async { diff --git a/lib/api/response/p2p_advertiser_relations_response_result.dart b/lib/api/response/p2p_advertiser_relations_response_result.dart index f60863450f..aebad9df82 100644 --- a/lib/api/response/p2p_advertiser_relations_response_result.dart +++ b/lib/api/response/p2p_advertiser_relations_response_result.dart @@ -57,7 +57,7 @@ class P2pAdvertiserRelationsResponse /// Updates and returns favourite and blocked advertisers of the current user. /// /// For parameters information refer to [P2pAdvertiserRelationsRequest]. - /// Throws an [P2PAdvertiserException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future fetchRaw( P2pAdvertiserRelationsRequest request, ) async { @@ -67,7 +67,7 @@ class P2pAdvertiserRelationsResponse checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertiserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -76,7 +76,7 @@ class P2pAdvertiserRelationsResponse /// Updates and returns favourite and blocked advertisers of the current user. /// /// For parameters information refer to [P2pAdvertiserRelationsRequest]. - /// Throws an [P2PAdvertiserException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future fetch( P2pAdvertiserRelationsRequest request, ) async { diff --git a/lib/api/response/p2p_advertiser_update_response_result.dart b/lib/api/response/p2p_advertiser_update_response_result.dart index 115139e539..c6c470e5f5 100644 --- a/lib/api/response/p2p_advertiser_update_response_result.dart +++ b/lib/api/response/p2p_advertiser_update_response_result.dart @@ -77,7 +77,7 @@ class P2pAdvertiserUpdateResponse extends P2pAdvertiserUpdateResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PAdvertiserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/p2p_chat_create_response_result.dart b/lib/api/response/p2p_chat_create_response_result.dart index 32fb719aac..7a9764e85c 100644 --- a/lib/api/response/p2p_chat_create_response_result.dart +++ b/lib/api/response/p2p_chat_create_response_result.dart @@ -77,7 +77,7 @@ class P2pChatCreateResponse extends P2pChatCreateResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2PChatException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/p2p_order_cancel_response_result.dart b/lib/api/response/p2p_order_cancel_response_result.dart index e7bc907df0..b38f92e2c4 100644 --- a/lib/api/response/p2p_order_cancel_response_result.dart +++ b/lib/api/response/p2p_order_cancel_response_result.dart @@ -55,7 +55,7 @@ class P2pOrderCancelResponse extends P2pOrderCancelResponseModel { /// Cancel a P2P order. /// /// For parameters information refer to [P2pOrderCancelRequest]. - /// Throws a [P2POrderException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future cancelOrderRaw( P2pOrderCancelRequest request, ) async { @@ -64,7 +64,7 @@ class P2pOrderCancelResponse extends P2pOrderCancelResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -73,7 +73,7 @@ class P2pOrderCancelResponse extends P2pOrderCancelResponseModel { /// Cancel a P2P order. /// /// For parameters information refer to [P2pOrderCancelRequest]. - /// Throws a [P2POrderException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future cancelOrder( P2pOrderCancelRequest request, ) async { diff --git a/lib/api/response/p2p_order_confirm_response_result.dart b/lib/api/response/p2p_order_confirm_response_result.dart index c1d6c9de3a..e0fc40b8b2 100644 --- a/lib/api/response/p2p_order_confirm_response_result.dart +++ b/lib/api/response/p2p_order_confirm_response_result.dart @@ -55,7 +55,7 @@ class P2pOrderConfirmResponse extends P2pOrderConfirmResponseModel { /// Cancel a P2P order confirm. /// /// For parameters information refer to [P2pOrderConfirmRequest]. - /// Throws an [P2POrderException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future confirmOrderRaw( P2pOrderConfirmRequest request, ) async { @@ -64,7 +64,7 @@ class P2pOrderConfirmResponse extends P2pOrderConfirmResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -73,7 +73,7 @@ class P2pOrderConfirmResponse extends P2pOrderConfirmResponseModel { /// Cancel a P2P order confirm. /// /// For parameters information refer to [P2pOrderConfirmRequest]. - /// Throws an [P2POrderException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future confirmOrder( P2pOrderConfirmRequest request, ) async { diff --git a/lib/api/response/p2p_order_create_response_result.dart b/lib/api/response/p2p_order_create_response_result.dart index 31f3270e02..0c0b04b3af 100644 --- a/lib/api/response/p2p_order_create_response_result.dart +++ b/lib/api/response/p2p_order_create_response_result.dart @@ -85,7 +85,7 @@ class P2pOrderCreateResponse extends P2pOrderCreateResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -93,7 +93,7 @@ class P2pOrderCreateResponse extends P2pOrderCreateResponseModel { /// Creates order and subscribes to the result with parameters specified in [P2pOrderCreateRequest] /// - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Stream createAndSubscribe( P2pOrderCreateRequest request, { RequestCompareFunction? comparePredicate, @@ -112,7 +112,7 @@ class P2pOrderCreateResponse extends P2pOrderCreateResponseModel { /// Creates order and subscribes to the result with parameters specified in [P2pOrderCreateRequest] /// - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Stream createAndSubscribeRaw( P2pOrderCreateRequest request, { RequestCompareFunction? comparePredicate, @@ -122,7 +122,7 @@ class P2pOrderCreateResponse extends P2pOrderCreateResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is P2pOrderCreateReceive ? response : null; diff --git a/lib/api/response/p2p_order_dispute_response_result.dart b/lib/api/response/p2p_order_dispute_response_result.dart index 8344e5511e..a2bdaae1be 100644 --- a/lib/api/response/p2p_order_dispute_response_result.dart +++ b/lib/api/response/p2p_order_dispute_response_result.dart @@ -56,7 +56,7 @@ class P2pOrderDisputeResponse extends P2pOrderDisputeResponseModel { /// Cancel a P2P order dispute. /// /// For parameters information refer to [P2pOrderDisputeRequest]. - /// Throws an [P2POrderException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future disputeOrderRaw( P2pOrderDisputeRequest request, ) async { @@ -65,7 +65,7 @@ class P2pOrderDisputeResponse extends P2pOrderDisputeResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -74,7 +74,7 @@ class P2pOrderDisputeResponse extends P2pOrderDisputeResponseModel { /// Cancel a P2P order dispute. /// /// For parameters information refer to [P2pOrderDisputeRequest]. - /// Throws an [P2POrderException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future disputeOrder( P2pOrderDisputeRequest request, ) async { diff --git a/lib/api/response/p2p_order_info_response_result.dart b/lib/api/response/p2p_order_info_response_result.dart index 972339e3ce..e3785742ed 100644 --- a/lib/api/response/p2p_order_info_response_result.dart +++ b/lib/api/response/p2p_order_info_response_result.dart @@ -81,7 +81,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { /// Gets order with parameters specified in [P2pOrderInfoRequest] /// - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchOrder( P2pOrderInfoRequest request) async { final P2pOrderInfoReceive response = await fetchOrderRaw(request); @@ -92,7 +92,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { /// Gets order with parameters specified in [P2pOrderInfoRequest] /// - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchOrderRaw( P2pOrderInfoRequest request) async { final P2pOrderInfoReceive response = await _api.call(request: request); @@ -100,7 +100,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -126,7 +126,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { /// Subscribes to order with parameters specified in [P2pOrderInfoRequest] /// - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Stream subscribeOrder( P2pOrderInfoRequest request, { RequestCompareFunction? comparePredicate, @@ -145,7 +145,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { /// Subscribes to order with parameters specified in [P2pOrderInfoRequest] /// - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Stream subscribeOrderRaw( P2pOrderInfoRequest request, { RequestCompareFunction? comparePredicate, @@ -157,7 +157,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is P2pOrderInfoReceive ? response : null; @@ -166,7 +166,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { /// Unsubscribes from order subscription. /// - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future unsubscribeOrder() async { if (subscription == null) { return null; @@ -178,7 +178,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetResponse.fromJson(response.forget); @@ -186,7 +186,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { /// Unsubscribes all order subscriptions (Subscriptions to a single order or list). /// - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future unsubscribeAllOrder() async { final ForgetAllReceive response = await _api.unsubscribeAll(method: ForgetStreamType.p2pOrder); @@ -194,7 +194,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetAllResponse.fromJson(response.forgetAll); @@ -203,7 +203,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { /// Cancels this order /// /// Returns an order with updated status if successful. - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future cancel() async { final P2pOrderCancelReceive response = await cancelRaw(); return P2pOrderCancelResponse.fromJson(response.p2pOrderCancel); @@ -212,7 +212,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { /// Cancels this order /// /// Returns an order with updated status if successful. - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future cancelRaw() async { final P2pOrderCancelReceive response = await _api.call(request: P2pOrderCancelRequest(id: p2pOrderInfo?.id)); @@ -220,7 +220,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -229,7 +229,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { /// Confirms this order /// /// Returns an order with updated status if successful. - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future confirm() async { final P2pOrderConfirmReceive response = await confirmRaw(); @@ -239,7 +239,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { /// Confirms this order /// /// Returns an order with updated status if successful. - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future confirmRaw() async { final P2pOrderConfirmReceive response = await _api.call(request: P2pOrderConfirmRequest(id: p2pOrderInfo?.id)); @@ -247,7 +247,7 @@ class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/p2p_order_list_response_result.dart b/lib/api/response/p2p_order_list_response_result.dart index 2a0459a68f..d094361c9a 100644 --- a/lib/api/response/p2p_order_list_response_result.dart +++ b/lib/api/response/p2p_order_list_response_result.dart @@ -94,7 +94,7 @@ class P2pOrderListResponse extends P2pOrderListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -132,7 +132,7 @@ class P2pOrderListResponse extends P2pOrderListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is P2pOrderListReceive ? response : null; @@ -141,7 +141,7 @@ class P2pOrderListResponse extends P2pOrderListResponseModel { /// Unsubscribes from order list subscription. /// - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future unsubscribeOrderList() async { if (subscription == null) { return null; @@ -153,7 +153,7 @@ class P2pOrderListResponse extends P2pOrderListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetResponse.fromJson(response.forget); @@ -161,7 +161,7 @@ class P2pOrderListResponse extends P2pOrderListResponseModel { /// Unsubscribes from all order subscriptions (Subscriptions to a single order or list). /// - /// Throws a [P2POrderException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future unsubscribeAllOrder() => P2pOrderInfoResponse.unsubscribeAllOrder(); diff --git a/lib/api/response/p2p_order_review_response_result.dart b/lib/api/response/p2p_order_review_response_result.dart index e33f52528e..8e4e29fe9b 100644 --- a/lib/api/response/p2p_order_review_response_result.dart +++ b/lib/api/response/p2p_order_review_response_result.dart @@ -55,7 +55,7 @@ class P2pOrderReviewResponse extends P2pOrderReviewResponseModel { /// Cancel a P2P order review. /// /// For parameters information refer to [P2pOrderReviewReceive]. - /// Throws an [P2POrderException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future reviewOrderRaw( P2pOrderReviewRequest request, ) async { @@ -64,7 +64,7 @@ class P2pOrderReviewResponse extends P2pOrderReviewResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -73,7 +73,7 @@ class P2pOrderReviewResponse extends P2pOrderReviewResponseModel { /// Cancel a P2P order review. /// /// For parameters information refer to [P2pOrderReviewReceive]. - /// Throws an [P2POrderException] if API response contains an error. + /// Throws an [BaseAPIException] if API response contains an error. static Future reviewOrder( P2pOrderReviewRequest request, ) async { diff --git a/lib/api/response/p2p_payment_methods_response_result.dart b/lib/api/response/p2p_payment_methods_response_result.dart index a7d130588f..7a464168ae 100644 --- a/lib/api/response/p2p_payment_methods_response_result.dart +++ b/lib/api/response/p2p_payment_methods_response_result.dart @@ -73,7 +73,7 @@ class P2pPaymentMethodsResponse extends P2pPaymentMethodsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - P2POrderException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/payment_methods_response_result.dart b/lib/api/response/payment_methods_response_result.dart index 32b4aa502d..7847473d31 100644 --- a/lib/api/response/payment_methods_response_result.dart +++ b/lib/api/response/payment_methods_response_result.dart @@ -63,7 +63,7 @@ class PaymentMethodsResponse extends PaymentMethodsResponseModel { /// Get List of available payment methods for a given country. /// /// For parameters information refer to [PaymentMethodsRequest]. - /// Throws an [PaymentException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future updateApplication( PaymentMethodsRequest request) async { final PaymentMethodsReceive response = await _api.call(request: request); @@ -71,7 +71,7 @@ class PaymentMethodsResponse extends PaymentMethodsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - PaymentException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return PaymentMethodsResponse.fromJson(response.paymentMethods); diff --git a/lib/api/response/paymentagent_list_response_result.dart b/lib/api/response/paymentagent_list_response_result.dart index 2656b74821..fd0c3f7d7b 100644 --- a/lib/api/response/paymentagent_list_response_result.dart +++ b/lib/api/response/paymentagent_list_response_result.dart @@ -56,7 +56,7 @@ class PaymentagentListResponse extends PaymentagentListResponseModel { /// Returns a list of Payment Agents for a given country for a given currency. /// /// For parameters information refer to [PaymentagentListRequest]. - /// Throws a [PaymentAgentException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetch( PaymentagentListRequest request, ) async { @@ -65,7 +65,7 @@ class PaymentagentListResponse extends PaymentagentListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - PaymentAgentException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return PaymentagentListResponse.fromJson(response.paymentagentList); diff --git a/lib/api/response/paymentagent_transfer_response_result.dart b/lib/api/response/paymentagent_transfer_response_result.dart index c210072c7c..5367e3d2f9 100644 --- a/lib/api/response/paymentagent_transfer_response_result.dart +++ b/lib/api/response/paymentagent_transfer_response_result.dart @@ -80,7 +80,7 @@ class PaymentagentTransferResponse extends PaymentagentTransferResponseModel { /// /// This call is available only to accounts that are approved payment agents. /// For parameters information refer to [PaymentagentTransferRequest]. - /// Throws a [PaymentAgentException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future transfer( PaymentagentTransferRequest request, ) async { @@ -90,7 +90,7 @@ class PaymentagentTransferResponse extends PaymentagentTransferResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - PaymentAgentException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return PaymentagentTransferResponse.fromJson( diff --git a/lib/api/response/paymentagent_withdraw_response_result.dart b/lib/api/response/paymentagent_withdraw_response_result.dart index 4caa274b66..e416a89f67 100644 --- a/lib/api/response/paymentagent_withdraw_response_result.dart +++ b/lib/api/response/paymentagent_withdraw_response_result.dart @@ -70,7 +70,7 @@ class PaymentagentWithdrawResponse extends PaymentagentWithdrawResponseModel { /// Initiates a withdrawal to an approved payment agent. /// /// For parameters information refer to [PaymentagentWithdrawRequest]. - /// Throws a [PaymentAgentException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future withdraw( PaymentagentWithdrawRequest request, ) async { @@ -80,7 +80,7 @@ class PaymentagentWithdrawResponse extends PaymentagentWithdrawResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - PaymentAgentException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return PaymentagentWithdrawResponse.fromJson(response.paymentagentWithdraw, diff --git a/lib/api/response/payout_currencies_response_result.dart b/lib/api/response/payout_currencies_response_result.dart index 5b556e045f..3186bf5fa8 100644 --- a/lib/api/response/payout_currencies_response_result.dart +++ b/lib/api/response/payout_currencies_response_result.dart @@ -64,7 +64,7 @@ class PayoutCurrenciesResponse extends PayoutCurrenciesResponseModel { /// Retrieves a list of available option payout currencies. /// /// If a user is logged in, only the currencies available for the account will be returned. - /// Throws a [PayoutCurrencyException] if API response contains a error + /// Throws a [BaseAPIException] if API response contains a error static Future fetchPayoutCurrencies([ PayoutCurrenciesRequest? request, ]) async { @@ -75,7 +75,7 @@ class PayoutCurrenciesResponse extends PayoutCurrenciesResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - PayoutCurrencyException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return PayoutCurrenciesResponse.fromJson(response.payoutCurrencies); diff --git a/lib/api/response/ping_response_result.dart b/lib/api/response/ping_response_result.dart index beaebf0d02..d9cd881e22 100644 --- a/lib/api/response/ping_response_result.dart +++ b/lib/api/response/ping_response_result.dart @@ -54,7 +54,7 @@ class PingResponse extends PingResponseModel { /// Requests the ping request to the server. /// /// Mostly used to test the connection or to keep it alive. - /// Throws a [PingException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future pingMethodRaw([PingRequest? request]) async { final PingReceive response = await _api.call( request: request ?? const PingRequest(), @@ -63,7 +63,7 @@ class PingResponse extends PingResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - PingException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -72,7 +72,7 @@ class PingResponse extends PingResponseModel { /// Requests the ping request to the server. /// /// Mostly used to test the connection or to keep it alive. - /// Throws a [PingException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future pingMethod([PingRequest? request]) async { final PingReceive response = await pingMethodRaw(request); diff --git a/lib/api/response/portfolio_response_result.dart b/lib/api/response/portfolio_response_result.dart index caab859ee2..86e4e44e9c 100644 --- a/lib/api/response/portfolio_response_result.dart +++ b/lib/api/response/portfolio_response_result.dart @@ -54,7 +54,7 @@ class PortfolioResponse extends PortfolioResponseModel { /// Gets the portfolio fo logged-in account /// - /// Throws a [PortfolioException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchPortfolio( PortfolioRequest request) async { final PortfolioReceive response = await _api.call(request: request); @@ -62,7 +62,7 @@ class PortfolioResponse extends PortfolioResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - PortfolioException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return PortfolioResponse.fromJson(response.portfolio); diff --git a/lib/api/response/profit_table_response_result.dart b/lib/api/response/profit_table_response_result.dart index 38a3e3739a..c4593de8aa 100644 --- a/lib/api/response/profit_table_response_result.dart +++ b/lib/api/response/profit_table_response_result.dart @@ -56,14 +56,14 @@ class ProfitTableResponse extends ProfitTableResponseModel { /// Retrieves a summary of account Profit Table, according to given search criteria. /// /// For parameters information refer to [ProfitTableRequest]. - /// Throws a [ProfitTableException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetch(ProfitTableRequest request) async { final ProfitTableReceive response = await _api.call(request: request); checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ProfitTableException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ProfitTableResponse.fromJson(response.profitTable); diff --git a/lib/api/response/proposal_open_contract_response_result.dart b/lib/api/response/proposal_open_contract_response_result.dart index 4ccf0bf686..c233b7dec7 100644 --- a/lib/api/response/proposal_open_contract_response_result.dart +++ b/lib/api/response/proposal_open_contract_response_result.dart @@ -79,7 +79,7 @@ class ProposalOpenContractResponse extends ProposalOpenContractResponseModel { /// Gets the current spot of the the bought contract specified in [ProposalOpenContractRequest] /// - /// Throws a [ContractOperationException] if API response contains any error + /// Throws a [BaseAPIException] if API response contains any error static Future fetchContractState( ProposalOpenContractRequest request, ) async { @@ -90,7 +90,7 @@ class ProposalOpenContractResponse extends ProposalOpenContractResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ProposalOpenContractResponse.fromJson( @@ -99,7 +99,7 @@ class ProposalOpenContractResponse extends ProposalOpenContractResponseModel { /// Subscribes to the bought contract state specified in [ProposalOpenContractRequest] /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Stream subscribeContractState( ProposalOpenContractRequest request, { RequestCompareFunction? comparePredicate, @@ -111,8 +111,7 @@ class ProposalOpenContractResponse extends ProposalOpenContractResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException( - baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is ProposalOpenContractReceive @@ -126,7 +125,7 @@ class ProposalOpenContractResponse extends ProposalOpenContractResponseModel { /// Unsubscribes from open contract subscription. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future unsubscribeOpenContract() async { if (subscription == null) { return null; @@ -138,7 +137,7 @@ class ProposalOpenContractResponse extends ProposalOpenContractResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetResponse.fromJson(response.forget); @@ -146,7 +145,7 @@ class ProposalOpenContractResponse extends ProposalOpenContractResponseModel { /// Unsubscribes all open contract subscriptions. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future unsubscribeAllOpenContract() async { final ForgetAllReceive response = await _api.unsubscribeAll( method: ForgetStreamType.proposalOpenContract, @@ -155,7 +154,7 @@ class ProposalOpenContractResponse extends ProposalOpenContractResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetAllResponse.fromJson(response.forgetAll); @@ -165,14 +164,14 @@ class ProposalOpenContractResponse extends ProposalOpenContractResponseModel { /// /// [price] is the Minimum price at which to sell the contract, /// Default be 0 for 'sell at market'. - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future sell( {required int contractId, double price = 0}) => SellResponse.sellContract(SellRequest(sell: contractId, price: price)); /// Cancels this contract /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future cancel(int contractId) => CancelResponse.cancelContract(CancelRequest(cancel: contractId)); diff --git a/lib/api/response/proposal_response_result.dart b/lib/api/response/proposal_response_result.dart index 2df2317e58..00df4fd869 100644 --- a/lib/api/response/proposal_response_result.dart +++ b/lib/api/response/proposal_response_result.dart @@ -1,9 +1,8 @@ // ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import import 'package:equatable/equatable.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; -import 'package:flutter_deriv_api/api/exceptions/contract_operations_exception.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/api/models/enums.dart'; import 'package:flutter_deriv_api/api/response/buy_response_result.dart'; import 'package:flutter_deriv_api/api/response/forget_all_response_result.dart'; @@ -77,7 +76,7 @@ class ProposalResponse extends ProposalResponseModel { /// Gets the price proposal for contract /// /// For parameters information refer to [ProposalRequest] - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchPriceForContract( ProposalRequest request, ) async { @@ -86,7 +85,7 @@ class ProposalResponse extends ProposalResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ProposalResponse.fromJson(response.proposal, response.subscription); @@ -95,7 +94,7 @@ class ProposalResponse extends ProposalResponseModel { /// Gets the price proposal for contract. /// /// For parameters information refer to [ProposalRequest] - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Stream subscribePriceForContract( ProposalRequest request, { RequestCompareFunction? comparePredicate, @@ -107,8 +106,7 @@ class ProposalResponse extends ProposalResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException( - baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is ProposalReceive @@ -122,7 +120,7 @@ class ProposalResponse extends ProposalResponseModel { /// Unsubscribes from price proposal subscription. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future unsubscribeProposal() async { if (subscription == null) { return null; @@ -134,7 +132,7 @@ class ProposalResponse extends ProposalResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetResponse.fromJson(response.forget); @@ -142,7 +140,7 @@ class ProposalResponse extends ProposalResponseModel { /// Unsubscribes all proposal subscriptions. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future unsubscribeAllProposal() async { final ForgetAllReceive response = await _api.unsubscribeAll(method: ForgetStreamType.proposal); @@ -150,7 +148,7 @@ class ProposalResponse extends ProposalResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetAllResponse.fromJson(response.forgetAll); @@ -158,7 +156,7 @@ class ProposalResponse extends ProposalResponseModel { /// Buys this proposal contract with [price] specified. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future buy({double? price}) => BuyResponse.buyMethod(BuyRequest( buy: proposal?.id, price: price ?? proposal?.askPrice, @@ -166,7 +164,7 @@ class ProposalResponse extends ProposalResponseModel { /// Buys this proposal contract with [price] specified and subscribes to it. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Stream buyAndSubscribe({double? price}) => BuyResponse.buyAndSubscribe(BuyRequest( buy: proposal?.id, diff --git a/lib/api/response/reality_check_response_result.dart b/lib/api/response/reality_check_response_result.dart index 53a719a58a..e2e438b247 100644 --- a/lib/api/response/reality_check_response_result.dart +++ b/lib/api/response/reality_check_response_result.dart @@ -58,7 +58,7 @@ class RealityCheckResponse extends RealityCheckResponseModel { /// A `reality check` means a display of time elapsed since the session began, and associated client profit/loss. /// The reality check facility is a regulatory requirement for certain landing companies. /// For parameters information refer to [RealityCheckRequest]. - /// Throws a [RealityCheckException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future check([ RealityCheckRequest? request, ]) async { @@ -69,7 +69,7 @@ class RealityCheckResponse extends RealityCheckResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - RealityCheckException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return RealityCheckResponse.fromJson(response.realityCheck); diff --git a/lib/api/response/reset_password_response_result.dart b/lib/api/response/reset_password_response_result.dart index bbfdbf6f90..12100483f2 100644 --- a/lib/api/response/reset_password_response_result.dart +++ b/lib/api/response/reset_password_response_result.dart @@ -58,7 +58,7 @@ class ResetPasswordResponse extends ResetPasswordResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - UserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ResetPasswordResponse.fromJson(response?.resetPassword); diff --git a/lib/api/response/residence_list_response_result.dart b/lib/api/response/residence_list_response_result.dart index 17aa6b3cfd..d581630799 100644 --- a/lib/api/response/residence_list_response_result.dart +++ b/lib/api/response/residence_list_response_result.dart @@ -63,7 +63,7 @@ class ResidenceListResponse extends ResidenceListResponseModel { /// Gets Residence list for the given [ResidenceListRequest] /// - /// Throws a [ResidenceException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchResidenceList([ ResidenceListRequest? request, ]) async { @@ -74,7 +74,7 @@ class ResidenceListResponse extends ResidenceListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ResidenceException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ResidenceListResponse.fromJson(response.residenceList); diff --git a/lib/api/response/revoke_oauth_app_response_result.dart b/lib/api/response/revoke_oauth_app_response_result.dart index c37c883105..ab6cda2c65 100644 --- a/lib/api/response/revoke_oauth_app_response_result.dart +++ b/lib/api/response/revoke_oauth_app_response_result.dart @@ -52,7 +52,7 @@ class RevokeOauthAppResponse extends RevokeOauthAppResponseModel { /// Revokes access of a particular app. /// /// For parameters information refer to [RevokeOauthAppRequest]. - /// Throws an [AppException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future revokeOauthApplication( RevokeOauthAppRequest request, ) async { @@ -61,7 +61,7 @@ class RevokeOauthAppResponse extends RevokeOauthAppResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AppException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return RevokeOauthAppResponse.fromJson(response.revokeOauthApp); diff --git a/lib/api/response/sell_response_result.dart b/lib/api/response/sell_response_result.dart index c7950c4531..8bf308af2c 100644 --- a/lib/api/response/sell_response_result.dart +++ b/lib/api/response/sell_response_result.dart @@ -56,14 +56,14 @@ class SellResponse extends SellResponseModel { /// Sells a contract with parameters specified in [SellRequest]. /// - /// Throws a [ContractOperationException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future sellContract(SellRequest request) async { final SellReceive response = await _api.call(request: request); checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return SellResponse.fromJson(response.sell); @@ -71,7 +71,7 @@ class SellResponse extends SellResponseModel { /// tries to sell any expired contracts and returns the number of sold contracts as [SellExpiredContractModel]. /// - /// Throws [ContractOperationException] if API response contains an error + /// Throws [BaseAPIException] if API response contains an error static Future sellExpiredContracts([ SellExpiredRequest? request, ]) async { @@ -82,7 +82,7 @@ class SellResponse extends SellResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ContractOperationException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return SellExpiredResponse.fromJson(response.sellExpired); diff --git a/lib/api/response/service_token_response_result.dart b/lib/api/response/service_token_response_result.dart index 69be61aaf3..d11b839196 100644 --- a/lib/api/response/service_token_response_result.dart +++ b/lib/api/response/service_token_response_result.dart @@ -58,7 +58,7 @@ class ServiceTokenResponse extends ServiceTokenResponseModel { /// /// Retrieves the authorization token for the specified service. /// For parameters information refer to [ServiceTokenRequest]. - /// Throws a [APITokenException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future getServiceTokenRaw( ServiceTokenRequest request, ) async { @@ -67,7 +67,7 @@ class ServiceTokenResponse extends ServiceTokenResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - APITokenException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -77,7 +77,7 @@ class ServiceTokenResponse extends ServiceTokenResponseModel { /// /// Retrieves the authorization token for the specified service. /// For parameters information refer to [ServiceTokenRequest]. - /// Throws a [APITokenException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future getServiceToken( ServiceTokenRequest request, ) async { diff --git a/lib/api/response/set_account_currency_response_result.dart b/lib/api/response/set_account_currency_response_result.dart index 162d16114a..e468ea9aa2 100644 --- a/lib/api/response/set_account_currency_response_result.dart +++ b/lib/api/response/set_account_currency_response_result.dart @@ -53,7 +53,7 @@ class SetAccountCurrencyResponse extends SetAccountCurrencyResponseModel { /// /// Please note that account currency can only be set once, and then can never be changed. /// For parameters information refer to [SetAccountCurrencyRequest]. - /// Throws an [AccountCurrencyException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future setCurrency( SetAccountCurrencyRequest request, ) async { @@ -63,7 +63,7 @@ class SetAccountCurrencyResponse extends SetAccountCurrencyResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AccountCurrencyException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return SetAccountCurrencyResponse.fromJson(response.setAccountCurrency); diff --git a/lib/api/response/set_financial_assessment_response_result.dart b/lib/api/response/set_financial_assessment_response_result.dart index f5574aae3a..24f0b02bb8 100644 --- a/lib/api/response/set_financial_assessment_response_result.dart +++ b/lib/api/response/set_financial_assessment_response_result.dart @@ -59,7 +59,7 @@ class SetFinancialAssessmentResponse /// understand the risks involved with binary options trading. /// /// For parameters information refer to [SetFinancialAssessmentRequest]. - /// Throws a [FinancialAssessmentException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future setAssessment( SetFinancialAssessmentRequest request, ) async { @@ -69,7 +69,7 @@ class SetFinancialAssessmentResponse checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - FinancialAssessmentException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return SetFinancialAssessmentResponse.fromJson( diff --git a/lib/api/response/set_self_exclusion_response_result.dart b/lib/api/response/set_self_exclusion_response_result.dart index d778d02380..5e6e1857d6 100644 --- a/lib/api/response/set_self_exclusion_response_result.dart +++ b/lib/api/response/set_self_exclusion_response_result.dart @@ -52,7 +52,7 @@ class SetSelfExclusionResponse extends SetSelfExclusionResponseModel { /// Sets Self-Exclusion (this call should be used in conjunction with [fetchSelfExclusion]) /// /// For parameters information refer to [SetSelfExclusionRequest]. - /// Throws a [SelfExclusionException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future setSelfExclusionMethod( SetSelfExclusionRequest request) async { final SetSelfExclusionReceive response = await _api.call(request: request); @@ -60,7 +60,7 @@ class SetSelfExclusionResponse extends SetSelfExclusionResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - SelfExclusionException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return SetSelfExclusionResponse.fromJson(response.setSelfExclusion); diff --git a/lib/api/response/set_settings_response_result.dart b/lib/api/response/set_settings_response_result.dart index 36199363d0..a48625a2c4 100644 --- a/lib/api/response/set_settings_response_result.dart +++ b/lib/api/response/set_settings_response_result.dart @@ -51,7 +51,7 @@ class SetSettingsResponse extends SetSettingsResponseModel { /// Changes the user's settings with parameters specified as [SetSettingsRequest] /// - /// Throws an [AccountSettingsException] if API response contains an error + /// Throws an [BaseAPIException] if API response contains an error static Future changeAccountSetting( SetSettingsRequest request, ) async { @@ -60,7 +60,7 @@ class SetSettingsResponse extends SetSettingsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - AccountSettingsException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return SetSettingsResponse(setSettings: response.setSettings ?? 0); diff --git a/lib/api/response/statement_response_result.dart b/lib/api/response/statement_response_result.dart index 2c4bd3cec2..c5b60f4ebb 100644 --- a/lib/api/response/statement_response_result.dart +++ b/lib/api/response/statement_response_result.dart @@ -55,14 +55,14 @@ class StatementResponse extends StatementResponseModel { /// Retrieves a summary of account transactions, according to given search criteria. /// /// For parameters information refer to [StatementRequest]. - /// Throws a [StatementException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetch(StatementRequest request) async { final StatementReceive response = await _api.call(request: request); checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - StatementException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return StatementResponse.fromJson(response.statement); diff --git a/lib/api/response/states_list_response_result.dart b/lib/api/response/states_list_response_result.dart index 0482ec3ed3..bab5ab4094 100644 --- a/lib/api/response/states_list_response_result.dart +++ b/lib/api/response/states_list_response_result.dart @@ -63,7 +63,7 @@ class StatesListResponse extends StatesListResponseModel { /// Gets the list of states for the given [StatesListRequest] /// - /// Throws a [StateException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchStatesList( StatesListRequest request) async { final StatesListReceive response = await _api.call(request: request); @@ -71,7 +71,7 @@ class StatesListResponse extends StatesListResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - StateException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return StatesListResponse.fromJson(response.statesList); diff --git a/lib/api/response/ticks_history_response_result.dart b/lib/api/response/ticks_history_response_result.dart index af6c13e6d5..6f5ad2d9db 100644 --- a/lib/api/response/ticks_history_response_result.dart +++ b/lib/api/response/ticks_history_response_result.dart @@ -104,7 +104,7 @@ class TicksHistoryResponse extends TicksHistoryResponseModel { /// Gets the [TickHistory] for the given [symbol] in [request] /// - /// Throws a [TickException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchTickHistory( TicksHistoryRequest request, ) async { @@ -113,7 +113,7 @@ class TicksHistoryResponse extends TicksHistoryResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TickException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return TicksHistoryResponse.fromJson(response.candles, response.history, @@ -122,7 +122,7 @@ class TicksHistoryResponse extends TicksHistoryResponseModel { /// Gets ticks history and its stream /// - /// Throws [TickException] if API response contains an error + /// Throws [BaseAPIException] if API response contains an error static Future fetchTicksAndSubscribe( TicksHistoryRequest request, { RequestCompareFunction? comparePredicate, @@ -136,7 +136,7 @@ class TicksHistoryResponse extends TicksHistoryResponseModel { checkException( response: firstResponse, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TickException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); if (firstResponse is TicksHistoryReceive) { return TickHistorySubscription( @@ -150,7 +150,7 @@ class TicksHistoryResponse extends TicksHistoryResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TickException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is TicksReceive diff --git a/lib/api/response/ticks_response_result.dart b/lib/api/response/ticks_response_result.dart index 86a322574f..d689bceb68 100644 --- a/lib/api/response/ticks_response_result.dart +++ b/lib/api/response/ticks_response_result.dart @@ -71,7 +71,7 @@ class TicksResponse extends TicksResponseModel { /// Subscribes to a tick for given [TickRequest] /// - /// Throws [TickException] if API response contains an error + /// Throws [BaseAPIException] if API response contains an error static Stream subscribeTick( TicksRequest tickRequest, { RequestCompareFunction? comparePredicate, @@ -83,7 +83,7 @@ class TicksResponse extends TicksResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TickException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is TicksReceive @@ -97,7 +97,7 @@ class TicksResponse extends TicksResponseModel { /// Unsubscribes all ticks. /// - /// Throws a [TickException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future unsubscribeAllTicks() async { final ForgetAllReceive response = await _api.unsubscribeAll(method: ForgetStreamType.ticks); @@ -105,7 +105,7 @@ class TicksResponse extends TicksResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TickException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetAllResponse.fromJson(response.forgetAll); diff --git a/lib/api/response/time_response_result.dart b/lib/api/response/time_response_result.dart index 0fd05e0ffc..08a3227a67 100644 --- a/lib/api/response/time_response_result.dart +++ b/lib/api/response/time_response_result.dart @@ -61,7 +61,7 @@ class TimeResponse extends TimeResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ServerTimeException(), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/tnc_approval_response_result.dart b/lib/api/response/tnc_approval_response_result.dart index e439792bd0..1966a1926e 100644 --- a/lib/api/response/tnc_approval_response_result.dart +++ b/lib/api/response/tnc_approval_response_result.dart @@ -52,7 +52,7 @@ class TncApprovalResponse extends TncApprovalResponseModel { /// Approve the latest version of terms and conditions. /// /// For parameters information refer to [TncApprovalRequest]. - /// Throws a [UserException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future verify( TncApprovalRequest request, ) async { @@ -61,7 +61,7 @@ class TncApprovalResponse extends TncApprovalResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - UserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return TncApprovalResponse.fromJson(response.tncApproval); diff --git a/lib/api/response/topup_virtual_response_result.dart b/lib/api/response/topup_virtual_response_result.dart index df28ba593c..fb843a85b6 100644 --- a/lib/api/response/topup_virtual_response_result.dart +++ b/lib/api/response/topup_virtual_response_result.dart @@ -56,7 +56,7 @@ class TopupVirtualResponse extends TopupVirtualResponseModel { /// Topes up the virtual-money's account balance becomes when it becomes low. /// /// For parameters information refer to [TopupVirtualRequest]. - /// Throws a [TopUpVirtualException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future topUp([ TopupVirtualRequest? request, ]) async { @@ -67,7 +67,7 @@ class TopupVirtualResponse extends TopupVirtualResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TopUpVirtualException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return TopupVirtualResponse.fromJson(response.topupVirtual); diff --git a/lib/api/response/trading_durations_response_result.dart b/lib/api/response/trading_durations_response_result.dart index 0b3b7a6ca8..9cc7dd36aa 100644 --- a/lib/api/response/trading_durations_response_result.dart +++ b/lib/api/response/trading_durations_response_result.dart @@ -65,7 +65,7 @@ class TradingDurationsResponse extends TradingDurationsResponseModel { /// /// If the user is logged in, only the assets available for that user's landing company will be returned. /// For parameters information refer to [TradingDurationsRequest]. - /// Throws a [TradingException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchTradingDurations( TradingDurationsRequest request, ) async { @@ -74,7 +74,7 @@ class TradingDurationsResponse extends TradingDurationsResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TradingException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return TradingDurationsResponse.fromJson(response.tradingDurations); diff --git a/lib/api/response/trading_platform_accounts_response_result.dart b/lib/api/response/trading_platform_accounts_response_result.dart index b019f395e6..806ddd905c 100644 --- a/lib/api/response/trading_platform_accounts_response_result.dart +++ b/lib/api/response/trading_platform_accounts_response_result.dart @@ -64,7 +64,7 @@ class TradingPlatformAccountsResponse /// /// Get list of Trading Platform accounts for client. /// For parameters information refer to [TradingPlatformAccountsRequest]. - /// Throws a [TradingPlatformException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future getAccounts( TradingPlatformAccountsRequest request, ) async { @@ -74,7 +74,7 @@ class TradingPlatformAccountsResponse checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TradingPlatformException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return TradingPlatformAccountsResponse.fromJson( diff --git a/lib/api/response/trading_platform_deposit_response_result.dart b/lib/api/response/trading_platform_deposit_response_result.dart index f462d7abcb..f01ad48e0d 100644 --- a/lib/api/response/trading_platform_deposit_response_result.dart +++ b/lib/api/response/trading_platform_deposit_response_result.dart @@ -52,7 +52,7 @@ class TradingPlatformDepositResponse /// /// Information about deposit transaction, or status of demo account top up. /// For parameters information refer to [TradingPlatformDepositRequest]. - /// Throws a [TradingPlatformException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future deposit( TradingPlatformDepositRequest request, ) async { @@ -62,7 +62,7 @@ class TradingPlatformDepositResponse checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TradingPlatformException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return TradingPlatformDepositResponse.fromJson( diff --git a/lib/api/response/trading_platform_new_account_response_result.dart b/lib/api/response/trading_platform_new_account_response_result.dart index 5799db3d69..f6fa27712a 100644 --- a/lib/api/response/trading_platform_new_account_response_result.dart +++ b/lib/api/response/trading_platform_new_account_response_result.dart @@ -57,7 +57,7 @@ class TradingPlatformNewAccountResponse /// /// This call creates new Trading account, either demo or real money. /// For parameters information refer to [TradingPlatformNewAccountRequest]. - /// Throws a [TradingPlatformException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future create( TradingPlatformNewAccountRequest request, ) async { @@ -67,7 +67,7 @@ class TradingPlatformNewAccountResponse checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TradingPlatformException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return TradingPlatformNewAccountResponse.fromJson( diff --git a/lib/api/response/trading_servers_response_result.dart b/lib/api/response/trading_servers_response_result.dart index 78d5524eed..8807252094 100644 --- a/lib/api/response/trading_servers_response_result.dart +++ b/lib/api/response/trading_servers_response_result.dart @@ -64,7 +64,7 @@ class TradingServersResponse extends TradingServersResponseModel { /// Get the list of servers for platform. Currently, only mt5 is supported /// /// For parameters information refer to [TradingServersRequest]. - /// Throws a [TradingException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchTradingServers( TradingServersRequest request, ) async { @@ -73,7 +73,7 @@ class TradingServersResponse extends TradingServersResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TradingException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return TradingServersResponse.fromJson(response.tradingServers); diff --git a/lib/api/response/trading_times_response_result.dart b/lib/api/response/trading_times_response_result.dart index 17f939da08..6c4af9d1b0 100644 --- a/lib/api/response/trading_times_response_result.dart +++ b/lib/api/response/trading_times_response_result.dart @@ -56,7 +56,7 @@ class TradingTimesResponse extends TradingTimesResponseModel { /// Receives a list of market opening times for a given date. /// /// For parameters information refer to [TradingTimesRequest]. - /// Throws a [TradingException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future fetchTradingTimes( TradingTimesRequest request, ) async { @@ -65,7 +65,7 @@ class TradingTimesResponse extends TradingTimesResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TradingException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return TradingTimesResponse.fromJson(response.tradingTimes); diff --git a/lib/api/response/transaction_response_result.dart b/lib/api/response/transaction_response_result.dart index c81c36bc08..0d97e9a495 100644 --- a/lib/api/response/transaction_response_result.dart +++ b/lib/api/response/transaction_response_result.dart @@ -75,7 +75,7 @@ class TransactionResponse extends TransactionResponseModel { /// Subscribes to account's transactions /// - /// Throws a [TransactionsException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Stream subscribeTransactions({ RequestCompareFunction? comparePredicate, }) => @@ -88,7 +88,7 @@ class TransactionResponse extends TransactionResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TransactionsException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is TransactionReceive @@ -101,7 +101,7 @@ class TransactionResponse extends TransactionResponseModel { /// Unsubscribes from transaction subscription. /// - /// Throws a [TransactionsException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error Future unsubscribeTransaction() async { if (subscription == null) { return null; @@ -113,7 +113,7 @@ class TransactionResponse extends TransactionResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TransactionsException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetResponse.fromJson(response.forget); @@ -121,7 +121,7 @@ class TransactionResponse extends TransactionResponseModel { /// Unsubscribes all transaction subscriptions. /// - /// Throws a [TransactionsException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future unsubscribeAllTransaction() async { final ForgetAllReceive response = await _api.unsubscribeAll(method: ForgetStreamType.transaction); @@ -129,7 +129,7 @@ class TransactionResponse extends TransactionResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TransactionsException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return ForgetAllResponse.fromJson(response.forgetAll); diff --git a/lib/api/response/transfer_between_accounts_response_result.dart b/lib/api/response/transfer_between_accounts_response_result.dart index 945857f7e2..393049fcc7 100644 --- a/lib/api/response/transfer_between_accounts_response_result.dart +++ b/lib/api/response/transfer_between_accounts_response_result.dart @@ -103,7 +103,7 @@ class TransferBetweenAccountsResponse /// Transfer funds between your fiat and crypto currency accounts (for a fee). /// Please note that account_from should be same as current authorized account. /// For parameters information refer to [TransferBetweenAccountsRequest]. - /// Throws a [TransferException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future transfer( TransferBetweenAccountsRequest request, ) async { @@ -113,7 +113,7 @@ class TransferBetweenAccountsResponse checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - TransferException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return TransferBetweenAccountsResponse.fromJson( diff --git a/lib/api/response/verify_email_response_result.dart b/lib/api/response/verify_email_response_result.dart index 235532ddc0..03468dfd66 100644 --- a/lib/api/response/verify_email_response_result.dart +++ b/lib/api/response/verify_email_response_result.dart @@ -53,7 +53,7 @@ class VerifyEmailResponse extends VerifyEmailResponseModel { /// /// The system will send an email to the address containing a security code for verification. /// For parameters information refer to [VerifyEmailRequest]. - /// Throws a [UserException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error static Future verify( VerifyEmailRequest request, ) async { @@ -62,7 +62,7 @@ class VerifyEmailResponse extends VerifyEmailResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - UserException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return VerifyEmailResponse.fromJson(response.verifyEmail); diff --git a/lib/api/response/website_status_response_result.dart b/lib/api/response/website_status_response_result.dart index d7641881f2..058b5a26ac 100644 --- a/lib/api/response/website_status_response_result.dart +++ b/lib/api/response/website_status_response_result.dart @@ -76,7 +76,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { /// Gets Website status. /// /// For parameters information refer to [WebsiteStatusRequest]. - /// Throws a [WebsiteStatusException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Future fetchWebsiteStatusRaw([ WebsiteStatusRequest? request, ]) async { @@ -87,7 +87,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - WebsiteStatusException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -95,7 +95,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { /// Subscribes to website status. /// - /// Throws a [WebsiteStatusException] if API response contains an error. + /// Throws a [BaseAPIException] if API response contains an error. static Stream subscribeWebsiteStatusRaw( WebsiteStatusRequest request, { RequestCompareFunction? comparePredicate, @@ -107,7 +107,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - WebsiteStatusException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response is WebsiteStatusReceive ? response : null; @@ -116,7 +116,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { /// Unsubscribes from website status. /// - /// Throws an [WebsiteStatusException] if the API response contains an error. + /// Throws an [BaseAPIException] if the API response contains an error. Future unsubscribeWebsiteStatusRaw() async { if (subscription == null) { return null; @@ -128,7 +128,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - WebsiteStatusException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -136,7 +136,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { /// Unsubscribes all website status subscriptions. /// - /// Throws an [WebsiteStatusException] if the API response contains an error. + /// Throws an [BaseAPIException] if the API response contains an error. static Future unsubscribeAllWebsiteStatusRaw() async { final ForgetAllReceive response = await _api.unsubscribeAll(method: ForgetStreamType.websiteStatus); @@ -144,7 +144,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - WebsiteStatusException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; @@ -152,7 +152,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { /// Gets Website status. /// - /// Throws an [WebsiteStatusException] if the API response contains an error. + /// Throws an [BaseAPIException] if the API response contains an error. static Future fetchWebsiteStatus([ WebsiteStatusRequest? request, ]) async { @@ -183,7 +183,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { /// Unsubscribes from website status. /// - /// Throws an [WebsiteStatusException] if the API response contains an error. + /// Throws an [BaseAPIException] if the API response contains an error. Future unsubscribeWebsiteStatus() async { final ForgetReceive? response = await unsubscribeWebsiteStatusRaw(); @@ -192,7 +192,7 @@ class WebsiteStatusResponse extends WebsiteStatusResponseModel { /// Unsubscribes all website status subscriptions. /// - /// Throws an [WebsiteStatusException] if the API response contains an error. + /// Throws an [BaseAPIException] if the API response contains an error. static Future unsubscribeAllWebsiteStatus() async { final ForgetAllReceive response = await unsubscribeAllWebsiteStatusRaw(); diff --git a/lib/basic_api/generated/methods/active_symbols_receive_methods.json b/lib/basic_api/generated/methods/active_symbols_receive_methods.json index e646705a2f..998e66b0de 100644 --- a/lib/basic_api/generated/methods/active_symbols_receive_methods.json +++ b/lib/basic_api/generated/methods/active_symbols_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the list of active symbols.\n ///\n /// For parameters information refer to [ActiveSymbolsRequest].\n /// Throws an [ActiveSymbolsException] if API response contains an error\n static Future fetchActiveSymbols(\n ActiveSymbolsRequest request,\n ) async {\n final ActiveSymbolsReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ActiveSymbolsException(baseExceptionModel: baseExceptionModel),\n );\n\n return ActiveSymbolsResponse.fromJson(response.activeSymbols);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the list of active symbols.\n ///\n /// For parameters information refer to [ActiveSymbolsRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future fetchActiveSymbols(\n ActiveSymbolsRequest request,\n ) async {\n final ActiveSymbolsReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ActiveSymbolsResponse.fromJson(response.activeSymbols);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/active_symbols_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/active_symbols_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/api_token_receive_methods.json b/lib/basic_api/generated/methods/api_token_receive_methods.json index d049c08e5a..fe3e68dee5 100644 --- a/lib/basic_api/generated/methods/api_token_receive_methods.json +++ b/lib/basic_api/generated/methods/api_token_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": " static final BaseAPI _api = Injector()();\n\n /// Creates an API tokens\n ///\n /// [name] is the name of the token.\n /// [scopes] is a list of permission scopes to provide with the token.\n /// [validForCurrentIPOnly] is optional and if you set this parameter during token creation,\n /// then the token created will only work for the IP address that was used to create the token\n /// Throws an [APITokenException] if API response contains an error.\n static Future create({\n required String name,\n required List scopes,\n bool? validForCurrentIPOnly,\n }) async {\n final ApiTokenReceive response = await _api.call(\n request: ApiTokenRequest(\n newToken: name,\n newTokenScopes: getStringListFromEnums(\n scopes), \n validForCurrentIpOnly: validForCurrentIPOnly,\n ),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n APITokenException(baseExceptionModel: baseExceptionModel),\n );\n\n return ApiTokenResponse.fromJson(response.apiToken);\n }\n\n /// Deletes the [token]\n ///\n /// Throws an [APITokenException] if API response contains an error\n static Future delete({\n required String token,\n }) async {\n final ApiTokenReceive response = await _api.call(\n request: ApiTokenRequest(deleteToken: token),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n APITokenException(baseExceptionModel: baseExceptionModel),\n );\n\n return ApiTokenResponse.fromJson(response.apiToken);\n }", + "methods": " static final BaseAPI _api = Injector()();\n\n /// Creates an API tokens\n ///\n /// [name] is the name of the token.\n /// [scopes] is a list of permission scopes to provide with the token.\n /// [validForCurrentIPOnly] is optional and if you set this parameter during token creation,\n /// then the token created will only work for the IP address that was used to create the token\n /// Throws an [BaseAPIException] if API response contains an error.\n static Future create({\n required String name,\n required List scopes,\n bool? validForCurrentIPOnly,\n }) async {\n final ApiTokenReceive response = await _api.call(\n request: ApiTokenRequest(\n newToken: name,\n newTokenScopes: getStringListFromEnums(\n scopes), \n validForCurrentIpOnly: validForCurrentIPOnly,\n ),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ApiTokenResponse.fromJson(response.apiToken);\n }\n\n /// Deletes the [token]\n ///\n /// Throws an [BaseAPIException] if API response contains an error\n static Future delete({\n required String token,\n }) async {\n final ApiTokenReceive response = await _api.call(\n request: ApiTokenRequest(deleteToken: token),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ApiTokenResponse.fromJson(response.apiToken);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/api_token_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/api_token_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/app_delete_receive_methods.json b/lib/basic_api/generated/methods/app_delete_receive_methods.json index 1e2f876b5b..fa8703186c 100644 --- a/lib/basic_api/generated/methods/app_delete_receive_methods.json +++ b/lib/basic_api/generated/methods/app_delete_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": " static final BaseAPI _api = Injector()();\n\n /// Deletes the application by appId specified in [AppDeleteRequest.appDelete].\n ///\n /// For parameters information refer to [AppDeleteRequest].\n /// Throws an [AppException] if API response contains an error\n static Future deleteApplication(\n AppDeleteRequest request) async {\n final AppDeleteReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AppException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppDeleteResponse.fromJson(response.appDelete);\n }", + "methods": " static final BaseAPI _api = Injector()();\n\n /// Deletes the application by appId specified in [AppDeleteRequest.appDelete].\n ///\n /// For parameters information refer to [AppDeleteRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future deleteApplication(\n AppDeleteRequest request) async {\n final AppDeleteReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppDeleteResponse.fromJson(response.appDelete);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_delete_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_delete_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/app_get_receive_methods.json b/lib/basic_api/generated/methods/app_get_receive_methods.json index 3266e24af7..f4ec13cb4e 100644 --- a/lib/basic_api/generated/methods/app_get_receive_methods.json +++ b/lib/basic_api/generated/methods/app_get_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the information of the OAuth application specified by [appId] in [request]\n ///\n /// For parameters information refer to [AppGetRequest].\n /// Throws an [AppException] if API response contains an error\n static Future fetchApplicationDetails(\n AppGetRequest request,\n ) async {\n final AppGetReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AppException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppGetResponse.fromJson(response.appGet);\n }\n\n /// Gets all of the account's OAuth applications.\n ///\n /// For parameters information refer to [AppListRequest].\n /// Throws an [AppException] if API response contains an error\n static Future?> fetchApplicationList(\n AppListRequest request,\n ) async {\n final AppListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AppException(baseExceptionModel: baseExceptionModel),\n );\n\n return getListFromMap(\n response.appList,\n itemToTypeCallback: (dynamic item) => AppGetResponse.fromJson(item),\n );\n }\n\n /// Retrieves details of app markup according to criteria specified.\n Future fetchApplicationMarkupDetails({\n required DateTime dateFrom,\n required DateTime dateTo,\n String? clientLoginId,\n bool? description,\n int? limit,\n int? offset,\n String? sort,\n List? sortFields,\n }) =>\n AppMarkupDetailsResponse.fetchApplicationMarkupDetails(\n AppMarkupDetailsRequest(\n appId: appGet?.appId,\n clientLoginid: clientLoginId,\n dateFrom: dateFrom.toString(),\n dateTo: dateTo.toString(),\n description: description,\n limit: limit,\n offset: offset,\n sort: sort,\n sortFields: sortFields,\n ),\n );\n\n /// The request for deleting an application.\n Future deleteApplication() =>\n AppDeleteResponse.deleteApplication(\n AppDeleteRequest(appDelete: appGet?.appId),\n );\n\n /// Register a new Oauth application.\n Future registerApplication(\n {required List scopes}) =>\n AppRegisterResponse.registerApplication(\n AppRegisterRequest(\n appMarkupPercentage: appGet?.appMarkupPercentage,\n appstore: appGet?.appstore,\n github: appGet?.github,\n googleplay: appGet?.googleplay,\n homepage: appGet?.homepage,\n name: appGet?.name,\n redirectUri: appGet?.redirectUri,\n scopes: scopes\n .map((TokenScope scope) => getStringFromEnum(scope))\n .toList(),\n verificationUri: appGet?.verificationUri,\n ),\n );\n\n /// Update application.\n Future updateApplication(\n {required List scopes}) =>\n AppUpdateResponse.updateApplication(\n AppUpdateRequest(\n appMarkupPercentage: appGet?.appMarkupPercentage,\n appUpdate: appGet?.appId,\n appstore: appGet?.appstore,\n github: appGet?.github,\n googleplay: appGet?.googleplay,\n homepage: appGet?.homepage,\n name: appGet?.name,\n redirectUri: appGet?.redirectUri,\n scopes: scopes\n .map((TokenScope scope) => getStringFromEnum(scope))\n .toList(),\n verificationUri: appGet?.verificationUri,\n ),\n );\n\n /// Revoke access of particular app.\n Future revokeOauthApplication() =>\n RevokeOauthAppResponse.revokeOauthApplication(\n RevokeOauthAppRequest(revokeOauthApp: appGet?.appId),\n );", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the information of the OAuth application specified by [appId] in [request]\n ///\n /// For parameters information refer to [AppGetRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future fetchApplicationDetails(\n AppGetRequest request,\n ) async {\n final AppGetReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppGetResponse.fromJson(response.appGet);\n }\n\n /// Gets all of the account's OAuth applications.\n ///\n /// For parameters information refer to [AppListRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future?> fetchApplicationList(\n AppListRequest request,\n ) async {\n final AppListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return getListFromMap(\n response.appList,\n itemToTypeCallback: (dynamic item) => AppGetResponse.fromJson(item),\n );\n }\n\n /// Retrieves details of app markup according to criteria specified.\n Future fetchApplicationMarkupDetails({\n required DateTime dateFrom,\n required DateTime dateTo,\n String? clientLoginId,\n bool? description,\n int? limit,\n int? offset,\n String? sort,\n List? sortFields,\n }) =>\n AppMarkupDetailsResponse.fetchApplicationMarkupDetails(\n AppMarkupDetailsRequest(\n appId: appGet?.appId,\n clientLoginid: clientLoginId,\n dateFrom: dateFrom.toString(),\n dateTo: dateTo.toString(),\n description: description,\n limit: limit,\n offset: offset,\n sort: sort,\n sortFields: sortFields,\n ),\n );\n\n /// The request for deleting an application.\n Future deleteApplication() =>\n AppDeleteResponse.deleteApplication(\n AppDeleteRequest(appDelete: appGet?.appId),\n );\n\n /// Register a new Oauth application.\n Future registerApplication(\n {required List scopes}) =>\n AppRegisterResponse.registerApplication(\n AppRegisterRequest(\n appMarkupPercentage: appGet?.appMarkupPercentage,\n appstore: appGet?.appstore,\n github: appGet?.github,\n googleplay: appGet?.googleplay,\n homepage: appGet?.homepage,\n name: appGet?.name,\n redirectUri: appGet?.redirectUri,\n scopes: scopes\n .map((TokenScope scope) => getStringFromEnum(scope))\n .toList(),\n verificationUri: appGet?.verificationUri,\n ),\n );\n\n /// Update application.\n Future updateApplication(\n {required List scopes}) =>\n AppUpdateResponse.updateApplication(\n AppUpdateRequest(\n appMarkupPercentage: appGet?.appMarkupPercentage,\n appUpdate: appGet?.appId,\n appstore: appGet?.appstore,\n github: appGet?.github,\n googleplay: appGet?.googleplay,\n homepage: appGet?.homepage,\n name: appGet?.name,\n redirectUri: appGet?.redirectUri,\n scopes: scopes\n .map((TokenScope scope) => getStringFromEnum(scope))\n .toList(),\n verificationUri: appGet?.verificationUri,\n ),\n );\n\n /// Revoke access of particular app.\n Future revokeOauthApplication() =>\n RevokeOauthAppResponse.revokeOauthApplication(\n RevokeOauthAppRequest(revokeOauthApp: appGet?.appId),\n );", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/app_delete_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/app_markup_details_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/app_register_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/app_update_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/revoke_oauth_app_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_delete_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_get_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_get_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_list_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_list_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_markup_details_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_register_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_update_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/revoke_oauth_app_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/app_list_receive_methods.json b/lib/basic_api/generated/methods/app_list_receive_methods.json index 75f43c54dc..9bf0f4e612 100644 --- a/lib/basic_api/generated/methods/app_list_receive_methods.json +++ b/lib/basic_api/generated/methods/app_list_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets all of the account's OAuth applications.\n ///\n /// For parameters information refer to [AppListRequest].\n /// Throws an [AppException] if API response contains an error\n static Future fetchApplicationList(\n AppListRequest request,\n ) async {\n final AppListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AppException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppListResponse.fromJson(response.appList);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets all of the account's OAuth applications.\n ///\n /// For parameters information refer to [AppListRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future fetchApplicationList(\n AppListRequest request,\n ) async {\n final AppListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppListResponse.fromJson(response.appList);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_list_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_list_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/app_markup_details_receive_methods.json b/lib/basic_api/generated/methods/app_markup_details_receive_methods.json index 07cf2d29e1..a1e44f688c 100644 --- a/lib/basic_api/generated/methods/app_markup_details_receive_methods.json +++ b/lib/basic_api/generated/methods/app_markup_details_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieve details of app markup according to criteria specified.\n ///\n /// For parameters information refer to [AppMarkupDetailsRequest].\n /// Throws an [AppException] if API response contains an error\n static Future fetchApplicationMarkupDetails(\n AppMarkupDetailsRequest request,\n ) async {\n final AppMarkupDetailsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AppException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppMarkupDetailsResponse.fromJson(response.appMarkupDetails);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieve details of app markup according to criteria specified.\n ///\n /// For parameters information refer to [AppMarkupDetailsRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future fetchApplicationMarkupDetails(\n AppMarkupDetailsRequest request,\n ) async {\n final AppMarkupDetailsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppMarkupDetailsResponse.fromJson(response.appMarkupDetails);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_markup_details_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_markup_details_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/app_register_receive_methods.json b/lib/basic_api/generated/methods/app_register_receive_methods.json index 0ec886fd0e..1bb152c27c 100644 --- a/lib/basic_api/generated/methods/app_register_receive_methods.json +++ b/lib/basic_api/generated/methods/app_register_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Registers a new OAuth application.\n ///\n /// For parameters information refer to [AppRegisterRequest].\n /// Throws an [AppException] if API response contains an error\n static Future registerApplication(\n AppRegisterRequest request,\n ) async {\n final AppRegisterReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AppException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppRegisterResponse.fromJson(response.appRegister);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Registers a new OAuth application.\n ///\n /// For parameters information refer to [AppRegisterRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future registerApplication(\n AppRegisterRequest request,\n ) async {\n final AppRegisterReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppRegisterResponse.fromJson(response.appRegister);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_register_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_register_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/app_update_receive_methods.json b/lib/basic_api/generated/methods/app_update_receive_methods.json index 82728bc6cd..18827d8be5 100644 --- a/lib/basic_api/generated/methods/app_update_receive_methods.json +++ b/lib/basic_api/generated/methods/app_update_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Updates the application specified in [request].\n ///\n /// For parameters information refer to [AppUpdateRequest].\n /// Throws an [AppException] if API response contains an error\n static Future updateApplication(\n AppUpdateRequest request) async {\n final AppUpdateReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AppException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppUpdateResponse.fromJson(response.appUpdate);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Updates the application specified in [request].\n ///\n /// For parameters information refer to [AppUpdateRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future updateApplication(\n AppUpdateRequest request) async {\n final AppUpdateReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return AppUpdateResponse.fromJson(response.appUpdate);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_update_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/app_update_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/asset_index_receive_methods.json b/lib/basic_api/generated/methods/asset_index_receive_methods.json index 6a713b8f1f..bd80bf1226 100644 --- a/lib/basic_api/generated/methods/asset_index_receive_methods.json +++ b/lib/basic_api/generated/methods/asset_index_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": " static final BaseAPI _api = Injector()();\n\n /// Retrieves a list of all available underlyings and the corresponding contract types and duration boundaries.\n ///\n /// If the user is logged in, only the assets available for that user's landing company will be returned.\n /// Throws an [AssetIndexException] if API response contains an error\n static Future fetchAssetIndices(\n AssetIndexRequest request,\n ) async {\n final AssetIndexReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AssetIndexException(baseExceptionModel: baseExceptionModel),\n );\n\n return AssetIndexResponse.fromJson(response.assetIndex);\n }", + "methods": " static final BaseAPI _api = Injector()();\n\n /// Retrieves a list of all available underlyings and the corresponding contract types and duration boundaries.\n ///\n /// If the user is logged in, only the assets available for that user's landing company will be returned.\n /// Throws an [BaseAPIException] if API response contains an error\n static Future fetchAssetIndices(\n AssetIndexRequest request,\n ) async {\n final AssetIndexReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return AssetIndexResponse.fromJson(response.assetIndex);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/asset_index_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/asset_index_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/authorize_receive_methods.json b/lib/basic_api/generated/methods/authorize_receive_methods.json index c978580ecd..b82623671f 100644 --- a/lib/basic_api/generated/methods/authorize_receive_methods.json +++ b/lib/basic_api/generated/methods/authorize_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Authorizes current WebSocket session to act on behalf of the owner of a given token. \n /// \n /// For parameters information refer to [AuthorizeRequest]. \n /// Throws an [AuthorizeException] if API response contains an error. \n static Future authorizeMethodRaw( \n AuthorizeRequest request, \n ) async { \n final AuthorizeReceive response = await _api.call( \n request: request, \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n AuthorizeException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Authorizes current WebSocket session to act on behalf of the owner of a given token. \n /// \n /// For parameters information refer to [AuthorizeRequest]. \n /// Throws an [AuthorizeException] if API response contains an error. \n static Future authorizeMethod( \n AuthorizeRequest request, \n ) async { \n final AuthorizeReceive response = await authorizeMethodRaw(request); \n \n return AuthorizeResponse.fromJson(response.authorize); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Authorizes current WebSocket session to act on behalf of the owner of a given token. \n /// \n /// For parameters information refer to [AuthorizeRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future authorizeMethodRaw( \n AuthorizeRequest request, \n ) async { \n final AuthorizeReceive response = await _api.call( \n request: request, \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Authorizes current WebSocket session to act on behalf of the owner of a given token. \n /// \n /// For parameters information refer to [AuthorizeRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future authorizeMethod( \n AuthorizeRequest request, \n ) async { \n final AuthorizeReceive response = await authorizeMethodRaw(request); \n \n return AuthorizeResponse.fromJson(response.authorize); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/authorize_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/authorize_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/balance_receive_methods.json b/lib/basic_api/generated/methods/balance_receive_methods.json index 7ea265903c..db7d99034c 100644 --- a/lib/basic_api/generated/methods/balance_receive_methods.json +++ b/lib/basic_api/generated/methods/balance_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the balance of account\n ///\n /// For parameters info refer to [BalanceRequest]\n /// Throws a [BalanceException] if API response contains an error\n static Future fetchBalance(BalanceRequest request) async {\n final BalanceReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BalanceException(baseExceptionModel: baseExceptionModel),\n );\n\n return BalanceResponse.fromJson(response.balance, response.subscription);\n }\n\n /// Instead of one call [Balance.fetchBalance] gets stream of [Balance]\n ///\n /// Throws a [BalanceException] if API response contains an error\n static Stream subscribeBalance(\n BalanceRequest request, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: request, comparePredicate: comparePredicate)!\n .map((Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BalanceException(baseExceptionModel: baseExceptionModel),\n );\n\n return response is BalanceReceive\n ? BalanceResponse.fromJson(\n response.balance,\n response.subscription,\n )\n : null;\n });\n\n /// Unsubscribes from balance subscription.\n ///\n /// Throws a [BalanceException] if API response contains an error\n Future unsubscribeBalance() async {\n if (subscription == null) {\n return null;\n }\n\n final ForgetReceive response =\n await _api.unsubscribe(subscriptionId: subscription!.id);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BalanceException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }\n\n /// Unsubscribes all balance subscriptions.\n ///\n /// Throws a [BalanceException] if API response contains an error\n static Future unsubscribeAllBalance() async {\n final ForgetAllReceive response =\n await _api.unsubscribeAll(method: ForgetStreamType.balance);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BalanceException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the balance of account\n ///\n /// For parameters info refer to [BalanceRequest]\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchBalance(BalanceRequest request) async {\n final BalanceReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return BalanceResponse.fromJson(response.balance, response.subscription);\n }\n\n /// Instead of one call [Balance.fetchBalance] gets stream of [Balance]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Stream subscribeBalance(\n BalanceRequest request, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: request, comparePredicate: comparePredicate)!\n .map((Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response is BalanceReceive\n ? BalanceResponse.fromJson(\n response.balance,\n response.subscription,\n )\n : null;\n });\n\n /// Unsubscribes from balance subscription.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future unsubscribeBalance() async {\n if (subscription == null) {\n return null;\n }\n\n final ForgetReceive response =\n await _api.unsubscribe(subscriptionId: subscription!.id);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }\n\n /// Unsubscribes all balance subscriptions.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future unsubscribeAllBalance() async {\n final ForgetAllReceive response =\n await _api.unsubscribeAll(method: ForgetStreamType.balance);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/balance_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/balance_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/buy_receive_methods.json b/lib/basic_api/generated/methods/buy_receive_methods.json index 79fab41830..cfd4a6220e 100644 --- a/lib/basic_api/generated/methods/buy_receive_methods.json +++ b/lib/basic_api/generated/methods/buy_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Buys a contract with parameters specified in given [BuyRequest]\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n static Future buyMethod(BuyRequest request) async {\n final BuyReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return BuyResponse.fromJson(response.buy, response.subscription);\n }\n\n /// Buys contract with parameters specified in request and subscribes to it.\n ///\n /// Throws a [ContractOperationException] is API response contains an error\n static Stream buyAndSubscribe(\n BuyRequest request, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: request, comparePredicate: comparePredicate)!\n .map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(\n baseExceptionModel: baseExceptionModel),\n );\n return response is ProposalOpenContractReceive\n ? ProposalOpenContractResponse.fromJson(\n response.proposalOpenContract,\n response.subscription,\n )\n : null;\n },\n );\n\n /// Gets the current spot of the this bought contract as [Contract].\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n Future fetchState() =>\n ProposalOpenContractResponse.fetchContractState(\n ProposalOpenContractRequest(\n contractId: buy?.contractId,\n ),\n );\n\n /// Subscribes to this bought contract spot and returns its spot update as [ContractBaseModel].\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n Stream subscribeState({\n RequestCompareFunction? comparePredicate,\n }) =>\n ProposalOpenContractResponse.subscribeContractState(\n ProposalOpenContractRequest(contractId: buy?.contractId),\n comparePredicate: comparePredicate,\n );\n\n /// Updates this contract\n ///\n /// New [stopLoss] value for a contract. To cancel, pass null.\n /// New [takeProfit] value for a contract. To cancel, pass null.\n /// Throws a [ContractOperationException] if API response contains an error\n Future update({\n double? stopLoss,\n double? takeProfit,\n }) =>\n ContractUpdateResponse.updateContract(ContractUpdateRequest(\n contractId: buy?.contractId,\n limitOrder: {\n 'stop_loss': stopLoss,\n 'take_profit': takeProfit,\n },\n ));\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Buys a contract with parameters specified in given [BuyRequest]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future buyMethod(BuyRequest request) async {\n final BuyReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return BuyResponse.fromJson(response.buy, response.subscription);\n }\n\n /// Buys contract with parameters specified in request and subscribes to it.\n ///\n /// Throws a [BaseAPIException] is API response contains an error\n static Stream buyAndSubscribe(\n BuyRequest request, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: request, comparePredicate: comparePredicate)!\n .map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(\n baseExceptionModel: baseExceptionModel),\n );\n return response is ProposalOpenContractReceive\n ? ProposalOpenContractResponse.fromJson(\n response.proposalOpenContract,\n response.subscription,\n )\n : null;\n },\n );\n\n /// Gets the current spot of the this bought contract as [Contract].\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future fetchState() =>\n ProposalOpenContractResponse.fetchContractState(\n ProposalOpenContractRequest(\n contractId: buy?.contractId,\n ),\n );\n\n /// Subscribes to this bought contract spot and returns its spot update as [ContractBaseModel].\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Stream subscribeState({\n RequestCompareFunction? comparePredicate,\n }) =>\n ProposalOpenContractResponse.subscribeContractState(\n ProposalOpenContractRequest(contractId: buy?.contractId),\n comparePredicate: comparePredicate,\n );\n\n /// Updates this contract\n ///\n /// New [stopLoss] value for a contract. To cancel, pass null.\n /// New [takeProfit] value for a contract. To cancel, pass null.\n /// Throws a [BaseAPIException] if API response contains an error\n Future update({\n double? stopLoss,\n double? takeProfit,\n }) =>\n ContractUpdateResponse.updateContract(ContractUpdateRequest(\n contractId: buy?.contractId,\n limitOrder: {\n 'stop_loss': stopLoss,\n 'take_profit': takeProfit,\n },\n ));\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/response/contract_update_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/proposal_open_contract_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/buy_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/buy_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/contract_update_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/proposal_open_contract_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/proposal_open_contract_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';" } diff --git a/lib/basic_api/generated/methods/cancel_receive_methods.json b/lib/basic_api/generated/methods/cancel_receive_methods.json index fc9f61e9ac..532589936d 100644 --- a/lib/basic_api/generated/methods/cancel_receive_methods.json +++ b/lib/basic_api/generated/methods/cancel_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Cancels a contract with parameters specified in [CancelRequest].\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n static Future cancelContract(CancelRequest request) async {\n final CancelReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return CancelResponse.fromJson(response.cancel);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Cancels a contract with parameters specified in [CancelRequest].\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future cancelContract(CancelRequest request) async {\n final CancelReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return CancelResponse.fromJson(response.cancel);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/cancel_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/cancel_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/cashier_receive_methods.json b/lib/basic_api/generated/methods/cashier_receive_methods.json index 444a774871..aab5f555a4 100644 --- a/lib/basic_api/generated/methods/cashier_receive_methods.json +++ b/lib/basic_api/generated/methods/cashier_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": " static final BaseAPI _api = Injector()();\n\n /// Gets the cashier URL for given [CashierRequest]\n static Future fetchInformation(\n CashierRequest request,\n ) async {\n final CashierReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n CashierException(baseExceptionModel: baseExceptionModel),\n );\n\n return CashierResponse.fromJson(response.cashier, response.cashier);\n }", + "methods": " static final BaseAPI _api = Injector()();\n\n /// Gets the cashier URL for given [CashierRequest]\n static Future fetchInformation(\n CashierRequest request,\n ) async {\n final CashierReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return CashierResponse.fromJson(response.cashier, response.cashier);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/cashier_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/cashier_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/contract_update_history_receive_methods.json b/lib/basic_api/generated/methods/contract_update_history_receive_methods.json index e15c6a1080..6b14abb64f 100644 --- a/lib/basic_api/generated/methods/contract_update_history_receive_methods.json +++ b/lib/basic_api/generated/methods/contract_update_history_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets update history for contract as List of [HistorySpotPriceModel]\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n static Future fetchContractUpdateHistory(\n ContractUpdateHistoryRequest request,\n ) async {\n final ContractUpdateHistoryReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return ContractUpdateHistoryResponse.fromJson(\n response.contractUpdateHistory);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets update history for contract as List of [HistorySpotPriceModel]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchContractUpdateHistory(\n ContractUpdateHistoryRequest request,\n ) async {\n final ContractUpdateHistoryReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ContractUpdateHistoryResponse.fromJson(\n response.contractUpdateHistory);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/contract_update_history_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/contract_update_history_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/contract_update_receive_methods.json b/lib/basic_api/generated/methods/contract_update_receive_methods.json index 1c89837acb..a42b9fd17c 100644 --- a/lib/basic_api/generated/methods/contract_update_receive_methods.json +++ b/lib/basic_api/generated/methods/contract_update_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// updates a contract with parameters specified in [ContractUpdateRequest].\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n static Future updateContract(\n ContractUpdateRequest request,\n ) async {\n final ContractUpdateReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return ContractUpdateResponse.fromJson(response.contractUpdate);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// updates a contract with parameters specified in [ContractUpdateRequest].\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future updateContract(\n ContractUpdateRequest request,\n ) async {\n final ContractUpdateReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ContractUpdateResponse.fromJson(response.contractUpdate);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/contract_update_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/contract_update_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/contracts_for_receive_methods.json b/lib/basic_api/generated/methods/contracts_for_receive_methods.json index a489b62af2..1be8460b88 100644 --- a/lib/basic_api/generated/methods/contracts_for_receive_methods.json +++ b/lib/basic_api/generated/methods/contracts_for_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets available contracts for given symbol in [ContractsForRequest]\n ///\n /// Throws a [ContractsForSymbolException] if API response contains an error\n static Future fetchContractsForSymbol(\n ContractsForRequest request,\n ) async {\n final ContractsForReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractsForSymbolException(baseExceptionModel: baseExceptionModel),\n );\n\n return ContractsForResponse.fromJson(response.contractsFor);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets available contracts for given symbol in [ContractsForRequest]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchContractsForSymbol(\n ContractsForRequest request,\n ) async {\n final ContractsForReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ContractsForResponse.fromJson(response.contractsFor);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/contracts_for_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/contracts_for_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/copy_start_receive_methods.json b/lib/basic_api/generated/methods/copy_start_receive_methods.json index cf00a2b9f6..02ce18a1af 100644 --- a/lib/basic_api/generated/methods/copy_start_receive_methods.json +++ b/lib/basic_api/generated/methods/copy_start_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Starts copy trader bets.\n ///\n /// For parameters information refer to [CopyStartRequest].\n /// Throws a [CopyTradingException] if API response contains an error\n static Future start(CopyStartRequest request) async {\n final CopyStartReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n CopyTradingException(baseExceptionModel: baseExceptionModel),\n );\n\n return CopyStartResponse.fromJson(response.copyStart);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Starts copy trader bets.\n ///\n /// For parameters information refer to [CopyStartRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future start(CopyStartRequest request) async {\n final CopyStartReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return CopyStartResponse.fromJson(response.copyStart);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/copy_start_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/copy_start_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/copy_stop_receive_methods.json b/lib/basic_api/generated/methods/copy_stop_receive_methods.json index 24f77e0474..3a1675951d 100644 --- a/lib/basic_api/generated/methods/copy_stop_receive_methods.json +++ b/lib/basic_api/generated/methods/copy_stop_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Stops copy trader bets.\n ///\n /// For parameters information refer to [CopyStopRequest].\n /// Throws a [CopyTradingException] if API response contains an error\n static Future stop(CopyStopRequest request) async {\n final CopyStopReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n CopyTradingException(baseExceptionModel: baseExceptionModel),\n );\n\n return CopyStopResponse.fromJson(response.copyStop);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Stops copy trader bets.\n ///\n /// For parameters information refer to [CopyStopRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future stop(CopyStopRequest request) async {\n final CopyStopReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return CopyStopResponse.fromJson(response.copyStop);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/copy_stop_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/copy_stop_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/copytrading_list_receive_methods.json b/lib/basic_api/generated/methods/copytrading_list_receive_methods.json index 57842468f9..5947c23b93 100644 --- a/lib/basic_api/generated/methods/copytrading_list_receive_methods.json +++ b/lib/basic_api/generated/methods/copytrading_list_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the list of active copiers and/or traders for Copy Trading\n ///\n /// Throws a [CopyTradingException] if API response contains an error\n static Future fetchList([\n CopytradingListRequest? request,\n ]) async {\n final CopytradingListReceive response = await _api.call(\n request: request ?? const CopytradingListRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n CopyTradingException(baseExceptionModel: baseExceptionModel),\n );\n\n return CopytradingListResponse.fromJson(response.copytradingList);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the list of active copiers and/or traders for Copy Trading\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchList([\n CopytradingListRequest? request,\n ]) async {\n final CopytradingListReceive response = await _api.call(\n request: request ?? const CopytradingListRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return CopytradingListResponse.fromJson(response.copytradingList);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/copytrading_list_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/copytrading_list_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/copytrading_statistics_receive_methods.json b/lib/basic_api/generated/methods/copytrading_statistics_receive_methods.json index f3a20f20ec..dbf7095e0f 100644 --- a/lib/basic_api/generated/methods/copytrading_statistics_receive_methods.json +++ b/lib/basic_api/generated/methods/copytrading_statistics_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the copy trading statistics for given `traderId` in [request]\n ///\n /// Throws a [CopyTradingException] if API response contains an error\n static Future fetchStatistics(\n CopytradingStatisticsRequest request,\n ) async {\n final CopytradingStatisticsReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n CopyTradingException(baseExceptionModel: baseExceptionModel),\n );\n\n return CopytradingStatisticsResponse.fromJson(\n response.copytradingStatistics);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the copy trading statistics for given `traderId` in [request]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchStatistics(\n CopytradingStatisticsRequest request,\n ) async {\n final CopytradingStatisticsReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return CopytradingStatisticsResponse.fromJson(\n response.copytradingStatistics);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/copytrading_statistics_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/copytrading_statistics_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/exchange_rates_receive_methods.json b/lib/basic_api/generated/methods/exchange_rates_receive_methods.json index 3ee84b9b7e..0d2ecdd8db 100644 --- a/lib/basic_api/generated/methods/exchange_rates_receive_methods.json +++ b/lib/basic_api/generated/methods/exchange_rates_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Retrieves the exchange rates from a base currency to all currencies supported by the system. \n /// \n /// For parameters information refer to [ExchangeRatesRequest]. \n /// Throws an [ExchangeException] if API response contains an error. \n static Future fetchExchangeRatesRaw( \n ExchangeRatesRequest request, \n ) async { \n final ExchangeRatesReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n ExchangeException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Retrieves the exchange rates from a base currency to all currencies supported by the system. \n /// \n /// For parameters information refer to [ExchangeRatesRequest]. \n /// Throws an [ExchangeException] if API response contains an error. \n static Future fetchExchangeRates( \n ExchangeRatesRequest request, \n ) async { \n final ExchangeRatesReceive response = await fetchExchangeRatesRaw(request); \n \n return ExchangeRates.fromJson(response.exchangeRates!); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Retrieves the exchange rates from a base currency to all currencies supported by the system. \n /// \n /// For parameters information refer to [ExchangeRatesRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchExchangeRatesRaw( \n ExchangeRatesRequest request, \n ) async { \n final ExchangeRatesReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Retrieves the exchange rates from a base currency to all currencies supported by the system. \n /// \n /// For parameters information refer to [ExchangeRatesRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchExchangeRates( \n ExchangeRatesRequest request, \n ) async { \n final ExchangeRatesReceive response = await fetchExchangeRatesRaw(request); \n \n return ExchangeRates.fromJson(response.exchangeRates!); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/exchange_rates_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/exchange_rates_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/forget_all_receive_methods.json b/lib/basic_api/generated/methods/forget_all_receive_methods.json index 39ac2157fc..fa95b0195b 100644 --- a/lib/basic_api/generated/methods/forget_all_receive_methods.json +++ b/lib/basic_api/generated/methods/forget_all_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Immediately cancels the real-time streams of messages of given type.\n ///\n /// For parameters information refer to [ForgetAllRequest].\n /// Throws a [ForgetException] if API response contains an error\n static Future forgetAllMethod(\n ForgetAllRequest request,\n ) async {\n final ForgetAllReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ForgetException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Immediately cancels the real-time streams of messages of given type.\n ///\n /// For parameters information refer to [ForgetAllRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future forgetAllMethod(\n ForgetAllRequest request,\n ) async {\n final ForgetAllReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/forget_receive_methods.json b/lib/basic_api/generated/methods/forget_receive_methods.json index cbfed8f9a6..48254d444c 100644 --- a/lib/basic_api/generated/methods/forget_receive_methods.json +++ b/lib/basic_api/generated/methods/forget_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Immediately cancels the real-time stream of messages with a specific id.\n ///\n /// For parameters information refer to [ForgetRequest].\n /// Throws a [ForgetException] if API response contains an error\n static Future forgetMethod(\n ForgetRequest request,\n ) async {\n final ForgetReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ForgetException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Immediately cancels the real-time stream of messages with a specific id.\n ///\n /// For parameters information refer to [ForgetRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future forgetMethod(\n ForgetRequest request,\n ) async {\n final ForgetReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/get_account_status_receive_methods.json b/lib/basic_api/generated/methods/get_account_status_receive_methods.json index bdc88ffb2b..712a34feba 100644 --- a/lib/basic_api/generated/methods/get_account_status_receive_methods.json +++ b/lib/basic_api/generated/methods/get_account_status_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets the account's status. \n /// \n /// For parameters information refer to [GetAccountStatusRequest]. \n /// Throws an [AccountStatusException] if API response contains an error. \n static Future fetchAccountStatusRaw() async { \n final GetAccountStatusReceive response = await _api.call( \n request: const GetAccountStatusRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n AccountStatusException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Gets the account's status. \n /// \n /// For parameters information refer to [GetAccountStatusRequest]. \n /// Throws an [AccountStatusException] if API response contains an error. \n static Future fetchAccountStatus() async { \n final GetAccountStatusReceive response = await fetchAccountStatusRaw(); \n \n return GetAccountStatusResponse.fromJson(response.getAccountStatus); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets the account's status. \n /// \n /// For parameters information refer to [GetAccountStatusRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchAccountStatusRaw() async { \n final GetAccountStatusReceive response = await _api.call( \n request: const GetAccountStatusRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Gets the account's status. \n /// \n /// For parameters information refer to [GetAccountStatusRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchAccountStatus() async { \n final GetAccountStatusReceive response = await fetchAccountStatusRaw(); \n \n return GetAccountStatusResponse.fromJson(response.getAccountStatus); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_account_status_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_account_status_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/get_financial_assessment_receive_methods.json b/lib/basic_api/generated/methods/get_financial_assessment_receive_methods.json index c9ec6289fe..578df28a8f 100644 --- a/lib/basic_api/generated/methods/get_financial_assessment_receive_methods.json +++ b/lib/basic_api/generated/methods/get_financial_assessment_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the financial assessment details.\n ///\n /// The 'financial assessment' is a questionnaire that clients of certain Landing Companies need to complete,\n /// due to regulatory and KYC (know your client) requirements.\n /// Throws a [FinancialAssessmentException] if API response contains an error\n static Future fetchAssessment(\n GetFinancialAssessmentRequest request,\n ) async {\n final GetFinancialAssessmentReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n FinancialAssessmentException(baseExceptionModel: baseExceptionModel),\n );\n\n return GetFinancialAssessmentResponse.fromJson(response.getFinancialAssessment);\n }\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the financial assessment details.\n ///\n /// The 'financial assessment' is a questionnaire that clients of certain Landing Companies need to complete,\n /// due to regulatory and KYC (know your client) requirements.\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchAssessment(\n GetFinancialAssessmentRequest request,\n ) async {\n final GetFinancialAssessmentReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return GetFinancialAssessmentResponse.fromJson(response.getFinancialAssessment);\n }\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_financial_assessment_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_financial_assessment_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/get_limits_receive_methods.json b/lib/basic_api/generated/methods/get_limits_receive_methods.json index dcb770c184..0925e800a7 100644 --- a/lib/basic_api/generated/methods/get_limits_receive_methods.json +++ b/lib/basic_api/generated/methods/get_limits_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the trading and withdrawal limits for logged in account\n ///\n /// Throws an [AccountLimitsException] if API response contains an error\n static Future fetchAccountLimits([\n GetLimitsRequest? request,\n ]) async {\n final GetLimitsReceive response = await _api.call(\n request: request ?? const GetLimitsRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AccountLimitsException(baseExceptionModel: baseExceptionModel),\n );\n\n return GetLimitsResponse.fromJson(response.getLimits);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the trading and withdrawal limits for logged in account\n ///\n /// Throws an [BaseAPIException] if API response contains an error\n static Future fetchAccountLimits([\n GetLimitsRequest? request,\n ]) async {\n final GetLimitsReceive response = await _api.call(\n request: request ?? const GetLimitsRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return GetLimitsResponse.fromJson(response.getLimits);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_limits_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_limits_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/get_self_exclusion_receive_methods.json b/lib/basic_api/generated/methods/get_self_exclusion_receive_methods.json index 832d790698..30f1d09a66 100644 --- a/lib/basic_api/generated/methods/get_self_exclusion_receive_methods.json +++ b/lib/basic_api/generated/methods/get_self_exclusion_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Allows users to exclude themselves from the website for certain periods of time,\n /// or to set limits on their trading activities.\n ///\n /// This facility is a regulatory requirement for certain Landing Companies.\n /// For parameters information refer to [GetSelfExclusionRequest].\n /// Throws a [SelfExclusionException] if API response contains an error\n static Future fetchSelfExclusion([\n GetSelfExclusionRequest? request,\n ]) async {\n final GetSelfExclusionReceive response = await _api.call(\n request: request ?? const GetSelfExclusionRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n SelfExclusionException(baseExceptionModel: baseExceptionModel),\n );\n\n return GetSelfExclusionResponse.fromJson(response.getSelfExclusion);\n }\n\n /// Sets Self-Exclusion (this call should be used in conjunction with [fetchSelfExclusion])\n ///\n /// For parameters information refer to [SetSelfExclusionRequest].\n /// Throws a [SelfExclusionException] if API response contains an error\n static Future setSelfExclusion(SetSelfExclusionRequest request) async {\n final SetSelfExclusionReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n SelfExclusionException(baseExceptionModel: baseExceptionModel),\n );\n\n return getBool(response.setSelfExclusion);\n }\n\n /// Excludes user from the website based this parameters\n ///\n /// (this call should be used in conjunction with [fetchSelfExclusion])\n /// Throws a [SelfExclusionException] if API response contains an error\n Future exclude() async {\n final SetSelfExclusionReceive response = await _api.call(\n request: SetSelfExclusionRequest(\n excludeUntil: getSelfExclusion?.excludeUntil,\n max30dayDeposit: getSelfExclusion?.max30dayDeposit,\n max30dayLosses: getSelfExclusion?.max30dayLosses,\n max30dayTurnover: getSelfExclusion?.max30dayTurnover,\n max7dayDeposit: getSelfExclusion?.max7dayDeposit,\n max7dayLosses: getSelfExclusion?.max7dayLosses,\n max7dayTurnover: getSelfExclusion?.max7dayTurnover,\n maxBalance: getSelfExclusion?.maxBalance,\n maxDeposit: getSelfExclusion?.maxDeposit,\n maxLosses: getSelfExclusion?.maxLosses,\n maxOpenBets: getSelfExclusion?.maxOpenBets,\n maxTurnover: getSelfExclusion?.maxTurnover,\n sessionDurationLimit: getSelfExclusion?.sessionDurationLimit,\n timeoutUntil:\n getSecondsSinceEpochDateTime(getSelfExclusion?.timeoutUntil),\n ),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n SelfExclusionException(baseExceptionModel: baseExceptionModel),\n );\n\n return getBool(response.setSelfExclusion);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Allows users to exclude themselves from the website for certain periods of time,\n /// or to set limits on their trading activities.\n ///\n /// This facility is a regulatory requirement for certain Landing Companies.\n /// For parameters information refer to [GetSelfExclusionRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchSelfExclusion([\n GetSelfExclusionRequest? request,\n ]) async {\n final GetSelfExclusionReceive response = await _api.call(\n request: request ?? const GetSelfExclusionRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return GetSelfExclusionResponse.fromJson(response.getSelfExclusion);\n }\n\n /// Sets Self-Exclusion (this call should be used in conjunction with [fetchSelfExclusion])\n ///\n /// For parameters information refer to [SetSelfExclusionRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future setSelfExclusion(SetSelfExclusionRequest request) async {\n final SetSelfExclusionReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return getBool(response.setSelfExclusion);\n }\n\n /// Excludes user from the website based this parameters\n ///\n /// (this call should be used in conjunction with [fetchSelfExclusion])\n /// Throws a [BaseAPIException] if API response contains an error\n Future exclude() async {\n final SetSelfExclusionReceive response = await _api.call(\n request: SetSelfExclusionRequest(\n excludeUntil: getSelfExclusion?.excludeUntil,\n max30dayDeposit: getSelfExclusion?.max30dayDeposit,\n max30dayLosses: getSelfExclusion?.max30dayLosses,\n max30dayTurnover: getSelfExclusion?.max30dayTurnover,\n max7dayDeposit: getSelfExclusion?.max7dayDeposit,\n max7dayLosses: getSelfExclusion?.max7dayLosses,\n max7dayTurnover: getSelfExclusion?.max7dayTurnover,\n maxBalance: getSelfExclusion?.maxBalance,\n maxDeposit: getSelfExclusion?.maxDeposit,\n maxLosses: getSelfExclusion?.maxLosses,\n maxOpenBets: getSelfExclusion?.maxOpenBets,\n maxTurnover: getSelfExclusion?.maxTurnover,\n sessionDurationLimit: getSelfExclusion?.sessionDurationLimit,\n timeoutUntil:\n getSecondsSinceEpochDateTime(getSelfExclusion?.timeoutUntil),\n ),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return getBool(response.setSelfExclusion);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_self_exclusion_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_self_exclusion_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_self_exclusion_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_self_exclusion_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/get_settings_receive_methods.json b/lib/basic_api/generated/methods/get_settings_receive_methods.json index c54aefd3d9..1d1a36ca9d 100644 --- a/lib/basic_api/generated/methods/get_settings_receive_methods.json +++ b/lib/basic_api/generated/methods/get_settings_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets user's settings (email, date of birth, address etc). \n /// \n /// For parameters information refer to [GetSettingsRequest]. \n /// Throws an [AccountSettingsException] if API response contains an error. \n static Future fetchAccountSettingRaw([ \n GetSettingsRequest? request, \n ]) async { \n final GetSettingsReceive response = await _api.call( \n request: request ?? const GetSettingsRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n AccountSettingsException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Gets user's settings (email, date of birth, address etc). \n /// \n /// For parameters information refer to [GetSettingsRequest]. \n /// Throws an [AccountSettingsException] if API response contains an error. \n static Future changeAccountSettingRaw( \n SetSettingsRequest request, \n ) async { \n final SetSettingsReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n AccountSettingsException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Gets user's settings (email, date of birth, address etc). \n /// \n /// Throws an [AccountSettingsException] if API response contains an error. \n static Future fetchAccountSetting([ \n GetSettingsRequest? request, \n ]) async { \n final GetSettingsReceive response = await fetchAccountSettingRaw(request); \n \n return GetSettingsResponse.fromJson(response.getSettings); \n } \n \n /// Changes the user's settings with parameters specified as [SetSettingsRequest]. \n /// \n /// Throws an [AccountSettingsException] if API response contains an error. \n static Future changeAccountSetting( \n SetSettingsRequest request, \n ) async { \n final SetSettingsReceive response = await changeAccountSettingRaw(request); \n \n return SetSettingsResponse(setSettings: response.setSettings ?? 0); \n } \n \n /// Changes user's setting \n Future changeSetting({ \n required String secretAnswer, \n required String secretQuestion, \n }) => \n changeAccountSetting( \n SetSettingsRequest( \n accountOpeningReason: getSettings?.accountOpeningReason, \n addressCity: getSettings?.addressCity, \n addressLine1: getSettings?.addressLine1, \n addressLine2: getSettings?.addressLine2, \n addressPostcode: getSettings?.addressPostcode, \n addressState: getSettings?.addressState, \n allowCopiers: getSettings?.allowCopiers, \n citizen: getSettings?.citizen, \n dateOfBirth: getStringFromDateTime(getSettings?.dateOfBirth), \n emailConsent: getSettings?.emailConsent, \n firstName: getSettings?.firstName, \n lastName: getSettings?.lastName, \n phone: getSettings?.phone, \n placeOfBirth: getSettings?.placeOfBirth, \n requestProfessionalStatus: \n getInt(value: getSettings?.requestProfessionalStatus), \n residence: getSettings?.residence, \n salutation: getSettings?.salutation, \n secretAnswer: secretAnswer, \n secretQuestion: secretQuestion, \n taxIdentificationNumber: getSettings?.taxIdentificationNumber, \n taxResidence: getSettings?.taxResidence, \n ), \n );", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets user's settings (email, date of birth, address etc). \n /// \n /// For parameters information refer to [GetSettingsRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchAccountSettingRaw([ \n GetSettingsRequest? request, \n ]) async { \n final GetSettingsReceive response = await _api.call( \n request: request ?? const GetSettingsRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Gets user's settings (email, date of birth, address etc). \n /// \n /// For parameters information refer to [GetSettingsRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future changeAccountSettingRaw( \n SetSettingsRequest request, \n ) async { \n final SetSettingsReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Gets user's settings (email, date of birth, address etc). \n /// \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchAccountSetting([ \n GetSettingsRequest? request, \n ]) async { \n final GetSettingsReceive response = await fetchAccountSettingRaw(request); \n \n return GetSettingsResponse.fromJson(response.getSettings); \n } \n \n /// Changes the user's settings with parameters specified as [SetSettingsRequest]. \n /// \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future changeAccountSetting( \n SetSettingsRequest request, \n ) async { \n final SetSettingsReceive response = await changeAccountSettingRaw(request); \n \n return SetSettingsResponse(setSettings: response.setSettings ?? 0); \n } \n \n /// Changes user's setting \n Future changeSetting({ \n required String secretAnswer, \n required String secretQuestion, \n }) => \n changeAccountSetting( \n SetSettingsRequest( \n accountOpeningReason: getSettings?.accountOpeningReason, \n addressCity: getSettings?.addressCity, \n addressLine1: getSettings?.addressLine1, \n addressLine2: getSettings?.addressLine2, \n addressPostcode: getSettings?.addressPostcode, \n addressState: getSettings?.addressState, \n allowCopiers: getSettings?.allowCopiers, \n citizen: getSettings?.citizen, \n dateOfBirth: getStringFromDateTime(getSettings?.dateOfBirth), \n emailConsent: getSettings?.emailConsent, \n firstName: getSettings?.firstName, \n lastName: getSettings?.lastName, \n phone: getSettings?.phone, \n placeOfBirth: getSettings?.placeOfBirth, \n requestProfessionalStatus: \n getInt(value: getSettings?.requestProfessionalStatus), \n residence: getSettings?.residence, \n salutation: getSettings?.salutation, \n secretAnswer: secretAnswer, \n secretQuestion: secretQuestion, \n taxIdentificationNumber: getSettings?.taxIdentificationNumber, \n taxResidence: getSettings?.taxResidence, \n ), \n );", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/response/set_settings_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_settings_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_settings_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_settings_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_settings_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/landing_company_receive_methods.json b/lib/basic_api/generated/methods/landing_company_receive_methods.json index fd35abb944..62bb7206ea 100644 --- a/lib/basic_api/generated/methods/landing_company_receive_methods.json +++ b/lib/basic_api/generated/methods/landing_company_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets landing companies for given [LandingCompanyRequest]\n ///\n /// Throws a [LandingCompanyException] if API response contains an error\n static Future fetchLandingCompanies(\n LandingCompanyRequest request,\n ) async {\n final LandingCompanyReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n LandingCompanyException(baseExceptionModel: baseExceptionModel),\n );\n\n return LandingCompanyResponse.fromJson(response.landingCompany);\n }\n\n /// Gets details of a landing company specified in [LandingCompanyDetailsRequest]\n ///\n /// Throws a [LandingCompanyException] if API response contains an error\n static Future fetchLandingCompanyDetails(\n LandingCompanyDetailsRequest request,\n ) async {\n final LandingCompanyDetailsReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n LandingCompanyException(baseExceptionModel: baseExceptionModel),\n );\n\n return LandingCompanyDetailsResponse.fromJson(response.landingCompanyDetails);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets landing companies for given [LandingCompanyRequest]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchLandingCompanies(\n LandingCompanyRequest request,\n ) async {\n final LandingCompanyReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return LandingCompanyResponse.fromJson(response.landingCompany);\n }\n\n /// Gets details of a landing company specified in [LandingCompanyDetailsRequest]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchLandingCompanyDetails(\n LandingCompanyDetailsRequest request,\n ) async {\n final LandingCompanyDetailsReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return LandingCompanyDetailsResponse.fromJson(response.landingCompanyDetails);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/response/landing_company_details_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/landing_company_details_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/landing_company_details_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/landing_company_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/landing_company_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/login_history_receive_methods.json b/lib/basic_api/generated/methods/login_history_receive_methods.json index a4d5c69049..d2791fd5ea 100644 --- a/lib/basic_api/generated/methods/login_history_receive_methods.json +++ b/lib/basic_api/generated/methods/login_history_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves a summary of login history for user.\n ///\n /// For parameters information refer to [LoginHistory].\n /// Throws an [AuthorizeException] if API response contains an error\n static Future fetchHistory([\n LoginHistoryRequest? request,\n ]) async {\n final LoginHistoryReceive response = await _api.call(\n request: request ?? const LoginHistoryRequest(limit: 10),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AuthorizeException(baseExceptionModel: baseExceptionModel),\n );\n\n return LoginHistoryResponse.fromJson(response.loginHistory);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves a summary of login history for user.\n ///\n /// For parameters information refer to [LoginHistory].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future fetchHistory([\n LoginHistoryRequest? request,\n ]) async {\n final LoginHistoryReceive response = await _api.call(\n request: request ?? const LoginHistoryRequest(limit: 10),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return LoginHistoryResponse.fromJson(response.loginHistory);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/login_history_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/login_history_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/logout_receive_methods.json b/lib/basic_api/generated/methods/logout_receive_methods.json index f50d699826..22088f521a 100644 --- a/lib/basic_api/generated/methods/logout_receive_methods.json +++ b/lib/basic_api/generated/methods/logout_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Logs out from the web-socket's session. \n /// \n /// For parameters information refer to [LogoutRequest]. \n /// Throws an [AuthorizeException] if API response contains an error. \n static Future logoutMethodRaw([LogoutRequest? request]) async { \n final LogoutReceive response = \n await _api.call(request: request ?? const LogoutRequest()); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n AuthorizeException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Logs out from the web-socket's session. \n /// \n /// For parameters information refer to [LogoutRequest]. \n /// Throws an [AuthorizeException] if API response contains an error. \n static Future logoutMethod([LogoutRequest? request]) async { \n final LogoutReceive response = await logoutMethodRaw(request); \n \n return LogoutResponse.fromJson(response.logout); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Logs out from the web-socket's session. \n /// \n /// For parameters information refer to [LogoutRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future logoutMethodRaw([LogoutRequest? request]) async { \n final LogoutReceive response = \n await _api.call(request: request ?? const LogoutRequest()); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Logs out from the web-socket's session. \n /// \n /// For parameters information refer to [LogoutRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future logoutMethod([LogoutRequest? request]) async { \n final LogoutReceive response = await logoutMethodRaw(request); \n \n return LogoutResponse.fromJson(response.logout); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/logout_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/logout_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/mt5_deposit_receive_methods.json b/lib/basic_api/generated/methods/mt5_deposit_receive_methods.json index 5a4cc52268..68bcdc56b5 100644 --- a/lib/basic_api/generated/methods/mt5_deposit_receive_methods.json +++ b/lib/basic_api/generated/methods/mt5_deposit_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Allows deposit into MT5 account from binary account.\n ///\n /// For parameters information refer to [Mt5DepositRequest].\n /// Throws a [MT5Exception] if API response contains an error\n static Future deposit(Mt5DepositRequest request) async {\n final Mt5DepositReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n MT5Exception(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5DepositResponse.fromJson(\n response.mt5Deposit,\n response.binaryTransactionId,\n );\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Allows deposit into MT5 account from binary account.\n ///\n /// For parameters information refer to [Mt5DepositRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future deposit(Mt5DepositRequest request) async {\n final Mt5DepositReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5DepositResponse.fromJson(\n response.mt5Deposit,\n response.binaryTransactionId,\n );\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_deposit_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_deposit_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/mt5_get_settings_receive_methods.json b/lib/basic_api/generated/methods/mt5_get_settings_receive_methods.json index f8b9e3c160..5f5328cc7d 100644 --- a/lib/basic_api/generated/methods/mt5_get_settings_receive_methods.json +++ b/lib/basic_api/generated/methods/mt5_get_settings_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets MT5 user account settings.\n ///\n /// For parameters information refer to [Mt5GetSettingsRequest].\n /// Throws a [MT5Exception] if API response contains an error\n static Future fetchSettings(\n Mt5GetSettingsRequest request,\n ) async {\n final Mt5GetSettingsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n MT5Exception(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5GetSettingsResponse.fromJson(response.mt5GetSettings);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets MT5 user account settings.\n ///\n /// For parameters information refer to [Mt5GetSettingsRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchSettings(\n Mt5GetSettingsRequest request,\n ) async {\n final Mt5GetSettingsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5GetSettingsResponse.fromJson(response.mt5GetSettings);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_get_settings_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_get_settings_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/mt5_login_list_receive_methods.json b/lib/basic_api/generated/methods/mt5_login_list_receive_methods.json index f771371b7e..44512b8880 100644 --- a/lib/basic_api/generated/methods/mt5_login_list_receive_methods.json +++ b/lib/basic_api/generated/methods/mt5_login_list_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the list of MT5 accounts for client.\n ///\n /// For parameters information refer to [Mt5LoginListRequest].\n /// Throws a [MT5Exception] if API response contains an error\n static Future fetchLoginList(\n Mt5LoginListRequest request,\n ) async {\n final Mt5LoginListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n MT5Exception(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5LoginListResponse.fromJson(response.mt5LoginList);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the list of MT5 accounts for client.\n ///\n /// For parameters information refer to [Mt5LoginListRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchLoginList(\n Mt5LoginListRequest request,\n ) async {\n final Mt5LoginListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5LoginListResponse.fromJson(response.mt5LoginList);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_login_list_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_login_list_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/mt5_new_account_receive_methods.json b/lib/basic_api/generated/methods/mt5_new_account_receive_methods.json index de572eecd3..72de8ac590 100644 --- a/lib/basic_api/generated/methods/mt5_new_account_receive_methods.json +++ b/lib/basic_api/generated/methods/mt5_new_account_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Creates new MT5 user, either demo or real money user.\n ///\n /// For parameters information refer to [Mt5NewAccountRequest].\n /// Throws a [MT5Exception] if API response contains an error\n static Future createNewAccount(\n Mt5NewAccountRequest request,\n ) async {\n final Mt5NewAccountReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n MT5Exception(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5NewAccountResponse.fromJson(response.mt5NewAccount);\n }\n\n /// Allows deposit into MT5 account from binary account.\n ///\n /// Throws a [MT5Exception] if API response contains an error\n Future deposit({\n required double amount,\n required String fromBinary,\n }) =>\n Mt5DepositResponse.deposit(\n Mt5DepositRequest(\n amount: amount,\n fromBinary: fromBinary,\n toMt5: mt5NewAccount?.login,\n ),\n );\n\n /// Changes password of the MT5 account.\n ///\n /// Throws a [MT5Exception] if API response contains an error\n Future changePassword({\n required String newPassword,\n required String oldPassword,\n required PasswordType passwordType,\n }) =>\n Mt5PasswordChangeResponse.changePassword(\n Mt5PasswordChangeRequest(\n login: mt5NewAccount?.login,\n newPassword: newPassword,\n oldPassword: oldPassword,\n passwordType: getStringFromEnum(passwordType),\n ),\n );\n\n /// Validates the main password for the MT5 user.\n ///\n /// Throws a [MT5Exception] if API response contains an error\n Future checkPassword({\n required String password,\n required PasswordType passwordType,\n }) =>\n Mt5PasswordCheckResponse.checkPassword(\n Mt5PasswordCheckRequest(\n login: mt5NewAccount?.login,\n password: password,\n passwordType: getStringFromEnum(passwordType),\n ),\n );\n\n /// Resets the password of MT5 account.\n ///\n /// Throws a [MT5Exception] if API response contains an error\n Future resetPassword({\n required String newPassword,\n required PasswordType passwordType,\n required String verificationCode,\n }) =>\n Mt5PasswordResetResponse.resetPassword(\n Mt5PasswordResetRequest(\n login: mt5NewAccount?.login,\n newPassword: newPassword,\n passwordType: getStringFromEnum(passwordType),\n verificationCode: verificationCode,\n ),\n );\n\n /// Gets the MT5 user account settings.\n ///\n /// Throws a [MT5Exception] if API response contains an error\n Future fetchSettings() =>\n Mt5GetSettingsResponse.fetchSettings(\n Mt5GetSettingsRequest(login: mt5NewAccount?.login));\n\n /// Allows withdrawal from MT5 account to Binary account.\n ///\n /// Throws a [MT5Exception] if API response contains an error\n Future withdraw({\n required double amount,\n required String toBinary,\n }) =>\n Mt5WithdrawalResponse.withdraw(\n Mt5WithdrawalRequest(\n amount: amount,\n fromMt5: mt5NewAccount?.login,\n toBinary: toBinary,\n ),\n );", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Creates new MT5 user, either demo or real money user.\n ///\n /// For parameters information refer to [Mt5NewAccountRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future createNewAccount(\n Mt5NewAccountRequest request,\n ) async {\n final Mt5NewAccountReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5NewAccountResponse.fromJson(response.mt5NewAccount);\n }\n\n /// Allows deposit into MT5 account from binary account.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future deposit({\n required double amount,\n required String fromBinary,\n }) =>\n Mt5DepositResponse.deposit(\n Mt5DepositRequest(\n amount: amount,\n fromBinary: fromBinary,\n toMt5: mt5NewAccount?.login,\n ),\n );\n\n /// Changes password of the MT5 account.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future changePassword({\n required String newPassword,\n required String oldPassword,\n required PasswordType passwordType,\n }) =>\n Mt5PasswordChangeResponse.changePassword(\n Mt5PasswordChangeRequest(\n login: mt5NewAccount?.login,\n newPassword: newPassword,\n oldPassword: oldPassword,\n passwordType: getStringFromEnum(passwordType),\n ),\n );\n\n /// Validates the main password for the MT5 user.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future checkPassword({\n required String password,\n required PasswordType passwordType,\n }) =>\n Mt5PasswordCheckResponse.checkPassword(\n Mt5PasswordCheckRequest(\n login: mt5NewAccount?.login,\n password: password,\n passwordType: getStringFromEnum(passwordType),\n ),\n );\n\n /// Resets the password of MT5 account.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future resetPassword({\n required String newPassword,\n required PasswordType passwordType,\n required String verificationCode,\n }) =>\n Mt5PasswordResetResponse.resetPassword(\n Mt5PasswordResetRequest(\n login: mt5NewAccount?.login,\n newPassword: newPassword,\n passwordType: getStringFromEnum(passwordType),\n verificationCode: verificationCode,\n ),\n );\n\n /// Gets the MT5 user account settings.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future fetchSettings() =>\n Mt5GetSettingsResponse.fetchSettings(\n Mt5GetSettingsRequest(login: mt5NewAccount?.login));\n\n /// Allows withdrawal from MT5 account to Binary account.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future withdraw({\n required double amount,\n required String toBinary,\n }) =>\n Mt5WithdrawalResponse.withdraw(\n Mt5WithdrawalRequest(\n amount: amount,\n fromMt5: mt5NewAccount?.login,\n toBinary: toBinary,\n ),\n );", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/mt5_deposit_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/mt5_get_settings_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/mt5_password_change_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/mt5_password_check_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/mt5_password_reset_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/mt5_withdrawal_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_deposit_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_get_settings_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_new_account_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_new_account_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_password_change_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_password_check_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_password_reset_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_withdrawal_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/mt5_password_change_receive_methods.json b/lib/basic_api/generated/methods/mt5_password_change_receive_methods.json index b8242c6dc4..3ec33261a9 100644 --- a/lib/basic_api/generated/methods/mt5_password_change_receive_methods.json +++ b/lib/basic_api/generated/methods/mt5_password_change_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Changes the password of the MT5 account.\n ///\n /// For parameters information refer to [Mt5PasswordChangeRequest].\n /// Throws a [MT5Exception] if API response contains an error\n static Future changePassword(\n Mt5PasswordChangeRequest request,\n ) async {\n final Mt5PasswordChangeReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n MT5Exception(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5PasswordChangeResponse.fromJson(response.mt5PasswordChange);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Changes the password of the MT5 account.\n ///\n /// For parameters information refer to [Mt5PasswordChangeRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future changePassword(\n Mt5PasswordChangeRequest request,\n ) async {\n final Mt5PasswordChangeReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5PasswordChangeResponse.fromJson(response.mt5PasswordChange);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_password_change_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_password_change_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/mt5_password_check_receive_methods.json b/lib/basic_api/generated/methods/mt5_password_check_receive_methods.json index 338d2adcca..37fced0811 100644 --- a/lib/basic_api/generated/methods/mt5_password_check_receive_methods.json +++ b/lib/basic_api/generated/methods/mt5_password_check_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": " static final BaseAPI _api = Injector()();\n\n /// Validates the main password for the MT5 user.\n ///\n /// For parameters information refer to [Mt5PasswordCheckRequest].\n /// Throws a [MT5Exception] if API response contains an error\n static Future checkPassword(\n Mt5PasswordCheckRequest request) async {\n final Mt5PasswordCheckReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n MT5Exception(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5PasswordCheckResponse.fromJson(response.mt5PasswordCheck);\n }", + "methods": " static final BaseAPI _api = Injector()();\n\n /// Validates the main password for the MT5 user.\n ///\n /// For parameters information refer to [Mt5PasswordCheckRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future checkPassword(\n Mt5PasswordCheckRequest request) async {\n final Mt5PasswordCheckReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5PasswordCheckResponse.fromJson(response.mt5PasswordCheck);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_password_check_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_password_check_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/mt5_password_reset_receive_methods.json b/lib/basic_api/generated/methods/mt5_password_reset_receive_methods.json index 4ac6345815..313455c694 100644 --- a/lib/basic_api/generated/methods/mt5_password_reset_receive_methods.json +++ b/lib/basic_api/generated/methods/mt5_password_reset_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Resets the password of MT5 account.\n ///\n /// For parameters information refer to [Mt5PasswordResetRequest].\n /// Throws a [MT5Exception] if API response contains an error\n static Future resetPassword(\n Mt5PasswordResetRequest request,\n ) async {\n final Mt5PasswordResetReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n MT5Exception(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5PasswordResetResponse.fromJson(response.mt5PasswordReset);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Resets the password of MT5 account.\n ///\n /// For parameters information refer to [Mt5PasswordResetRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future resetPassword(\n Mt5PasswordResetRequest request,\n ) async {\n final Mt5PasswordResetReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5PasswordResetResponse.fromJson(response.mt5PasswordReset);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_password_reset_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_password_reset_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/mt5_withdrawal_receive_methods.json b/lib/basic_api/generated/methods/mt5_withdrawal_receive_methods.json index ab2b385cb4..d331066cf3 100644 --- a/lib/basic_api/generated/methods/mt5_withdrawal_receive_methods.json +++ b/lib/basic_api/generated/methods/mt5_withdrawal_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Allows withdrawal from MT5 account to Binary account.\n ///\n /// For parameters information refer to [Mt5WithdrawalRequest].\n /// Throws a [MT5Exception] if API response contains an error\n static Future withdraw(\n Mt5WithdrawalRequest request,\n ) async {\n final Mt5WithdrawalReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n MT5Exception(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5WithdrawalResponse.fromJson(\n response.mt5Withdrawal,\n response.binaryTransactionId,\n );\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Allows withdrawal from MT5 account to Binary account.\n ///\n /// For parameters information refer to [Mt5WithdrawalRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future withdraw(\n Mt5WithdrawalRequest request,\n ) async {\n final Mt5WithdrawalReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return Mt5WithdrawalResponse.fromJson(\n response.mt5Withdrawal,\n response.binaryTransactionId,\n );\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_withdrawal_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/mt5_withdrawal_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/new_account_real_receive_methods.json b/lib/basic_api/generated/methods/new_account_real_receive_methods.json index e54b0370ad..9acffcad3d 100644 --- a/lib/basic_api/generated/methods/new_account_real_receive_methods.json +++ b/lib/basic_api/generated/methods/new_account_real_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Opens a new real account.\n ///\n /// For parameters information refer to [NewAccountRealRequest].\n /// Throws a [NewAccountException] ifAP\n static Future openNewRealAccount(\n NewAccountRealRequest request,\n ) async {\n final NewAccountRealReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n NewAccountException(baseExceptionModel: baseExceptionModel),\n );\n\n return NewAccountRealResponse.fromJson(response.newAccountReal);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Opens a new real account.\n ///\n /// For parameters information refer to [NewAccountRealRequest].\n /// Throws a [BaseAPIException] ifAP\n static Future openNewRealAccount(\n NewAccountRealRequest request,\n ) async {\n final NewAccountRealReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return NewAccountRealResponse.fromJson(response.newAccountReal);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/new_account_real_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/new_account_real_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/new_account_virtual_receive_methods.json b/lib/basic_api/generated/methods/new_account_virtual_receive_methods.json index a5e6695b8c..b095060dab 100644 --- a/lib/basic_api/generated/methods/new_account_virtual_receive_methods.json +++ b/lib/basic_api/generated/methods/new_account_virtual_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Opens a new virtual account.\n ///\n /// For parameters information refer to [NewAccountVirtualRequest].\n /// Throws a [NewAccountException] if API response contains an error\n static Future openNewVirtualAccount(\n NewAccountVirtualRequest request,\n ) async {\n final NewAccountVirtualReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n NewAccountException(baseExceptionModel: baseExceptionModel),\n );\n\n return NewAccountVirtualResponse.fromJson(response.newAccountVirtual);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Opens a new virtual account.\n ///\n /// For parameters information refer to [NewAccountVirtualRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future openNewVirtualAccount(\n NewAccountVirtualRequest request,\n ) async {\n final NewAccountVirtualReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return NewAccountVirtualResponse.fromJson(response.newAccountVirtual);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/new_account_virtual_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/new_account_virtual_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/oauth_apps_receive_methods.json b/lib/basic_api/generated/methods/oauth_apps_receive_methods.json index 410222195f..4906abfe66 100644 --- a/lib/basic_api/generated/methods/oauth_apps_receive_methods.json +++ b/lib/basic_api/generated/methods/oauth_apps_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets oauth application that used for the authorized account.\n ///\n /// Throws an [AppException] if API response contains an error\n static Future fetchOauthApps([\n OauthAppsRequest? request,\n ]) async {\n final OauthAppsReceive response = await _api.call(\n request: request ?? const OauthAppsRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AppException(baseExceptionModel: baseExceptionModel),\n );\n\n return OauthAppsResponse.fromJson(response.oauthApps);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets oauth application that used for the authorized account.\n ///\n /// Throws an [BaseAPIException] if API response contains an error\n static Future fetchOauthApps([\n OauthAppsRequest? request,\n ]) async {\n final OauthAppsReceive response = await _api.call(\n request: request ?? const OauthAppsRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return OauthAppsResponse.fromJson(response.oauthApps);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/oauth_apps_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/oauth_apps_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_advert_create_receive_methods.json b/lib/basic_api/generated/methods/p2p_advert_create_receive_methods.json index 505e5ec077..289d4406f0 100644 --- a/lib/basic_api/generated/methods/p2p_advert_create_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advert_create_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Creates a P2P (peer to peer) advert. Can only be used by an approved P2P advertiser.\n ///\n /// For parameters information refer to [P2pAdvertCreateRequest].\n /// Throws a [P2PAdvertException] if API response contains an error\n static Future createAdvert(\n P2pAdvertCreateRequest request,\n ) async {\n final P2pAdvertCreateReceive response = await createAdvertRaw(request);\n\n return P2pAdvertCreateResponse.fromJson(response.p2pAdvertCreate);\n }\n\n /// Creates a P2P (peer to peer) advert. Can only be used by an approved P2P advertiser.\n ///\n /// For parameters information refer to [P2pAdvertCreateRequest].\n /// Throws a [P2PAdvertException] if API response contains an error\n static Future createAdvertRaw(\n P2pAdvertCreateRequest request,\n ) async {\n final P2pAdvertCreateReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n P2PAdvertException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Creates a P2P (peer to peer) advert. Can only be used by an approved P2P advertiser.\n ///\n /// For parameters information refer to [P2pAdvertCreateRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future createAdvert(\n P2pAdvertCreateRequest request,\n ) async {\n final P2pAdvertCreateReceive response = await createAdvertRaw(request);\n\n return P2pAdvertCreateResponse.fromJson(response.p2pAdvertCreate);\n }\n\n /// Creates a P2P (peer to peer) advert. Can only be used by an approved P2P advertiser.\n ///\n /// For parameters information refer to [P2pAdvertCreateRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future createAdvertRaw(\n P2pAdvertCreateRequest request,\n ) async {\n final P2pAdvertCreateReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/p2p_advert_exception.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_advert_info_receive_methods.json b/lib/basic_api/generated/methods/p2p_advert_info_receive_methods.json index ed9fe72e9a..f802837575 100644 --- a/lib/basic_api/generated/methods/p2p_advert_info_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advert_info_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves information about a P2P (peer to peer) advert.\n ///\n /// For parameters information refer to [P2pAdvertInfoRequest].\n /// Throws a [P2PAdvertException] if API response contains an error\n static Future fetchAdvert(\n P2pAdvertInfoRequest request,\n ) async {\n final P2pAdvertInfoReceive response = await fetchAdvertRaw(request);\n\n return P2pAdvertInfoResponse.fromJson(\n response.p2pAdvertInfo, response.subscription);\n }\n\n /// Retrieves information about a P2P (peer to peer) advert.\n ///\n /// For parameters information refer to [P2pAdvertInfoRequest].\n /// Throws a [P2PAdvertException] if API response contains an error\n static Future fetchAdvertRaw(\n P2pAdvertInfoRequest request,\n ) async {\n final P2pAdvertInfoReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n P2PAdvertException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }\n\n /// Updates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// [delete] to permanently delete the advert\n /// [isActive] to activate or deactivate the advert\n /// Throws a [P2PAdvertException] if API response contains an error\n Future update({\n bool? delete,\n bool? isActive,\n }) =>\n P2pAdvertUpdateResponse.updateAdvert(\n P2pAdvertUpdateRequest(\n id: p2pAdvertInfo?.id,\n delete: delete ?? false,\n isActive: isActive ?? p2pAdvertInfo?.isActive,\n ),\n );\n\n /// Updates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// [delete] to permanently delete the advert\n /// [isActive] to activate or deactivate the advert\n /// Throws a [P2PAdvertException] if API response contains an error\n Future updateRaw({\n bool? delete,\n bool? isActive,\n }) =>\n P2pAdvertUpdateResponse.updateAdvertRaw(\n P2pAdvertUpdateRequest(\n id: p2pAdvertInfo?.id,\n delete: delete ?? false,\n isActive: isActive ?? p2pAdvertInfo?.isActive,\n ),\n );\n\n /// Deletes permanently a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [P2PAdvertException] if API response contains an error\n Future delete() => update(delete: true);\n\n /// Deletes permanently a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [P2PAdvertException] if API response contains an error\n Future deleteRaw() => updateRaw(delete: true);\n\n /// Activates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [P2PAdvertException] if API response contains an error\n Future activate() async => update(isActive: true);\n\n /// Activates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [P2PAdvertException] if API response contains an error\n Future activateRaw() async =>\n updateRaw(isActive: true);\n\n /// Deactivates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [P2PAdvertException] if API response contains an error\n Future deactivate() async => update(isActive: false);\n\n /// Deactivates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [P2PAdvertException] if API response contains an error\n Future deactivateRaw() async =>\n updateRaw(isActive: false);\n\n /// Creates order on this advert.\n ///\n /// [amount] is the amount of currency to be bought or sold.\n /// [contactInfo] is seller contact information. Only applicable for [OrderType.sell].\n /// [paymentInfo] is payment instructions. Only applicable for [OrderType.sell].\n /// Throws [P2POrderException] if API response contains an error.\n Future createOrder({\n required double amount,\n String? contactInfo,\n String? paymentInfo,\n }) =>\n P2pOrderCreateResponse.create(\n P2pOrderCreateRequest(\n advertId: p2pAdvertInfo?.id,\n amount: amount,\n contactInfo: contactInfo,\n paymentInfo: paymentInfo,\n paymentMethodIds: const [],\n ),\n );\n\n /// Creates order on this advert.\n ///\n /// [amount] is the amount of currency to be bought or sold.\n /// [contactInfo] is seller contact information. Only applicable for [OrderType.sell].\n /// [paymentInfo] is payment instructions. Only applicable for [OrderType.sell].\n /// Throws [P2POrderException] if API response contains an error.\n Future createOrderRaw({\n required double amount,\n String? contactInfo,\n String? paymentInfo,\n }) =>\n P2pOrderCreateResponse.createRaw(\n P2pOrderCreateRequest(\n advertId: p2pAdvertInfo?.id,\n amount: amount,\n contactInfo: contactInfo,\n paymentInfo: paymentInfo,\n paymentMethodIds: const [],\n ),\n );", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves information about a P2P (peer to peer) advert.\n ///\n /// For parameters information refer to [P2pAdvertInfoRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchAdvert(\n P2pAdvertInfoRequest request,\n ) async {\n final P2pAdvertInfoReceive response = await fetchAdvertRaw(request);\n\n return P2pAdvertInfoResponse.fromJson(\n response.p2pAdvertInfo, response.subscription);\n }\n\n /// Retrieves information about a P2P (peer to peer) advert.\n ///\n /// For parameters information refer to [P2pAdvertInfoRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchAdvertRaw(\n P2pAdvertInfoRequest request,\n ) async {\n final P2pAdvertInfoReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }\n\n /// Updates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// [delete] to permanently delete the advert\n /// [isActive] to activate or deactivate the advert\n /// Throws a [BaseAPIException] if API response contains an error\n Future update({\n bool? delete,\n bool? isActive,\n }) =>\n P2pAdvertUpdateResponse.updateAdvert(\n P2pAdvertUpdateRequest(\n id: p2pAdvertInfo?.id,\n delete: delete ?? false,\n isActive: isActive ?? p2pAdvertInfo?.isActive,\n ),\n );\n\n /// Updates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// [delete] to permanently delete the advert\n /// [isActive] to activate or deactivate the advert\n /// Throws a [BaseAPIException] if API response contains an error\n Future updateRaw({\n bool? delete,\n bool? isActive,\n }) =>\n P2pAdvertUpdateResponse.updateAdvertRaw(\n P2pAdvertUpdateRequest(\n id: p2pAdvertInfo?.id,\n delete: delete ?? false,\n isActive: isActive ?? p2pAdvertInfo?.isActive,\n ),\n );\n\n /// Deletes permanently a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future delete() => update(delete: true);\n\n /// Deletes permanently a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future deleteRaw() => updateRaw(delete: true);\n\n /// Activates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future activate() async => update(isActive: true);\n\n /// Activates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future activateRaw() async =>\n updateRaw(isActive: true);\n\n /// Deactivates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future deactivate() async => update(isActive: false);\n\n /// Deactivates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future deactivateRaw() async =>\n updateRaw(isActive: false);\n\n /// Creates order on this advert.\n ///\n /// [amount] is the amount of currency to be bought or sold.\n /// [contactInfo] is seller contact information. Only applicable for [OrderType.sell].\n /// [paymentInfo] is payment instructions. Only applicable for [OrderType.sell].\n /// Throws [BaseAPIException] if API response contains an error.\n Future createOrder({\n required double amount,\n String? contactInfo,\n String? paymentInfo,\n }) =>\n P2pOrderCreateResponse.create(\n P2pOrderCreateRequest(\n advertId: p2pAdvertInfo?.id,\n amount: amount,\n contactInfo: contactInfo,\n paymentInfo: paymentInfo,\n paymentMethodIds: const [],\n ),\n );\n\n /// Creates order on this advert.\n ///\n /// [amount] is the amount of currency to be bought or sold.\n /// [contactInfo] is seller contact information. Only applicable for [OrderType.sell].\n /// [paymentInfo] is payment instructions. Only applicable for [OrderType.sell].\n /// Throws [BaseAPIException] if API response contains an error.\n Future createOrderRaw({\n required double amount,\n String? contactInfo,\n String? paymentInfo,\n }) =>\n P2pOrderCreateResponse.createRaw(\n P2pOrderCreateRequest(\n advertId: p2pAdvertInfo?.id,\n amount: amount,\n contactInfo: contactInfo,\n paymentInfo: paymentInfo,\n paymentMethodIds: const [],\n ),\n );", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_payment_methods_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_payment_methods_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/response/p2p_advert_update_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/p2p_order_create_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advert_info_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advert_info_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advert_update_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advert_update_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_create_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_create_send.dart';" } diff --git a/lib/basic_api/generated/methods/p2p_advert_list_receive_methods.json b/lib/basic_api/generated/methods/p2p_advert_list_receive_methods.json index 70657825fe..daebd9dca1 100644 --- a/lib/basic_api/generated/methods/p2p_advert_list_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advert_list_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Returns available adverts.\n ///\n /// For parameters information refer to [P2pAdvertListRequest].\n /// Throws a [P2PAdvertException] if API response contains an error\n static Future fetchAdvertList(\n P2pAdvertListRequest request,\n ) async {\n final P2pAdvertListReceive response = await fetchAdvertListRaw(request);\n\n return P2pAdvertListResponse.fromJson(response.p2pAdvertList);\n }\n\n /// Returns available adverts.\n ///\n /// For parameters information refer to [P2pAdvertListRequest].\n /// Throws a [P2PAdvertException] if API response contains an error\n static Future fetchAdvertListRaw(\n P2pAdvertListRequest request,\n ) async {\n final P2pAdvertListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n P2PAdvertException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Returns available adverts.\n ///\n /// For parameters information refer to [P2pAdvertListRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchAdvertList(\n P2pAdvertListRequest request,\n ) async {\n final P2pAdvertListReceive response = await fetchAdvertListRaw(request);\n\n return P2pAdvertListResponse.fromJson(response.p2pAdvertList);\n }\n\n /// Returns available adverts.\n ///\n /// For parameters information refer to [P2pAdvertListRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchAdvertListRaw(\n P2pAdvertListRequest request,\n ) async {\n final P2pAdvertListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/p2p_advert_exception.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_advert_update_receive_methods.json b/lib/basic_api/generated/methods/p2p_advert_update_receive_methods.json index c1e214b6fe..f376f3a98b 100644 --- a/lib/basic_api/generated/methods/p2p_advert_update_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advert_update_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Updates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// For parameters information refer to [P2pAdvertUpdateRequest].\n /// Throws a [P2PAdvertException] if API response contains an error\n static Future updateAdvert(\n P2pAdvertUpdateRequest request,\n ) async {\n final P2pAdvertUpdateReceive response = await updateAdvertRaw(request);\n\n return P2pAdvertUpdateResponse.fromJson(response.p2pAdvertUpdate);\n }\n\n /// Updates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// For parameters information refer to [P2pAdvertUpdateRequest].\n /// Throws a [P2PAdvertException] if API response contains an error\n static Future updateAdvertRaw(\n P2pAdvertUpdateRequest request,\n ) async {\n final P2pAdvertUpdateReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n P2PAdvertException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Updates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// For parameters information refer to [P2pAdvertUpdateRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future updateAdvert(\n P2pAdvertUpdateRequest request,\n ) async {\n final P2pAdvertUpdateReceive response = await updateAdvertRaw(request);\n\n return P2pAdvertUpdateResponse.fromJson(response.p2pAdvertUpdate);\n }\n\n /// Updates a P2P (peer to peer) advert. Can only be used by the advertiser.\n ///\n /// For parameters information refer to [P2pAdvertUpdateRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future updateAdvertRaw(\n P2pAdvertUpdateRequest request,\n ) async {\n final P2pAdvertUpdateReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advert_update_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advert_update_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_advertiser_adverts_receive_methods.json b/lib/basic_api/generated/methods/p2p_advertiser_adverts_receive_methods.json index a333189fff..e0c60aff10 100644 --- a/lib/basic_api/generated/methods/p2p_advertiser_adverts_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advertiser_adverts_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Returns all P2P (peer to peer) adverts created by the authorized client.\n /// Can only be used by a registered P2P advertiser.\n /// For parameters information refer to [P2pAdvertiserAdvertsRequest].\n static Future fetchAdvertiserAdverts(\n P2pAdvertiserAdvertsRequest request,\n ) async {\n final P2pAdvertiserAdvertsReceive response =\n await fetchAdvertiserAdvertsRaw(request);\n\n return P2pAdvertiserAdvertsResponse.fromJson(response.p2pAdvertiserAdverts);\n }\n\n /// Returns all P2P (peer to peer) adverts created by the authorized client.\n /// Can only be used by a registered P2P advertiser.\n /// For parameters information refer to [P2pAdvertiserAdvertsRequest].\n static Future fetchAdvertiserAdvertsRaw(\n P2pAdvertiserAdvertsRequest request,\n ) async {\n final P2pAdvertiserAdvertsReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n P2PAdvertiserException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Returns all P2P (peer to peer) adverts created by the authorized client.\n /// Can only be used by a registered P2P advertiser.\n /// For parameters information refer to [P2pAdvertiserAdvertsRequest].\n static Future fetchAdvertiserAdverts(\n P2pAdvertiserAdvertsRequest request,\n ) async {\n final P2pAdvertiserAdvertsReceive response =\n await fetchAdvertiserAdvertsRaw(request);\n\n return P2pAdvertiserAdvertsResponse.fromJson(response.p2pAdvertiserAdverts);\n }\n\n /// Returns all P2P (peer to peer) adverts created by the authorized client.\n /// Can only be used by a registered P2P advertiser.\n /// For parameters information refer to [P2pAdvertiserAdvertsRequest].\n static Future fetchAdvertiserAdvertsRaw(\n P2pAdvertiserAdvertsRequest request,\n ) async {\n final P2pAdvertiserAdvertsReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_adverts_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_adverts_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_advertiser_create_receive_methods.json b/lib/basic_api/generated/methods/p2p_advertiser_create_receive_methods.json index 08ca259654..253fe61c3f 100644 --- a/lib/basic_api/generated/methods/p2p_advertiser_create_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advertiser_create_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Registers the client as a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserCreateRequest]. \n static Future createAdvertiser( \n P2pAdvertiserCreateRequest request, \n ) async { \n final P2pAdvertiserCreateReceive response = \n await createAdvertiserRaw(request); \n \n return P2pAdvertiserCreateResponse.fromJson( \n response.p2pAdvertiserCreate, response.subscription); \n } \n \n /// Registers the client as a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserCreateRequest]. \n static Future createAdvertiserRaw( \n P2pAdvertiserCreateRequest request, \n ) async { \n final P2pAdvertiserCreateReceive response = await _api.call( \n request: request.copyWith(subscribe: false), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2PAdvertiserException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Registers the client as a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserCreateRequest]. \n static Stream createAdvertiserAndSubscribe( \n P2pAdvertiserCreateRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n createAdvertiserAndSubscribeRaw( \n request, \n comparePredicate: comparePredicate, \n ).map( \n (P2pAdvertiserCreateReceive? response) => response == null \n ? null \n : P2pAdvertiserCreateResponse.fromJson( \n response.p2pAdvertiserCreate, \n response.subscription, \n ), \n ); \n \n /// Registers the client as a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserCreateRequest]. \n static Stream createAdvertiserAndSubscribeRaw( \n P2pAdvertiserCreateRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n _api \n .subscribe(request: request, comparePredicate: comparePredicate)! \n .map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2PAdvertiserException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is P2pAdvertiserCreateReceive ? response : null; \n }, \n );", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Registers the client as a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserCreateRequest]. \n static Future createAdvertiser( \n P2pAdvertiserCreateRequest request, \n ) async { \n final P2pAdvertiserCreateReceive response = \n await createAdvertiserRaw(request); \n \n return P2pAdvertiserCreateResponse.fromJson( \n response.p2pAdvertiserCreate, response.subscription); \n } \n \n /// Registers the client as a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserCreateRequest]. \n static Future createAdvertiserRaw( \n P2pAdvertiserCreateRequest request, \n ) async { \n final P2pAdvertiserCreateReceive response = await _api.call( \n request: request.copyWith(subscribe: false), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Registers the client as a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserCreateRequest]. \n static Stream createAdvertiserAndSubscribe( \n P2pAdvertiserCreateRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n createAdvertiserAndSubscribeRaw( \n request, \n comparePredicate: comparePredicate, \n ).map( \n (P2pAdvertiserCreateReceive? response) => response == null \n ? null \n : P2pAdvertiserCreateResponse.fromJson( \n response.p2pAdvertiserCreate, \n response.subscription, \n ), \n ); \n \n /// Registers the client as a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserCreateRequest]. \n static Stream createAdvertiserAndSubscribeRaw( \n P2pAdvertiserCreateRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n _api \n .subscribe(request: request, comparePredicate: comparePredicate)! \n .map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is P2pAdvertiserCreateReceive ? response : null; \n }, \n );", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_create_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_create_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_advertiser_info_receive_methods.json b/lib/basic_api/generated/methods/p2p_advertiser_info_receive_methods.json index 80dc0a9c03..ebff4791a0 100644 --- a/lib/basic_api/generated/methods/p2p_advertiser_info_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advertiser_info_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Retrieves information about a P2P (peer to peer) advertiser. \n /// \n /// For parameters information refer to [P2pAdvertiserInfoRequest]. \n /// Throws a [P2PAdvertiserException] if API response contains an error. \n static Future fetchAdvertiserInformation( \n P2pAdvertiserInfoRequest request, \n ) async { \n final P2pAdvertiserInfoReceive response = \n await fetchAdvertiserInformationRaw(request); \n \n return P2pAdvertiserInfoResponse.fromJson( \n response.p2pAdvertiserInfo, response.subscription); \n } \n \n /// Retrieves information about a P2P (peer to peer) advertiser. \n /// \n /// For parameters information refer to [P2pAdvertiserInfoRequest]. \n /// Throws a [P2PAdvertiserException] if API response contains an error. \n static Future fetchAdvertiserInformationRaw( \n P2pAdvertiserInfoRequest request, \n ) async { \n final P2pAdvertiserInfoReceive response = await _api.call( \n request: request.copyWith(subscribe: false), \n ); \n \n return response; \n } \n \n /// Subscribes to information about a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserInfoRequest]. \n static Stream subscribeAdvertiserInformation( \n P2pAdvertiserInfoRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeAdvertiserInformationRaw( \n request, \n comparePredicate: comparePredicate, \n ).map( \n (P2pAdvertiserInfoReceive? response) => response == null \n ? null \n : P2pAdvertiserInfoResponse.fromJson( \n response.p2pAdvertiserInfo, \n response.subscription, \n ), \n ); \n \n /// Subscribes to information about a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserInfoRequest]. \n static Stream subscribeAdvertiserInformationRaw( \n P2pAdvertiserInfoRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n _api \n .subscribe(request: request, comparePredicate: comparePredicate)! \n .map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2PAdvertiserException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is P2pAdvertiserInfoReceive ? response : null; \n }, \n ); \n \n /// Unsubscribes from P2P (peer to peer) advertiser information. \n /// \n /// Throws a [P2PAdvertiserException] if API response contains an error. \n Future unsubscribeAdvertiser() async { \n if (subscription == null) { \n return null; \n } \n \n final ForgetReceive response = \n await _api.unsubscribe(subscriptionId: subscription!.id); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2PAdvertiserException(baseExceptionModel: baseExceptionModel), \n ); \n \n return ForgetResponse.fromJson(response.forget); \n } \n \n /// Unsubscribes all P2P (peer to peer) advertisers. \n /// \n /// Throws a [P2PAdvertiserException] if API response contains an error. \n static Future unsubscribeAllAdvertiser() async { \n final ForgetAllReceive response = \n await _api.unsubscribeAll(method: ForgetStreamType.p2pAdvertiser); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2PAdvertiserException(baseExceptionModel: baseExceptionModel), \n ); \n \n return ForgetAllResponse.fromJson(response.forgetAll); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Retrieves information about a P2P (peer to peer) advertiser. \n /// \n /// For parameters information refer to [P2pAdvertiserInfoRequest]. \n /// Throws a [BaseAPIException] if API response contains an error. \n static Future fetchAdvertiserInformation( \n P2pAdvertiserInfoRequest request, \n ) async { \n final P2pAdvertiserInfoReceive response = \n await fetchAdvertiserInformationRaw(request); \n \n return P2pAdvertiserInfoResponse.fromJson( \n response.p2pAdvertiserInfo, response.subscription); \n } \n \n /// Retrieves information about a P2P (peer to peer) advertiser. \n /// \n /// For parameters information refer to [P2pAdvertiserInfoRequest]. \n /// Throws a [BaseAPIException] if API response contains an error. \n static Future fetchAdvertiserInformationRaw( \n P2pAdvertiserInfoRequest request, \n ) async { \n final P2pAdvertiserInfoReceive response = await _api.call( \n request: request.copyWith(subscribe: false), \n ); \n \n return response; \n } \n \n /// Subscribes to information about a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserInfoRequest]. \n static Stream subscribeAdvertiserInformation( \n P2pAdvertiserInfoRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeAdvertiserInformationRaw( \n request, \n comparePredicate: comparePredicate, \n ).map( \n (P2pAdvertiserInfoReceive? response) => response == null \n ? null \n : P2pAdvertiserInfoResponse.fromJson( \n response.p2pAdvertiserInfo, \n response.subscription, \n ), \n ); \n \n /// Subscribes to information about a P2P (peer to peer) advertiser. \n /// For parameters information refer to [P2pAdvertiserInfoRequest]. \n static Stream subscribeAdvertiserInformationRaw( \n P2pAdvertiserInfoRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n _api \n .subscribe(request: request, comparePredicate: comparePredicate)! \n .map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is P2pAdvertiserInfoReceive ? response : null; \n }, \n ); \n \n /// Unsubscribes from P2P (peer to peer) advertiser information. \n /// \n /// Throws a [BaseAPIException] if API response contains an error. \n Future unsubscribeAdvertiser() async { \n if (subscription == null) { \n return null; \n } \n \n final ForgetReceive response = \n await _api.unsubscribe(subscriptionId: subscription!.id); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return ForgetResponse.fromJson(response.forget); \n } \n \n /// Unsubscribes all P2P (peer to peer) advertisers. \n /// \n /// Throws a [BaseAPIException] if API response contains an error. \n static Future unsubscribeAllAdvertiser() async { \n final ForgetAllReceive response = \n await _api.unsubscribeAll(method: ForgetStreamType.p2pAdvertiser); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return ForgetAllResponse.fromJson(response.forgetAll); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_info_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_info_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_advertiser_list_receive_methods.json b/lib/basic_api/generated/methods/p2p_advertiser_list_receive_methods.json index 631dd05928..be58dbd598 100644 --- a/lib/basic_api/generated/methods/p2p_advertiser_list_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advertiser_list_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Returns P2P advertiser list. \n /// \n /// For parameters information refer to [P2pAdvertiserListRequest]. \n static Future fetchAdvertiserListRaw( \n P2pAdvertiserListRequest request, \n ) async { \n final P2pAdvertiserListReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2PAdvertiserException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Returns P2P advertiser list. \n /// \n /// For parameters information refer to [P2pAdvertiserListRequest]. \n static Future fetchAdvertiserList( \n P2pAdvertiserListRequest request, \n ) async { \n final P2pAdvertiserListReceive response = \n await fetchAdvertiserListRaw(request); \n \n return P2pAdvertiserListResponse.fromJson(response.p2pAdvertiserList); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Returns P2P advertiser list. \n /// \n /// For parameters information refer to [P2pAdvertiserListRequest]. \n static Future fetchAdvertiserListRaw( \n P2pAdvertiserListRequest request, \n ) async { \n final P2pAdvertiserListReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Returns P2P advertiser list. \n /// \n /// For parameters information refer to [P2pAdvertiserListRequest]. \n static Future fetchAdvertiserList( \n P2pAdvertiserListRequest request, \n ) async { \n final P2pAdvertiserListReceive response = \n await fetchAdvertiserListRaw(request); \n \n return P2pAdvertiserListResponse.fromJson(response.p2pAdvertiserList); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; \nimport 'package:flutter_deriv_api/basic_api/generated/api.dart'; \nimport 'package:flutter_deriv_api/helpers/helpers.dart'; \nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; \nimport 'package:deriv_dependency_injector/dependency_injector.dart';" } diff --git a/lib/basic_api/generated/methods/p2p_advertiser_payment_methods_receive_methods.json b/lib/basic_api/generated/methods/p2p_advertiser_payment_methods_receive_methods.json index 416f5ef7bc..3b177ab7ff 100644 --- a/lib/basic_api/generated/methods/p2p_advertiser_payment_methods_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advertiser_payment_methods_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Manage or list P2P advertiser payment methods. \n /// \n /// For parameters information refer to [P2pAdvertiserPaymentMethodsRequest]. \n /// Throws an [P2PAdvertiserException] if API response contains an error. \n static Future fetchMethodsRaw( \n P2pAdvertiserPaymentMethodsRequest request, \n ) async { \n final P2pAdvertiserPaymentMethodsReceive response = \n await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2PAdvertiserException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Manage or list P2P advertiser payment methods. \n /// \n /// For parameters information refer to [P2pAdvertiserPaymentMethodsRequest]. \n /// Throws an [P2PAdvertiserException] if API response contains an error. \n static Future fetchMethods( \n P2pAdvertiserPaymentMethodsRequest request, \n ) async { \n final P2pAdvertiserPaymentMethodsReceive response = \n await fetchMethodsRaw(request); \n \n return P2pAdvertiserPaymentMethodsResponse.fromJson( \n response.p2pAdvertiserPaymentMethods, \n ); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Manage or list P2P advertiser payment methods. \n /// \n /// For parameters information refer to [P2pAdvertiserPaymentMethodsRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchMethodsRaw( \n P2pAdvertiserPaymentMethodsRequest request, \n ) async { \n final P2pAdvertiserPaymentMethodsReceive response = \n await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Manage or list P2P advertiser payment methods. \n /// \n /// For parameters information refer to [P2pAdvertiserPaymentMethodsRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchMethods( \n P2pAdvertiserPaymentMethodsRequest request, \n ) async { \n final P2pAdvertiserPaymentMethodsReceive response = \n await fetchMethodsRaw(request); \n \n return P2pAdvertiserPaymentMethodsResponse.fromJson( \n response.p2pAdvertiserPaymentMethods, \n ); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; \nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart'; \nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_payment_methods_receive.dart'; \nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_payment_methods_send.dart'; \nimport 'package:flutter_deriv_api/helpers/helpers.dart'; \nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; \nimport 'package:deriv_dependency_injector/dependency_injector.dart';" } diff --git a/lib/basic_api/generated/methods/p2p_advertiser_relations_receive_methods.json b/lib/basic_api/generated/methods/p2p_advertiser_relations_receive_methods.json index 787fff5736..e6c65c6f75 100644 --- a/lib/basic_api/generated/methods/p2p_advertiser_relations_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advertiser_relations_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Updates and returns favourite and blocked advertisers of the current user. \n /// \n /// For parameters information refer to [P2pAdvertiserRelationsRequest]. \n /// Throws an [P2PAdvertiserException] if API response contains an error. \n static Future fetchRaw( \n P2pAdvertiserRelationsRequest request, \n ) async { \n final P2pAdvertiserRelationsReceive response = \n await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2PAdvertiserException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Updates and returns favourite and blocked advertisers of the current user. \n /// \n /// For parameters information refer to [P2pAdvertiserRelationsRequest]. \n /// Throws an [P2PAdvertiserException] if API response contains an error. \n static Future fetch( \n P2pAdvertiserRelationsRequest request, \n ) async { \n final P2pAdvertiserRelationsReceive response = await fetchRaw(request); \n \n return P2pAdvertiserRelationsResponse.fromJson( \n response.p2pAdvertiserRelations); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Updates and returns favourite and blocked advertisers of the current user. \n /// \n /// For parameters information refer to [P2pAdvertiserRelationsRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetchRaw( \n P2pAdvertiserRelationsRequest request, \n ) async { \n final P2pAdvertiserRelationsReceive response = \n await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Updates and returns favourite and blocked advertisers of the current user. \n /// \n /// For parameters information refer to [P2pAdvertiserRelationsRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future fetch( \n P2pAdvertiserRelationsRequest request, \n ) async { \n final P2pAdvertiserRelationsReceive response = await fetchRaw(request); \n \n return P2pAdvertiserRelationsResponse.fromJson( \n response.p2pAdvertiserRelations); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_relations_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_relations_send.dart';\n\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_advertiser_update_receive_methods.json b/lib/basic_api/generated/methods/p2p_advertiser_update_receive_methods.json index 98f52e3fba..02c3216d1a 100644 --- a/lib/basic_api/generated/methods/p2p_advertiser_update_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_advertiser_update_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Updates the information of the P2P (peer to peer) advertiser for the current account.\n /// Can only be used by an approved P2P advertiser.\n /// For parameters information refer to [P2pAdvertiserUpdateRequest].\n static Future updateAdvertiser(\n P2pAdvertiserUpdateRequest request,\n ) async {\n final P2pAdvertiserUpdateReceive response =\n await updateAdvertiserRaw(request);\n\n return P2pAdvertiserUpdateResponse.fromJson(response.p2pAdvertiserUpdate);\n }\n\n /// Updates the information of the P2P (peer to peer) advertiser for the current account.\n /// Can only be used by an approved P2P advertiser.\n /// For parameters information refer to [P2pAdvertiserUpdateRequest].\n static Future updateAdvertiserRaw(\n P2pAdvertiserUpdateRequest request,\n ) async {\n final P2pAdvertiserUpdateReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n P2PAdvertiserException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Updates the information of the P2P (peer to peer) advertiser for the current account.\n /// Can only be used by an approved P2P advertiser.\n /// For parameters information refer to [P2pAdvertiserUpdateRequest].\n static Future updateAdvertiser(\n P2pAdvertiserUpdateRequest request,\n ) async {\n final P2pAdvertiserUpdateReceive response =\n await updateAdvertiserRaw(request);\n\n return P2pAdvertiserUpdateResponse.fromJson(response.p2pAdvertiserUpdate);\n }\n\n /// Updates the information of the P2P (peer to peer) advertiser for the current account.\n /// Can only be used by an approved P2P advertiser.\n /// For parameters information refer to [P2pAdvertiserUpdateRequest].\n static Future updateAdvertiserRaw(\n P2pAdvertiserUpdateRequest request,\n ) async {\n final P2pAdvertiserUpdateReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_update_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_update_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_chat_create_receive_methods.json b/lib/basic_api/generated/methods/p2p_chat_create_receive_methods.json index 017b23a569..8292489322 100644 --- a/lib/basic_api/generated/methods/p2p_chat_create_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_chat_create_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Creates a P2P (peer to peer) chat for the specified order.\n ///\n /// For parameters information refer to [P2pChatCreateRequest].\n /// Throws a [P2PException] if API response contains an error\n static Future createChat(\n P2pChatCreateRequest request,\n ) async {\n final P2pChatCreateReceive response = await createChatRaw(request);\n\n return P2pChatCreateResponse.fromJson(response.p2pChatCreate);\n }\n\n /// Creates a P2P (peer to peer) chat for the specified order.\n ///\n /// For parameters information refer to [P2pChatCreateRequest].\n /// Throws a [P2PException] if API response contains an error\n static Future createChatRaw(\n P2pChatCreateRequest request,\n ) async {\n final P2pChatCreateReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n P2PChatException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Creates a P2P (peer to peer) chat for the specified order.\n ///\n /// For parameters information refer to [P2pChatCreateRequest].\n /// Throws a [P2PException] if API response contains an error\n static Future createChat(\n P2pChatCreateRequest request,\n ) async {\n final P2pChatCreateReceive response = await createChatRaw(request);\n\n return P2pChatCreateResponse.fromJson(response.p2pChatCreate);\n }\n\n /// Creates a P2P (peer to peer) chat for the specified order.\n ///\n /// For parameters information refer to [P2pChatCreateRequest].\n /// Throws a [P2PException] if API response contains an error\n static Future createChatRaw(\n P2pChatCreateRequest request,\n ) async {\n final P2pChatCreateReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_chat_create_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_chat_create_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_order_cancel_receive_methods.json b/lib/basic_api/generated/methods/p2p_order_cancel_receive_methods.json index e7ee333345..1d84f329e0 100644 --- a/lib/basic_api/generated/methods/p2p_order_cancel_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_order_cancel_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Cancel a P2P order. \n /// \n /// For parameters information refer to [P2pOrderCancelRequest]. \n /// Throws a [P2POrderException] if API response contains an error. \n static Future cancelOrderRaw( \n P2pOrderCancelRequest request, \n ) async { \n final P2pOrderCancelReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Cancel a P2P order. \n /// \n /// For parameters information refer to [P2pOrderCancelRequest]. \n /// Throws a [P2POrderException] if API response contains an error. \n static Future cancelOrder( \n P2pOrderCancelRequest request, \n ) async { \n final P2pOrderCancelReceive response = await cancelOrderRaw(request); \n \n return P2pOrderCancelResponse.fromJson(response.p2pOrderCancel); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Cancel a P2P order. \n /// \n /// For parameters information refer to [P2pOrderCancelRequest]. \n /// Throws a [BaseAPIException] if API response contains an error. \n static Future cancelOrderRaw( \n P2pOrderCancelRequest request, \n ) async { \n final P2pOrderCancelReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Cancel a P2P order. \n /// \n /// For parameters information refer to [P2pOrderCancelRequest]. \n /// Throws a [BaseAPIException] if API response contains an error. \n static Future cancelOrder( \n P2pOrderCancelRequest request, \n ) async { \n final P2pOrderCancelReceive response = await cancelOrderRaw(request); \n \n return P2pOrderCancelResponse.fromJson(response.p2pOrderCancel); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_cancel_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_cancel_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_order_confirm_receive_methods.json b/lib/basic_api/generated/methods/p2p_order_confirm_receive_methods.json index 32c7af8324..693e3a02a6 100644 --- a/lib/basic_api/generated/methods/p2p_order_confirm_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_order_confirm_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Cancel a P2P order confirm. \n /// \n /// For parameters information refer to [P2pOrderConfirmRequest]. \n /// Throws an [P2POrderException] if API response contains an error. \n static Future confirmOrderRaw( \n P2pOrderConfirmRequest request, \n ) async { \n final P2pOrderConfirmReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Cancel a P2P order confirm. \n /// \n /// For parameters information refer to [P2pOrderConfirmRequest]. \n /// Throws an [P2POrderException] if API response contains an error. \n static Future confirmOrder( \n P2pOrderConfirmRequest request, \n ) async { \n final P2pOrderConfirmReceive response = await confirmOrderRaw(request); \n \n return P2pOrderConfirmResponse.fromJson(response.p2pOrderConfirm); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Cancel a P2P order confirm. \n /// \n /// For parameters information refer to [P2pOrderConfirmRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future confirmOrderRaw( \n P2pOrderConfirmRequest request, \n ) async { \n final P2pOrderConfirmReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Cancel a P2P order confirm. \n /// \n /// For parameters information refer to [P2pOrderConfirmRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future confirmOrder( \n P2pOrderConfirmRequest request, \n ) async { \n final P2pOrderConfirmReceive response = await confirmOrderRaw(request); \n \n return P2pOrderConfirmResponse.fromJson(response.p2pOrderConfirm); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_confirm_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_confirm_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_order_create_receive_methods.json b/lib/basic_api/generated/methods/p2p_order_create_receive_methods.json index 77922b9180..6eec513313 100644 --- a/lib/basic_api/generated/methods/p2p_order_create_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_order_create_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Creates order with parameters specified in [P2pOrderCreateRequest] \n static Future create( \n P2pOrderCreateRequest request) async { \n final P2pOrderCreateReceive response = await createRaw(request); \n \n return P2pOrderCreateResponse.fromJson( \n response.p2pOrderCreate, response.subscription); \n } \n \n /// Creates order with parameters specified in [P2pOrderCreateRequest] \n static Future createRaw( \n P2pOrderCreateRequest request) async { \n final P2pOrderCreateReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Creates order and subscribes to the result with parameters specified in [P2pOrderCreateRequest] \n /// \n /// Throws a [P2POrderException] if API response contains an error \n static Stream createAndSubscribe( \n P2pOrderCreateRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n createAndSubscribeRaw( \n request, \n comparePredicate: comparePredicate, \n ).map( \n (P2pOrderCreateReceive? response) => response == null \n ? null \n : P2pOrderCreateResponse.fromJson( \n response.p2pOrderCreate, \n response.subscription, \n ), \n ); \n \n /// Creates order and subscribes to the result with parameters specified in [P2pOrderCreateRequest] \n /// \n /// Throws a [P2POrderException] if API response contains an error \n static Stream createAndSubscribeRaw( \n P2pOrderCreateRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n _api.subscribe(request: request, comparePredicate: comparePredicate)!.map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is P2pOrderCreateReceive ? response : null; \n }, \n );", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Creates order with parameters specified in [P2pOrderCreateRequest] \n static Future create( \n P2pOrderCreateRequest request) async { \n final P2pOrderCreateReceive response = await createRaw(request); \n \n return P2pOrderCreateResponse.fromJson( \n response.p2pOrderCreate, response.subscription); \n } \n \n /// Creates order with parameters specified in [P2pOrderCreateRequest] \n static Future createRaw( \n P2pOrderCreateRequest request) async { \n final P2pOrderCreateReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Creates order and subscribes to the result with parameters specified in [P2pOrderCreateRequest] \n /// \n /// Throws a [BaseAPIException] if API response contains an error \n static Stream createAndSubscribe( \n P2pOrderCreateRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n createAndSubscribeRaw( \n request, \n comparePredicate: comparePredicate, \n ).map( \n (P2pOrderCreateReceive? response) => response == null \n ? null \n : P2pOrderCreateResponse.fromJson( \n response.p2pOrderCreate, \n response.subscription, \n ), \n ); \n \n /// Creates order and subscribes to the result with parameters specified in [P2pOrderCreateRequest] \n /// \n /// Throws a [BaseAPIException] if API response contains an error \n static Stream createAndSubscribeRaw( \n P2pOrderCreateRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n _api.subscribe(request: request, comparePredicate: comparePredicate)!.map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is P2pOrderCreateReceive ? response : null; \n }, \n );", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_create_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_create_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_order_dispute_receive_methods.json b/lib/basic_api/generated/methods/p2p_order_dispute_receive_methods.json index 700b484b7a..7a11ad0cd9 100644 --- a/lib/basic_api/generated/methods/p2p_order_dispute_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_order_dispute_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Cancel a P2P order dispute. \n /// \n /// For parameters information refer to [P2pOrderDisputeRequest]. \n /// Throws an [P2POrderException] if API response contains an error. \n static Future disputeOrderRaw( \n P2pOrderDisputeRequest request, \n ) async { \n final P2pOrderDisputeReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Cancel a P2P order dispute. \n /// \n /// For parameters information refer to [P2pOrderDisputeRequest]. \n /// Throws an [P2POrderException] if API response contains an error. \n static Future disputeOrder( \n P2pOrderDisputeRequest request, \n ) async { \n final P2pOrderDisputeReceive response = await disputeOrderRaw(request); \n \n return P2pOrderDisputeResponse.fromJson(response.p2pOrderDispute); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Cancel a P2P order dispute. \n /// \n /// For parameters information refer to [P2pOrderDisputeRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future disputeOrderRaw( \n P2pOrderDisputeRequest request, \n ) async { \n final P2pOrderDisputeReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Cancel a P2P order dispute. \n /// \n /// For parameters information refer to [P2pOrderDisputeRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future disputeOrder( \n P2pOrderDisputeRequest request, \n ) async { \n final P2pOrderDisputeReceive response = await disputeOrderRaw(request); \n \n return P2pOrderDisputeResponse.fromJson(response.p2pOrderDispute); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_dispute_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_dispute_send.dart';\n\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_order_info_receive_methods.json b/lib/basic_api/generated/methods/p2p_order_info_receive_methods.json index 3f207b231c..0e10499db4 100644 --- a/lib/basic_api/generated/methods/p2p_order_info_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_order_info_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets order with parameters specified in [P2pOrderInfoRequest] \n /// \n /// Throws a [P2POrderException] if API response contains an error \n static Future fetchOrder( \n P2pOrderInfoRequest request) async { \n final P2pOrderInfoReceive response = await fetchOrderRaw(request); \n \n return P2pOrderInfoResponse.fromJson( \n response.p2pOrderInfo, response.subscription); \n } \n \n /// Gets order with parameters specified in [P2pOrderInfoRequest] \n /// \n /// Throws a [P2POrderException] if API response contains an error \n static Future fetchOrderRaw( \n P2pOrderInfoRequest request) async { \n final P2pOrderInfoReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Subscribes to this order \n Stream subscribe({ \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeOrder( \n P2pOrderInfoRequest(id: p2pOrderInfo?.id), \n comparePredicate: comparePredicate, \n ); \n \n /// Subscribes to this order \n Stream subscribeRaw({ \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeOrderRaw( \n P2pOrderInfoRequest(id: p2pOrderInfo?.id), \n comparePredicate: comparePredicate, \n ); \n \n /// Subscribes to order with parameters specified in [P2pOrderInfoRequest] \n /// \n /// Throws a [P2POrderException] if API response contains an error \n static Stream subscribeOrder( \n P2pOrderInfoRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeOrderRaw( \n request, \n comparePredicate: comparePredicate, \n ).map( \n (P2pOrderInfoReceive? response) => response == null \n ? null \n : P2pOrderInfoResponse.fromJson( \n response.p2pOrderInfo, \n response.subscription, \n ), \n ); \n \n /// Subscribes to order with parameters specified in [P2pOrderInfoRequest] \n /// \n /// Throws a [P2POrderException] if API response contains an error \n static Stream subscribeOrderRaw( \n P2pOrderInfoRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n _api \n .subscribe(request: request, comparePredicate: comparePredicate)! \n .map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is P2pOrderInfoReceive ? response : null; \n }, \n ); \n \n /// Unsubscribes from order subscription. \n /// \n /// Throws a [P2POrderException] if API response contains an error \n Future unsubscribeOrder() async { \n if (subscription == null) { \n return null; \n } \n \n final ForgetReceive response = \n await _api.unsubscribe(subscriptionId: subscription!.id); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return ForgetResponse.fromJson(response.forget); \n } \n \n /// Unsubscribes all order subscriptions (Subscriptions to a single order or list). \n /// \n /// Throws a [P2POrderException] if API response contains an error \n static Future unsubscribeAllOrder() async { \n final ForgetAllReceive response = \n await _api.unsubscribeAll(method: ForgetStreamType.p2pOrder); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return ForgetAllResponse.fromJson(response.forgetAll); \n } \n \n /// Cancels this order \n /// \n /// Returns an order with updated status if successful. \n /// Throws a [P2POrderException] if API response contains an error \n Future cancel() async { \n final P2pOrderCancelReceive response = await cancelRaw(); \n return P2pOrderCancelResponse.fromJson(response.p2pOrderCancel); \n } \n \n /// Cancels this order \n /// \n /// Returns an order with updated status if successful. \n /// Throws a [P2POrderException] if API response contains an error \n Future cancelRaw() async { \n final P2pOrderCancelReceive response = \n await _api.call(request: P2pOrderCancelRequest(id: p2pOrderInfo?.id)); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Confirms this order \n /// \n /// Returns an order with updated status if successful. \n /// Throws a [P2POrderException] if API response contains an error \n Future confirm() async { \n final P2pOrderConfirmReceive response = await confirmRaw(); \n \n return P2pOrderConfirmResponse.fromJson(response.p2pOrderConfirm); \n } \n \n /// Confirms this order \n /// \n /// Returns an order with updated status if successful. \n /// Throws a [P2POrderException] if API response contains an error \n Future confirmRaw() async { \n final P2pOrderConfirmReceive response = \n await _api.call(request: P2pOrderConfirmRequest(id: p2pOrderInfo?.id)); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets order with parameters specified in [P2pOrderInfoRequest] \n /// \n /// Throws a [BaseAPIException] if API response contains an error \n static Future fetchOrder( \n P2pOrderInfoRequest request) async { \n final P2pOrderInfoReceive response = await fetchOrderRaw(request); \n \n return P2pOrderInfoResponse.fromJson( \n response.p2pOrderInfo, response.subscription); \n } \n \n /// Gets order with parameters specified in [P2pOrderInfoRequest] \n /// \n /// Throws a [BaseAPIException] if API response contains an error \n static Future fetchOrderRaw( \n P2pOrderInfoRequest request) async { \n final P2pOrderInfoReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Subscribes to this order \n Stream subscribe({ \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeOrder( \n P2pOrderInfoRequest(id: p2pOrderInfo?.id), \n comparePredicate: comparePredicate, \n ); \n \n /// Subscribes to this order \n Stream subscribeRaw({ \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeOrderRaw( \n P2pOrderInfoRequest(id: p2pOrderInfo?.id), \n comparePredicate: comparePredicate, \n ); \n \n /// Subscribes to order with parameters specified in [P2pOrderInfoRequest] \n /// \n /// Throws a [BaseAPIException] if API response contains an error \n static Stream subscribeOrder( \n P2pOrderInfoRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeOrderRaw( \n request, \n comparePredicate: comparePredicate, \n ).map( \n (P2pOrderInfoReceive? response) => response == null \n ? null \n : P2pOrderInfoResponse.fromJson( \n response.p2pOrderInfo, \n response.subscription, \n ), \n ); \n \n /// Subscribes to order with parameters specified in [P2pOrderInfoRequest] \n /// \n /// Throws a [BaseAPIException] if API response contains an error \n static Stream subscribeOrderRaw( \n P2pOrderInfoRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n _api \n .subscribe(request: request, comparePredicate: comparePredicate)! \n .map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is P2pOrderInfoReceive ? response : null; \n }, \n ); \n \n /// Unsubscribes from order subscription. \n /// \n /// Throws a [BaseAPIException] if API response contains an error \n Future unsubscribeOrder() async { \n if (subscription == null) { \n return null; \n } \n \n final ForgetReceive response = \n await _api.unsubscribe(subscriptionId: subscription!.id); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return ForgetResponse.fromJson(response.forget); \n } \n \n /// Unsubscribes all order subscriptions (Subscriptions to a single order or list). \n /// \n /// Throws a [BaseAPIException] if API response contains an error \n static Future unsubscribeAllOrder() async { \n final ForgetAllReceive response = \n await _api.unsubscribeAll(method: ForgetStreamType.p2pOrder); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return ForgetAllResponse.fromJson(response.forgetAll); \n } \n \n /// Cancels this order \n /// \n /// Returns an order with updated status if successful. \n /// Throws a [BaseAPIException] if API response contains an error \n Future cancel() async { \n final P2pOrderCancelReceive response = await cancelRaw(); \n return P2pOrderCancelResponse.fromJson(response.p2pOrderCancel); \n } \n \n /// Cancels this order \n /// \n /// Returns an order with updated status if successful. \n /// Throws a [BaseAPIException] if API response contains an error \n Future cancelRaw() async { \n final P2pOrderCancelReceive response = \n await _api.call(request: P2pOrderCancelRequest(id: p2pOrderInfo?.id)); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Confirms this order \n /// \n /// Returns an order with updated status if successful. \n /// Throws a [BaseAPIException] if API response contains an error \n Future confirm() async { \n final P2pOrderConfirmReceive response = await confirmRaw(); \n \n return P2pOrderConfirmResponse.fromJson(response.p2pOrderConfirm); \n } \n \n /// Confirms this order \n /// \n /// Returns an order with updated status if successful. \n /// Throws a [BaseAPIException] if API response contains an error \n Future confirmRaw() async { \n final P2pOrderConfirmReceive response = \n await _api.call(request: P2pOrderConfirmRequest(id: p2pOrderInfo?.id)); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/p2p_order_cancel_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/p2p_order_confirm_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_cancel_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_cancel_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_confirm_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_confirm_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_info_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_info_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_order_list_receive_methods.json b/lib/basic_api/generated/methods/p2p_order_list_receive_methods.json index f15c62e2ab..72c9bb33f6 100644 --- a/lib/basic_api/generated/methods/p2p_order_list_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_order_list_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets the list of [P2POrder] with parameters specified in [P2pOrderListRequest] \n static Future fetchOrderList([ \n P2pOrderListRequest? request, \n ]) async { \n final P2pOrderListReceive response = \n await fetchOrderListRaw(request ?? const P2pOrderListRequest()); \n \n return P2pOrderListResponse.fromJson( \n response.p2pOrderList, response.subscription); \n } \n \n /// Gets the list of [P2POrder] with parameters specified in [P2pOrderListRequest] \n static Future fetchOrderListRaw([ \n P2pOrderListRequest? request, \n ]) async { \n final P2pOrderListReceive response = await _api.call( \n request: request ?? const P2pOrderListRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Subscribes to the list of [P2POrder] with parameters specified in [P2pOrderListRequest] \n static Stream subscribeOrderList({ \n P2pOrderListRequest? request, \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeOrderListRaw( \n request: request, \n comparePredicate: comparePredicate, \n ).map( \n (P2pOrderListReceive? response) => response == null \n ? null \n : P2pOrderListResponse.fromJson( \n response.p2pOrderList, \n response.subscription, \n ), \n ); \n \n /// Subscribes to the list of [P2POrder] with parameters specified in [P2pOrderListRequest] \n static Stream subscribeOrderListRaw({ \n P2pOrderListRequest? request, \n RequestCompareFunction? comparePredicate, \n }) => \n _api \n .subscribe( \n request: request ?? const P2pOrderListRequest(), \n comparePredicate: comparePredicate, \n )! \n .map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is P2pOrderListReceive ? response : null; \n }, \n ); \n \n /// Unsubscribes from order list subscription. \n /// \n /// Throws a [P2POrderException] if API response contains an error \n Future unsubscribeOrderList() async { \n if (subscription == null) { \n return null; \n } \n \n final ForgetReceive response = \n await _api.unsubscribe(subscriptionId: subscription!.id); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return ForgetResponse.fromJson(response.forget); \n } \n \n /// Unsubscribes from all order subscriptions (Subscriptions to a single order or list). \n /// \n /// Throws a [P2POrderException] if API response contains an error \n static Future unsubscribeAllOrder() => \n P2pOrderInfoResponse.unsubscribeAllOrder();", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets the list of [P2POrder] with parameters specified in [P2pOrderListRequest] \n static Future fetchOrderList([ \n P2pOrderListRequest? request, \n ]) async { \n final P2pOrderListReceive response = \n await fetchOrderListRaw(request ?? const P2pOrderListRequest()); \n \n return P2pOrderListResponse.fromJson( \n response.p2pOrderList, response.subscription); \n } \n \n /// Gets the list of [P2POrder] with parameters specified in [P2pOrderListRequest] \n static Future fetchOrderListRaw([ \n P2pOrderListRequest? request, \n ]) async { \n final P2pOrderListReceive response = await _api.call( \n request: request ?? const P2pOrderListRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Subscribes to the list of [P2POrder] with parameters specified in [P2pOrderListRequest] \n static Stream subscribeOrderList({ \n P2pOrderListRequest? request, \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeOrderListRaw( \n request: request, \n comparePredicate: comparePredicate, \n ).map( \n (P2pOrderListReceive? response) => response == null \n ? null \n : P2pOrderListResponse.fromJson( \n response.p2pOrderList, \n response.subscription, \n ), \n ); \n \n /// Subscribes to the list of [P2POrder] with parameters specified in [P2pOrderListRequest] \n static Stream subscribeOrderListRaw({ \n P2pOrderListRequest? request, \n RequestCompareFunction? comparePredicate, \n }) => \n _api \n .subscribe( \n request: request ?? const P2pOrderListRequest(), \n comparePredicate: comparePredicate, \n )! \n .map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is P2pOrderListReceive ? response : null; \n }, \n ); \n \n /// Unsubscribes from order list subscription. \n /// \n /// Throws a [BaseAPIException] if API response contains an error \n Future unsubscribeOrderList() async { \n if (subscription == null) { \n return null; \n } \n \n final ForgetReceive response = \n await _api.unsubscribe(subscriptionId: subscription!.id); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return ForgetResponse.fromJson(response.forget); \n } \n \n /// Unsubscribes from all order subscriptions (Subscriptions to a single order or list). \n /// \n /// Throws a [BaseAPIException] if API response contains an error \n static Future unsubscribeAllOrder() => \n P2pOrderInfoResponse.unsubscribeAllOrder();", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/p2p_order_info_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_list_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_list_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_order_review_receive_methods.json b/lib/basic_api/generated/methods/p2p_order_review_receive_methods.json index e29c2f7700..b8d4150601 100644 --- a/lib/basic_api/generated/methods/p2p_order_review_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_order_review_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Cancel a P2P order review. \n /// \n /// For parameters information refer to [P2pOrderReviewReceive]. \n /// Throws an [P2POrderException] if API response contains an error. \n static Future reviewOrderRaw( \n P2pOrderReviewRequest request, \n ) async { \n final P2pOrderReviewReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n P2POrderException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Cancel a P2P order review. \n /// \n /// For parameters information refer to [P2pOrderReviewReceive]. \n /// Throws an [P2POrderException] if API response contains an error. \n static Future reviewOrder( \n P2pOrderReviewRequest request, \n ) async { \n final P2pOrderReviewReceive response = await reviewOrderRaw(request); \n \n return P2pOrderReviewResponse.fromJson(response.p2pOrderReview); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Cancel a P2P order review. \n /// \n /// For parameters information refer to [P2pOrderReviewReceive]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future reviewOrderRaw( \n P2pOrderReviewRequest request, \n ) async { \n final P2pOrderReviewReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Cancel a P2P order review. \n /// \n /// For parameters information refer to [P2pOrderReviewReceive]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future reviewOrder( \n P2pOrderReviewRequest request, \n ) async { \n final P2pOrderReviewReceive response = await reviewOrderRaw(request); \n \n return P2pOrderReviewResponse.fromJson(response.p2pOrderReview); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_review_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_order_review_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/p2p_payment_methods_receive_methods.json b/lib/basic_api/generated/methods/p2p_payment_methods_receive_methods.json index bc1a072bf7..7a8d29a94f 100644 --- a/lib/basic_api/generated/methods/p2p_payment_methods_receive_methods.json +++ b/lib/basic_api/generated/methods/p2p_payment_methods_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// List all P2P payment methods.\n static Future fetch(\n P2pPaymentMethodsRequest request,\n ) async {\n final P2pPaymentMethodsReceive response = await fetchRaw(request);\n\n return P2pPaymentMethodsResponse.fromJson(response.p2pPaymentMethods);\n }\n\n /// Dispute a P2P order.\n static Future fetchRaw(\n P2pPaymentMethodsRequest request,\n ) async {\n final P2pPaymentMethodsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n P2POrderException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// List all P2P payment methods.\n static Future fetch(\n P2pPaymentMethodsRequest request,\n ) async {\n final P2pPaymentMethodsReceive response = await fetchRaw(request);\n\n return P2pPaymentMethodsResponse.fromJson(response.p2pPaymentMethods);\n }\n\n /// Dispute a P2P order.\n static Future fetchRaw(\n P2pPaymentMethodsRequest request,\n ) async {\n final P2pPaymentMethodsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response;\n }\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_payment_methods_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/p2p_payment_methods_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/payment_methods_receive_methods.json b/lib/basic_api/generated/methods/payment_methods_receive_methods.json index 5b2d80943c..4dcfb2e577 100644 --- a/lib/basic_api/generated/methods/payment_methods_receive_methods.json +++ b/lib/basic_api/generated/methods/payment_methods_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Get List of available payment methods for a given country.\n ///\n /// For parameters information refer to [PaymentMethodsRequest].\n /// Throws an [PaymentException] if API response contains an error\n static Future updateApplication(\n PaymentMethodsRequest request) async {\n final PaymentMethodsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n PaymentException(baseExceptionModel: baseExceptionModel),\n );\n\n return PaymentMethodsResponse.fromJson(response.paymentMethods);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Get List of available payment methods for a given country.\n ///\n /// For parameters information refer to [PaymentMethodsRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future updateApplication(\n PaymentMethodsRequest request) async {\n final PaymentMethodsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return PaymentMethodsResponse.fromJson(response.paymentMethods);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/payment_methods_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/payment_methods_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/paymentagent_list_receive_methods.json b/lib/basic_api/generated/methods/paymentagent_list_receive_methods.json index 766ad67d39..f5961026c8 100644 --- a/lib/basic_api/generated/methods/paymentagent_list_receive_methods.json +++ b/lib/basic_api/generated/methods/paymentagent_list_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Returns a list of Payment Agents for a given country for a given currency.\n ///\n /// For parameters information refer to [PaymentagentListRequest].\n /// Throws a [PaymentAgentException] if API response contains an error\n static Future fetch(\n PaymentagentListRequest request,\n ) async {\n final PaymentagentListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n PaymentAgentException(baseExceptionModel: baseExceptionModel),\n );\n\n return PaymentagentListResponse.fromJson(response.paymentagentList);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Returns a list of Payment Agents for a given country for a given currency.\n ///\n /// For parameters information refer to [PaymentagentListRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetch(\n PaymentagentListRequest request,\n ) async {\n final PaymentagentListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return PaymentagentListResponse.fromJson(response.paymentagentList);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/paymentagent_list_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/paymentagent_list_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/paymentagent_transfer_receive_methods.json b/lib/basic_api/generated/methods/paymentagent_transfer_receive_methods.json index 6e06444b27..9dff97eea9 100644 --- a/lib/basic_api/generated/methods/paymentagent_transfer_receive_methods.json +++ b/lib/basic_api/generated/methods/paymentagent_transfer_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": " static final BaseAPI _api = Injector()();\n\n /// Payment Agent Transfer.\n ///\n /// This call is available only to accounts that are approved payment agents.\n /// For parameters information refer to [PaymentagentTransferRequest].\n /// Throws a [PaymentAgentException] if API response contains an error\n static Future transfer(\n PaymentagentTransferRequest request,\n ) async {\n final PaymentagentTransferReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n PaymentAgentException(baseExceptionModel: baseExceptionModel),\n );\n\n return PaymentagentTransferResponse.fromJson(\n response.paymentagentTransfer,\n response.clientToFullName,\n response.clientToLoginid,\n response.transactionId);\n }", + "methods": " static final BaseAPI _api = Injector()();\n\n /// Payment Agent Transfer.\n ///\n /// This call is available only to accounts that are approved payment agents.\n /// For parameters information refer to [PaymentagentTransferRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future transfer(\n PaymentagentTransferRequest request,\n ) async {\n final PaymentagentTransferReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return PaymentagentTransferResponse.fromJson(\n response.paymentagentTransfer,\n response.clientToFullName,\n response.clientToLoginid,\n response.transactionId);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/paymentagent_transfer_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/paymentagent_transfer_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/paymentagent_withdraw_receive_methods.json b/lib/basic_api/generated/methods/paymentagent_withdraw_receive_methods.json index ffd735469a..179aae739a 100644 --- a/lib/basic_api/generated/methods/paymentagent_withdraw_receive_methods.json +++ b/lib/basic_api/generated/methods/paymentagent_withdraw_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Initiates a withdrawal to an approved payment agent.\n ///\n /// For parameters information refer to [PaymentagentWithdrawRequest].\n /// Throws a [PaymentAgentException] if API response contains an error\n static Future withdraw(\n PaymentagentWithdrawRequest request,\n ) async {\n final PaymentagentWithdrawReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n PaymentAgentException(baseExceptionModel: baseExceptionModel),\n );\n\n return PaymentagentWithdrawResponse.fromJson(response.paymentagentWithdraw,\n response.paymentagentName, response.transactionId);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Initiates a withdrawal to an approved payment agent.\n ///\n /// For parameters information refer to [PaymentagentWithdrawRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future withdraw(\n PaymentagentWithdrawRequest request,\n ) async {\n final PaymentagentWithdrawReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return PaymentagentWithdrawResponse.fromJson(response.paymentagentWithdraw,\n response.paymentagentName, response.transactionId);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/paymentagent_withdraw_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/paymentagent_withdraw_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/payout_currencies_receive_methods.json b/lib/basic_api/generated/methods/payout_currencies_receive_methods.json index 62e48234d2..49182aad7f 100644 --- a/lib/basic_api/generated/methods/payout_currencies_receive_methods.json +++ b/lib/basic_api/generated/methods/payout_currencies_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves a list of available option payout currencies.\n ///\n /// If a user is logged in, only the currencies available for the account will be returned.\n /// Throws a [PayoutCurrencyException] if API response contains a error\n static Future fetchPayoutCurrencies([\n PayoutCurrenciesRequest? request,\n ]) async {\n final PayoutCurrenciesReceive response = await _api.call(\n request: request ?? const PayoutCurrenciesRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n PayoutCurrencyException(baseExceptionModel: baseExceptionModel),\n );\n\n return PayoutCurrenciesResponse.fromJson(response.payoutCurrencies);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves a list of available option payout currencies.\n ///\n /// If a user is logged in, only the currencies available for the account will be returned.\n /// Throws a [BaseAPIException] if API response contains a error\n static Future fetchPayoutCurrencies([\n PayoutCurrenciesRequest? request,\n ]) async {\n final PayoutCurrenciesReceive response = await _api.call(\n request: request ?? const PayoutCurrenciesRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return PayoutCurrenciesResponse.fromJson(response.payoutCurrencies);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/payout_currencies_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/payout_currencies_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/ping_receive_methods.json b/lib/basic_api/generated/methods/ping_receive_methods.json index 5d224f797e..eb588e24af 100644 --- a/lib/basic_api/generated/methods/ping_receive_methods.json +++ b/lib/basic_api/generated/methods/ping_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Requests the ping request to the server. \n /// \n /// Mostly used to test the connection or to keep it alive. \n /// Throws a [PingException] if API response contains an error. \n static Future pingMethodRaw([PingRequest? request]) async { \n final PingReceive response = await _api.call( \n request: request ?? const PingRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n PingException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Requests the ping request to the server. \n /// \n /// Mostly used to test the connection or to keep it alive. \n /// Throws a [PingException] if API response contains an error. \n static Future pingMethod([PingRequest? request]) async { \n final PingReceive response = await pingMethodRaw(request); \n \n return PingResponse.fromJson(response.ping); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Requests the ping request to the server. \n /// \n /// Mostly used to test the connection or to keep it alive. \n /// Throws a [BaseAPIException] if API response contains an error. \n static Future pingMethodRaw([PingRequest? request]) async { \n final PingReceive response = await _api.call( \n request: request ?? const PingRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Requests the ping request to the server. \n /// \n /// Mostly used to test the connection or to keep it alive. \n /// Throws a [BaseAPIException] if API response contains an error. \n static Future pingMethod([PingRequest? request]) async { \n final PingReceive response = await pingMethodRaw(request); \n \n return PingResponse.fromJson(response.ping); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/ping_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/ping_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/portfolio_receive_methods.json b/lib/basic_api/generated/methods/portfolio_receive_methods.json index 8dde2b3e3e..a7ad0b98a5 100644 --- a/lib/basic_api/generated/methods/portfolio_receive_methods.json +++ b/lib/basic_api/generated/methods/portfolio_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the portfolio fo logged-in account\n ///\n /// Throws a [PortfolioException] if API response contains an error\n static Future fetchPortfolio(PortfolioRequest request) async {\n final PortfolioReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n PortfolioException(baseExceptionModel: baseExceptionModel),\n );\n\n return PortfolioResponse.fromJson(response.portfolio);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the portfolio fo logged-in account\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchPortfolio(PortfolioRequest request) async {\n final PortfolioReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return PortfolioResponse.fromJson(response.portfolio);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/portfolio_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/portfolio_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/profit_table_receive_methods.json b/lib/basic_api/generated/methods/profit_table_receive_methods.json index d55634ab78..e6272cee20 100644 --- a/lib/basic_api/generated/methods/profit_table_receive_methods.json +++ b/lib/basic_api/generated/methods/profit_table_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves a summary of account Profit Table, according to given search criteria.\n ///\n /// For parameters information refer to [ProfitTableRequest].\n /// Throws a [ProfitTableException] if API response contains an error\n static Future fetch(ProfitTableRequest request) async {\n final ProfitTableReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ProfitTableException(baseExceptionModel: baseExceptionModel),\n );\n\n return ProfitTableResponse.fromJson(response.profitTable);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves a summary of account Profit Table, according to given search criteria.\n ///\n /// For parameters information refer to [ProfitTableRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetch(ProfitTableRequest request) async {\n final ProfitTableReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ProfitTableResponse.fromJson(response.profitTable);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/profit_table_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/profit_table_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';" } diff --git a/lib/basic_api/generated/methods/proposal_open_contract_receive_methods.json b/lib/basic_api/generated/methods/proposal_open_contract_receive_methods.json index 616dccef5b..e1233d9798 100644 --- a/lib/basic_api/generated/methods/proposal_open_contract_receive_methods.json +++ b/lib/basic_api/generated/methods/proposal_open_contract_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the current spot of the the bought contract specified in [ProposalOpenContractRequest]\n ///\n /// Throws a [ContractOperationException] if API response contains any error\n static Future fetchContractState(\n ProposalOpenContractRequest request,\n ) async {\n final ProposalOpenContractReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return ProposalOpenContractResponse.fromJson(\n response.proposalOpenContract, response.subscription);\n }\n\n /// Subscribes to the bought contract state specified in [ProposalOpenContractRequest]\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n static Stream subscribeContractState(\n ProposalOpenContractRequest request, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: request, comparePredicate: comparePredicate)!\n .map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(\n baseExceptionModel: baseExceptionModel),\n );\n\n return response is ProposalOpenContractReceive\n ? ProposalOpenContractResponse.fromJson(\n response.proposalOpenContract,\n response.subscription,\n )\n : null;\n },\n );\n\n /// Unsubscribes from open contract subscription.\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n Future unsubscribeOpenContract() async {\n if (subscription == null) {\n return null;\n }\n\n final ForgetReceive response =\n await _api.unsubscribe(subscriptionId: subscription!.id);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }\n\n /// Unsubscribes all open contract subscriptions.\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n static Future unsubscribeAllOpenContract() async {\n final ForgetAllReceive response = await _api.unsubscribeAll(\n method: ForgetStreamType.proposalOpenContract,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }\n\n /// Sells this contract.\n ///\n /// [price] is the Minimum price at which to sell the contract,\n /// Default be 0 for 'sell at market'.\n /// Throws a [ContractOperationException] if API response contains an error\n static Future sell(\n {required int contractId, double price = 0}) =>\n SellResponse.sellContract(SellRequest(sell: contractId, price: price));\n\n /// Cancels this contract\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n static Future cancel(int contractId) =>\n CancelResponse.cancelContract(CancelRequest(cancel: contractId));\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the current spot of the the bought contract specified in [ProposalOpenContractRequest]\n ///\n /// Throws a [BaseAPIException] if API response contains any error\n static Future fetchContractState(\n ProposalOpenContractRequest request,\n ) async {\n final ProposalOpenContractReceive response = await _api.call(\n request: request,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ProposalOpenContractResponse.fromJson(\n response.proposalOpenContract, response.subscription);\n }\n\n /// Subscribes to the bought contract state specified in [ProposalOpenContractRequest]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Stream subscribeContractState(\n ProposalOpenContractRequest request, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: request, comparePredicate: comparePredicate)!\n .map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(\n baseExceptionModel: baseExceptionModel),\n );\n\n return response is ProposalOpenContractReceive\n ? ProposalOpenContractResponse.fromJson(\n response.proposalOpenContract,\n response.subscription,\n )\n : null;\n },\n );\n\n /// Unsubscribes from open contract subscription.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future unsubscribeOpenContract() async {\n if (subscription == null) {\n return null;\n }\n\n final ForgetReceive response =\n await _api.unsubscribe(subscriptionId: subscription!.id);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }\n\n /// Unsubscribes all open contract subscriptions.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future unsubscribeAllOpenContract() async {\n final ForgetAllReceive response = await _api.unsubscribeAll(\n method: ForgetStreamType.proposalOpenContract,\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }\n\n /// Sells this contract.\n ///\n /// [price] is the Minimum price at which to sell the contract,\n /// Default be 0 for 'sell at market'.\n /// Throws a [BaseAPIException] if API response contains an error\n static Future sell(\n {required int contractId, double price = 0}) =>\n SellResponse.sellContract(SellRequest(sell: contractId, price: price));\n\n /// Cancels this contract\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future cancel(int contractId) =>\n CancelResponse.cancelContract(CancelRequest(cancel: contractId));\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/cancel_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/sell_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/cancel_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/proposal_open_contract_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/proposal_open_contract_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/sell_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';" } diff --git a/lib/basic_api/generated/methods/proposal_receive_methods.json b/lib/basic_api/generated/methods/proposal_receive_methods.json index d5b8582ec9..1e05eb285e 100644 --- a/lib/basic_api/generated/methods/proposal_receive_methods.json +++ b/lib/basic_api/generated/methods/proposal_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": " static final BaseAPI _api = Injector()();\n\n /// Gets the price proposal for contract\n ///\n /// For parameters information refer to [ProposalRequest]\n /// Throws a [ContractOperationException] if API response contains an error\n static Future fetchPriceForContract(\n ProposalRequest request,\n ) async {\n final ProposalReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return ProposalResponse.fromJson(response.proposal, response.subscription);\n }\n\n /// Gets the price proposal for contract.\n ///\n /// For parameters information refer to [ProposalRequest]\n /// Throws a [ContractOperationException] if API response contains an error\n static Stream subscribePriceForContract(\n ProposalRequest request, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: request, comparePredicate: comparePredicate)!\n .map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(\n baseExceptionModel: baseExceptionModel),\n );\n\n return response is ProposalReceive\n ? ProposalResponse.fromJson(\n response.proposal,\n response.subscription,\n )\n : null;\n },\n );\n\n /// Unsubscribes from price proposal subscription.\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n Future unsubscribeProposal() async {\n if (subscription == null) {\n return null;\n }\n\n final ForgetReceive response =\n await _api.unsubscribe(subscriptionId: subscription!.id);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }\n\n /// Unsubscribes all proposal subscriptions.\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n static Future unsubscribeAllProposal() async {\n final ForgetAllReceive response =\n await _api.unsubscribeAll(method: ForgetStreamType.proposal);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }\n\n /// Buys this proposal contract with [price] specified.\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n Future buy({double? price}) => BuyResponse.buyMethod(BuyRequest(\n buy: proposal?.id,\n price: price ?? proposal?.askPrice,\n ));\n\n /// Buys this proposal contract with [price] specified and subscribes to it.\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n Stream buyAndSubscribe({double? price}) =>\n BuyResponse.buyAndSubscribe(BuyRequest(\n buy: proposal?.id,\n price: price ?? proposal?.askPrice,\n ));", + "methods": " static final BaseAPI _api = Injector()();\n\n /// Gets the price proposal for contract\n ///\n /// For parameters information refer to [ProposalRequest]\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchPriceForContract(\n ProposalRequest request,\n ) async {\n final ProposalReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ProposalResponse.fromJson(response.proposal, response.subscription);\n }\n\n /// Gets the price proposal for contract.\n ///\n /// For parameters information refer to [ProposalRequest]\n /// Throws a [BaseAPIException] if API response contains an error\n static Stream subscribePriceForContract(\n ProposalRequest request, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: request, comparePredicate: comparePredicate)!\n .map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(\n baseExceptionModel: baseExceptionModel),\n );\n\n return response is ProposalReceive\n ? ProposalResponse.fromJson(\n response.proposal,\n response.subscription,\n )\n : null;\n },\n );\n\n /// Unsubscribes from price proposal subscription.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future unsubscribeProposal() async {\n if (subscription == null) {\n return null;\n }\n\n final ForgetReceive response =\n await _api.unsubscribe(subscriptionId: subscription!.id);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }\n\n /// Unsubscribes all proposal subscriptions.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future unsubscribeAllProposal() async {\n final ForgetAllReceive response =\n await _api.unsubscribeAll(method: ForgetStreamType.proposal);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }\n\n /// Buys this proposal contract with [price] specified.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future buy({double? price}) => BuyResponse.buyMethod(BuyRequest(\n buy: proposal?.id,\n price: price ?? proposal?.askPrice,\n ));\n\n /// Buys this proposal contract with [price] specified and subscribes to it.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Stream buyAndSubscribe({double? price}) =>\n BuyResponse.buyAndSubscribe(BuyRequest(\n buy: proposal?.id,\n price: price ?? proposal?.askPrice,\n ));", "imports": "import 'package:flutter_deriv_api/api/exceptions/contract_operations_exception.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/buy_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/proposal_open_contract_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/buy_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/proposal_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/proposal_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/reality_check_receive_methods.json b/lib/basic_api/generated/methods/reality_check_receive_methods.json index 47ca76c459..2ac2eb3828 100644 --- a/lib/basic_api/generated/methods/reality_check_receive_methods.json +++ b/lib/basic_api/generated/methods/reality_check_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves summary of client's trades and account for the reality check facility.\n ///\n /// A `reality check` means a display of time elapsed since the session began, and associated client profit/loss.\n /// The reality check facility is a regulatory requirement for certain landing companies.\n /// For parameters information refer to [RealityCheckRequest].\n /// Throws a [RealityCheckException] if API response contains an error\n static Future check([\n RealityCheckRequest? request,\n ]) async {\n final RealityCheckReceive response = await _api.call(\n request: request ?? const RealityCheckRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n RealityCheckException(baseExceptionModel: baseExceptionModel),\n );\n\n return RealityCheckResponse.fromJson(response.realityCheck);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves summary of client's trades and account for the reality check facility.\n ///\n /// A `reality check` means a display of time elapsed since the session began, and associated client profit/loss.\n /// The reality check facility is a regulatory requirement for certain landing companies.\n /// For parameters information refer to [RealityCheckRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future check([\n RealityCheckRequest? request,\n ]) async {\n final RealityCheckReceive response = await _api.call(\n request: request ?? const RealityCheckRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return RealityCheckResponse.fromJson(response.realityCheck);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/reality_check_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/reality_check_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/reset_password_receive_methods.json b/lib/basic_api/generated/methods/reset_password_receive_methods.json index 590244ce7b..a36e8a1dc9 100644 --- a/lib/basic_api/generated/methods/reset_password_receive_methods.json +++ b/lib/basic_api/generated/methods/reset_password_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Reset the password of User.\n static Future reset(\n ResetPasswordRequest request,\n ) async {\n final ResetPasswordReceive? response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n UserException(baseExceptionModel: baseExceptionModel),\n );\n\n return ResetPasswordResponse.fromJson(response?.resetPassword);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Reset the password of User.\n static Future reset(\n ResetPasswordRequest request,\n ) async {\n final ResetPasswordReceive? response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ResetPasswordResponse.fromJson(response?.resetPassword);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/reset_password_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/reset_password_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/residence_list_receive_methods.json b/lib/basic_api/generated/methods/residence_list_receive_methods.json index 67fae43764..a9a7757c19 100644 --- a/lib/basic_api/generated/methods/residence_list_receive_methods.json +++ b/lib/basic_api/generated/methods/residence_list_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets Residence list for the given [ResidenceListRequest]\n ///\n /// Throws a [ResidenceException] if API response contains an error\n static Future fetchResidenceList([\n ResidenceListRequest? request,\n ]) async {\n final ResidenceListReceive response = await _api.call(\n request: request ?? const ResidenceListRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ResidenceException(baseExceptionModel: baseExceptionModel),\n );\n\n return ResidenceListResponse.fromJson(response.residenceList);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets Residence list for the given [ResidenceListRequest]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchResidenceList([\n ResidenceListRequest? request,\n ]) async {\n final ResidenceListReceive response = await _api.call(\n request: request ?? const ResidenceListRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ResidenceListResponse.fromJson(response.residenceList);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/residence_list_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/residence_list_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/revoke_oauth_app_receive_methods.json b/lib/basic_api/generated/methods/revoke_oauth_app_receive_methods.json index ae92c49d81..4d21132107 100644 --- a/lib/basic_api/generated/methods/revoke_oauth_app_receive_methods.json +++ b/lib/basic_api/generated/methods/revoke_oauth_app_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Revokes access of a particular app.\n ///\n /// For parameters information refer to [RevokeOauthAppRequest].\n /// Throws an [AppException] if API response contains an error\n static Future revokeOauthApplication(\n RevokeOauthAppRequest request,\n ) async {\n final RevokeOauthAppReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AppException(baseExceptionModel: baseExceptionModel),\n );\n\n return RevokeOauthAppResponse.fromJson(response.revokeOauthApp);\n }\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Revokes access of a particular app.\n ///\n /// For parameters information refer to [RevokeOauthAppRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future revokeOauthApplication(\n RevokeOauthAppRequest request,\n ) async {\n final RevokeOauthAppReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return RevokeOauthAppResponse.fromJson(response.revokeOauthApp);\n }\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/revoke_oauth_app_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/revoke_oauth_app_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/sell_receive_methods.json b/lib/basic_api/generated/methods/sell_receive_methods.json index 6438523295..423c605eba 100644 --- a/lib/basic_api/generated/methods/sell_receive_methods.json +++ b/lib/basic_api/generated/methods/sell_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Sells a contract with parameters specified in [SellRequest].\n ///\n /// Throws a [ContractOperationException] if API response contains an error\n static Future sellContract(SellRequest request) async {\n final SellReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return SellResponse.fromJson(response.sell);\n }\n\n /// tries to sell any expired contracts and returns the number of sold contracts as [SellExpiredContractModel].\n ///\n /// Throws [ContractOperationException] if API response contains an error\n static Future sellExpiredContracts([\n SellExpiredRequest? request,\n ]) async {\n final SellExpiredReceive response = await _api.call(\n request: request ?? const SellExpiredRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n ContractOperationException(baseExceptionModel: baseExceptionModel),\n );\n\n return SellExpiredResponse.fromJson(response.sellExpired);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Sells a contract with parameters specified in [SellRequest].\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future sellContract(SellRequest request) async {\n final SellReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return SellResponse.fromJson(response.sell);\n }\n\n /// tries to sell any expired contracts and returns the number of sold contracts as [SellExpiredContractModel].\n ///\n /// Throws [BaseAPIException] if API response contains an error\n static Future sellExpiredContracts([\n SellExpiredRequest? request,\n ]) async {\n final SellExpiredReceive response = await _api.call(\n request: request ?? const SellExpiredRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return SellExpiredResponse.fromJson(response.sellExpired);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/response/sell_expired_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/sell_expired_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/sell_expired_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/sell_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/sell_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/service_token_receive_methods.json b/lib/basic_api/generated/methods/service_token_receive_methods.json index 03f5b226c9..21349e906c 100644 --- a/lib/basic_api/generated/methods/service_token_receive_methods.json +++ b/lib/basic_api/generated/methods/service_token_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Service Token. \n /// \n /// Retrieves the authorization token for the specified service. \n /// For parameters information refer to [ServiceTokenRequest]. \n /// Throws a [APITokenException] if API response contains an error. \n static Future getServiceTokenRaw( \n ServiceTokenRequest request, \n ) async { \n final ServiceTokenReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n APITokenException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Service Token. \n /// \n /// Retrieves the authorization token for the specified service. \n /// For parameters information refer to [ServiceTokenRequest]. \n /// Throws a [APITokenException] if API response contains an error. \n static Future getServiceToken( \n ServiceTokenRequest request, \n ) async { \n final ServiceTokenReceive response = await getServiceTokenRaw(request); \n \n return ServiceTokenResponse.fromJson(response.serviceToken); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Service Token. \n /// \n /// Retrieves the authorization token for the specified service. \n /// For parameters information refer to [ServiceTokenRequest]. \n /// Throws a [BaseAPIException] if API response contains an error. \n static Future getServiceTokenRaw( \n ServiceTokenRequest request, \n ) async { \n final ServiceTokenReceive response = await _api.call(request: request); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Service Token. \n /// \n /// Retrieves the authorization token for the specified service. \n /// For parameters information refer to [ServiceTokenRequest]. \n /// Throws a [BaseAPIException] if API response contains an error. \n static Future getServiceToken( \n ServiceTokenRequest request, \n ) async { \n final ServiceTokenReceive response = await getServiceTokenRaw(request); \n \n return ServiceTokenResponse.fromJson(response.serviceToken); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/api.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/trading_times_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/trading_times_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/set_account_currency_receive_methods.json b/lib/basic_api/generated/methods/set_account_currency_receive_methods.json index ed9b894863..ed8aa437f2 100644 --- a/lib/basic_api/generated/methods/set_account_currency_receive_methods.json +++ b/lib/basic_api/generated/methods/set_account_currency_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Sets the currency of the account, this will be default currency for your account i.e currency for trading, deposit.\n ///\n /// Please note that account currency can only be set once, and then can never be changed.\n /// For parameters information refer to [SetAccountCurrencyRequest].\n /// Throws an [AccountCurrencyException] if API response contains an error\n static Future setCurrency(\n SetAccountCurrencyRequest request,\n ) async {\n final SetAccountCurrencyReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AccountCurrencyException(baseExceptionModel: baseExceptionModel),\n );\n\n return SetAccountCurrencyResponse.fromJson(response.setAccountCurrency);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Sets the currency of the account, this will be default currency for your account i.e currency for trading, deposit.\n ///\n /// Please note that account currency can only be set once, and then can never be changed.\n /// For parameters information refer to [SetAccountCurrencyRequest].\n /// Throws an [BaseAPIException] if API response contains an error\n static Future setCurrency(\n SetAccountCurrencyRequest request,\n ) async {\n final SetAccountCurrencyReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return SetAccountCurrencyResponse.fromJson(response.setAccountCurrency);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_account_currency_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_account_currency_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/set_financial_assessment_receive_methods.json b/lib/basic_api/generated/methods/set_financial_assessment_receive_methods.json index 7cf299c229..a2322207a9 100644 --- a/lib/basic_api/generated/methods/set_financial_assessment_receive_methods.json +++ b/lib/basic_api/generated/methods/set_financial_assessment_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Sets the financial assessment details based on the client's answers to\n /// analyze whether they possess the experience and knowledge to\n /// understand the risks involved with binary options trading.\n ///\n /// For parameters information refer to [SetFinancialAssessmentRequest].\n /// Throws a [FinancialAssessmentException] if API response contains an error\n static Future setAssessment(\n SetFinancialAssessmentRequest request,\n ) async {\n final SetFinancialAssessmentReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n FinancialAssessmentException(baseExceptionModel: baseExceptionModel),\n );\n\n return SetFinancialAssessmentResponse.fromJson(\n response.setFinancialAssessment);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Sets the financial assessment details based on the client's answers to\n /// analyze whether they possess the experience and knowledge to\n /// understand the risks involved with binary options trading.\n ///\n /// For parameters information refer to [SetFinancialAssessmentRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future setAssessment(\n SetFinancialAssessmentRequest request,\n ) async {\n final SetFinancialAssessmentReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return SetFinancialAssessmentResponse.fromJson(\n response.setFinancialAssessment);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_financial_assessment_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_financial_assessment_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/set_self_exclusion_receive_methods.json b/lib/basic_api/generated/methods/set_self_exclusion_receive_methods.json index cf429427d5..ccc56156df 100644 --- a/lib/basic_api/generated/methods/set_self_exclusion_receive_methods.json +++ b/lib/basic_api/generated/methods/set_self_exclusion_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": " static final BaseAPI _api = Injector()();\n\n /// Sets Self-Exclusion (this call should be used in conjunction with [fetchSelfExclusion])\n ///\n /// For parameters information refer to [SetSelfExclusionRequest].\n /// Throws a [SelfExclusionException] if API response contains an error\n static Future setSelfExclusionMethod(\n SetSelfExclusionRequest request) async {\n final SetSelfExclusionReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n SelfExclusionException(baseExceptionModel: baseExceptionModel),\n );\n\n return SetSelfExclusionResponse.fromJson(response.setSelfExclusion);\n }", + "methods": " static final BaseAPI _api = Injector()();\n\n /// Sets Self-Exclusion (this call should be used in conjunction with [fetchSelfExclusion])\n ///\n /// For parameters information refer to [SetSelfExclusionRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future setSelfExclusionMethod(\n SetSelfExclusionRequest request) async {\n final SetSelfExclusionReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return SetSelfExclusionResponse.fromJson(response.setSelfExclusion);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_self_exclusion_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_self_exclusion_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/set_settings_receive_methods.json b/lib/basic_api/generated/methods/set_settings_receive_methods.json index c59b92b786..d02366eda3 100644 --- a/lib/basic_api/generated/methods/set_settings_receive_methods.json +++ b/lib/basic_api/generated/methods/set_settings_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": " static final BaseAPI _api = Injector()();\n\n /// Changes the user's settings with parameters specified as [SetSettingsRequest]\n ///\n /// Throws an [AccountSettingsException] if API response contains an error\n static Future changeAccountSetting(\n SetSettingsRequest request,\n ) async {\n final SetSettingsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n AccountSettingsException(baseExceptionModel: baseExceptionModel),\n );\n\n return SetSettingsResponse(setSettings: response.setSettings ?? 0);\n }", + "methods": " static final BaseAPI _api = Injector()();\n\n /// Changes the user's settings with parameters specified as [SetSettingsRequest]\n ///\n /// Throws an [BaseAPIException] if API response contains an error\n static Future changeAccountSetting(\n SetSettingsRequest request,\n ) async {\n final SetSettingsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return SetSettingsResponse(setSettings: response.setSettings ?? 0);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_settings_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/set_settings_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/statement_receive_methods.json b/lib/basic_api/generated/methods/statement_receive_methods.json index 9609d1c7db..0f2d283459 100644 --- a/lib/basic_api/generated/methods/statement_receive_methods.json +++ b/lib/basic_api/generated/methods/statement_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves a summary of account transactions, according to given search criteria.\n ///\n /// For parameters information refer to [StatementRequest].\n /// Throws a [StatementException] if API response contains an error\n static Future fetch(StatementRequest request) async {\n final StatementReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n StatementException(baseExceptionModel: baseExceptionModel),\n );\n\n return StatementResponse.fromJson(response.statement);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves a summary of account transactions, according to given search criteria.\n ///\n /// For parameters information refer to [StatementRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetch(StatementRequest request) async {\n final StatementReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return StatementResponse.fromJson(response.statement);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/statement_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/statement_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/states_list_receive_methods.json b/lib/basic_api/generated/methods/states_list_receive_methods.json index 5e6e4eec2c..ed022e9882 100644 --- a/lib/basic_api/generated/methods/states_list_receive_methods.json +++ b/lib/basic_api/generated/methods/states_list_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the list of states for the given [StatesListRequest]\n ///\n /// Throws a [StateException] if API response contains an error\n static Future fetchStatesList(\n StatesListRequest request) async {\n final StatesListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n StateException(baseExceptionModel: baseExceptionModel),\n );\n\n return StatesListResponse.fromJson(response.statesList);\n }\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the list of states for the given [StatesListRequest]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchStatesList(\n StatesListRequest request) async {\n final StatesListReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return StatesListResponse.fromJson(response.statesList);\n }\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/states_list_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/states_list_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/ticks_history_receive_methods.json b/lib/basic_api/generated/methods/ticks_history_receive_methods.json index 2152377889..a75cd72a8a 100644 --- a/lib/basic_api/generated/methods/ticks_history_receive_methods.json +++ b/lib/basic_api/generated/methods/ticks_history_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the [TickHistory] for the given [symbol] in [request]\n ///\n /// Throws a [TickException] if API response contains an error\n static Future fetchTickHistory(\n TicksHistoryRequest request,\n ) async {\n final TicksHistoryReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TickException(baseExceptionModel: baseExceptionModel),\n );\n\n return TicksHistoryResponse.fromJson(response.candles, response.history,\n response.pipSize, response.subscription);\n }\n\n /// Gets ticks history and its stream\n ///\n /// Throws [TickException] if API response contains an error\n static Future fetchTicksAndSubscribe(\n TicksHistoryRequest request, {\n RequestCompareFunction? comparePredicate,\n bool subscribe = true,\n }) async {\n if (subscribe) {\n final Stream? responseStream =\n _api.subscribe(request: request, comparePredicate: comparePredicate);\n final Response? firstResponse = await responseStream?.first;\n\n checkException(\n response: firstResponse,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TickException(baseExceptionModel: baseExceptionModel),\n );\n if (firstResponse is TicksHistoryReceive) {\n return TickHistorySubscription(\n tickHistory: TicksHistoryResponse.fromJson(\n firstResponse.candles,\n firstResponse.history,\n firstResponse.pipSize,\n firstResponse.subscription),\n tickStream: responseStream?.map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TickException(baseExceptionModel: baseExceptionModel),\n );\n\n return response is TicksReceive\n ? Tick.fromJson(\n response.tick!,\n subscriptionJson: response.subscription,\n )\n : response is OHLCResponse\n ? OHLC.fromJson(\n response.ohlc!,\n subscriptionJson: response.subscription,\n )\n : null;\n },\n ),\n );\n }\n return null;\n } else {\n return TickHistorySubscription(\n tickHistory: await fetchTickHistory(request),\n );\n }\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Gets the [TickHistory] for the given [symbol] in [request]\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchTickHistory(\n TicksHistoryRequest request,\n ) async {\n final TicksHistoryReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TicksHistoryResponse.fromJson(response.candles, response.history,\n response.pipSize, response.subscription);\n }\n\n /// Gets ticks history and its stream\n ///\n /// Throws [BaseAPIException] if API response contains an error\n static Future fetchTicksAndSubscribe(\n TicksHistoryRequest request, {\n RequestCompareFunction? comparePredicate,\n bool subscribe = true,\n }) async {\n if (subscribe) {\n final Stream? responseStream =\n _api.subscribe(request: request, comparePredicate: comparePredicate);\n final Response? firstResponse = await responseStream?.first;\n\n checkException(\n response: firstResponse,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n if (firstResponse is TicksHistoryReceive) {\n return TickHistorySubscription(\n tickHistory: TicksHistoryResponse.fromJson(\n firstResponse.candles,\n firstResponse.history,\n firstResponse.pipSize,\n firstResponse.subscription),\n tickStream: responseStream?.map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response is TicksReceive\n ? Tick.fromJson(\n response.tick!,\n subscriptionJson: response.subscription,\n )\n : response is OHLCResponse\n ? OHLC.fromJson(\n response.ohlc!,\n subscriptionJson: response.subscription,\n )\n : null;\n },\n ),\n );\n }\n return null;\n } else {\n return TickHistorySubscription(\n tickHistory: await fetchTickHistory(request),\n );\n }\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/manually/ohlc_response.dart';\nimport 'package:flutter_deriv_api/api/manually/ohlc_response_result.dart';\nimport 'package:flutter_deriv_api/api/manually/tick.dart';\nimport 'package:flutter_deriv_api/api/manually/tick_base.dart';\nimport 'package:flutter_deriv_api/api/manually/tick_history_subscription.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/ticks_history_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/ticks_history_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/ticks_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/ticks_receive_methods.json b/lib/basic_api/generated/methods/ticks_receive_methods.json index a987bb1b07..20fe0da606 100644 --- a/lib/basic_api/generated/methods/ticks_receive_methods.json +++ b/lib/basic_api/generated/methods/ticks_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Subscribes to a tick for given [TickRequest]\n ///\n /// Throws [TickException] if API response contains an error\n static Stream subscribeTick(\n TicksRequest tickRequest, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: tickRequest, comparePredicate: comparePredicate)!\n .map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TickException(baseExceptionModel: baseExceptionModel),\n );\n\n return response is TicksReceive\n ? TicksResponse.fromJson(\n response.tick,\n response.subscription,\n )\n : null;\n },\n );\n\n /// Unsubscribes all ticks.\n ///\n /// Throws a [TickException] if API response contains an error\n static Future unsubscribeAllTicks() async {\n final ForgetAllReceive response =\n await _api.unsubscribeAll(method: ForgetStreamType.ticks);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TickException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Subscribes to a tick for given [TickRequest]\n ///\n /// Throws [BaseAPIException] if API response contains an error\n static Stream subscribeTick(\n TicksRequest tickRequest, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: tickRequest, comparePredicate: comparePredicate)!\n .map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response is TicksReceive\n ? TicksResponse.fromJson(\n response.tick,\n response.subscription,\n )\n : null;\n },\n );\n\n /// Unsubscribes all ticks.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future unsubscribeAllTicks() async {\n final ForgetAllReceive response =\n await _api.unsubscribeAll(method: ForgetStreamType.ticks);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/ticks_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/ticks_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/tnc_approval_receive_methods.json b/lib/basic_api/generated/methods/tnc_approval_receive_methods.json index c46ca7b649..1ec16c492e 100644 --- a/lib/basic_api/generated/methods/tnc_approval_receive_methods.json +++ b/lib/basic_api/generated/methods/tnc_approval_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Approve the latest version of terms and conditions.\n ///\n /// For parameters information refer to [TncApprovalRequest].\n /// Throws a [UserException] if API response contains an error\n static Future verify(\n TncApprovalRequest request,\n ) async {\n final TncApprovalReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n UserException(baseExceptionModel: baseExceptionModel),\n );\n\n return TncApprovalResponse.fromJson(response.tncApproval);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Approve the latest version of terms and conditions.\n ///\n /// For parameters information refer to [TncApprovalRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future verify(\n TncApprovalRequest request,\n ) async {\n final TncApprovalReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TncApprovalResponse.fromJson(response.tncApproval);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/tnc_approval_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/tnc_approval_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/topup_virtual_receive_methods.json b/lib/basic_api/generated/methods/topup_virtual_receive_methods.json index e599d98e89..be41a59d85 100644 --- a/lib/basic_api/generated/methods/topup_virtual_receive_methods.json +++ b/lib/basic_api/generated/methods/topup_virtual_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Topes up the virtual-money's account balance becomes when it becomes low.\n ///\n /// For parameters information refer to [TopupVirtualRequest].\n /// Throws a [TopUpVirtualException] if API response contains an error\n static Future topUp([\n TopupVirtualRequest? request,\n ]) async {\n final TopupVirtualReceive response = await _api.call(\n request: request ?? const TopupVirtualRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TopUpVirtualException(baseExceptionModel: baseExceptionModel),\n );\n\n return TopupVirtualResponse.fromJson(response.topupVirtual);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Topes up the virtual-money's account balance becomes when it becomes low.\n ///\n /// For parameters information refer to [TopupVirtualRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future topUp([\n TopupVirtualRequest? request,\n ]) async {\n final TopupVirtualReceive response = await _api.call(\n request: request ?? const TopupVirtualRequest(),\n );\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TopupVirtualResponse.fromJson(response.topupVirtual);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/topup_virtual_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/topup_virtual_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/trading_durations_receive_methods.json b/lib/basic_api/generated/methods/trading_durations_receive_methods.json index d66ddc9629..7542190519 100644 --- a/lib/basic_api/generated/methods/trading_durations_receive_methods.json +++ b/lib/basic_api/generated/methods/trading_durations_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves a list of all available underlyings and the corresponding contract types and trading duration boundaries.\n ///\n /// If the user is logged in, only the assets available for that user's landing company will be returned.\n /// For parameters information refer to [TradingDurationsRequest].\n /// Throws a [TradingException] if API response contains an error\n static Future fetchTradingDurations(\n TradingDurationsRequest request,\n ) async {\n final TradingDurationsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TradingException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingDurationsResponse.fromJson(response.tradingDurations);\n }\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Retrieves a list of all available underlyings and the corresponding contract types and trading duration boundaries.\n ///\n /// If the user is logged in, only the assets available for that user's landing company will be returned.\n /// For parameters information refer to [TradingDurationsRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchTradingDurations(\n TradingDurationsRequest request,\n ) async {\n final TradingDurationsReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingDurationsResponse.fromJson(response.tradingDurations);\n }\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/trading_durations_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/trading_durations_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/trading_platform_accounts_receive_methods.json b/lib/basic_api/generated/methods/trading_platform_accounts_receive_methods.json index 1e4b46500d..b17a488a9b 100644 --- a/lib/basic_api/generated/methods/trading_platform_accounts_receive_methods.json +++ b/lib/basic_api/generated/methods/trading_platform_accounts_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Trading Platform: Accounts List.\n ///\n /// Get list of Trading Platform accounts for client.\n /// For parameters information refer to [TradingPlatformAccountsRequest].\n /// Throws a [TradingPlatformException] if API response contains an error.\n static Future getAccounts(\n TradingPlatformAccountsRequest request,\n ) async {\n final TradingPlatformAccountsReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TradingPlatformException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingPlatformAccountsResponse.fromJson(\n response.tradingPlatformAccounts,\n );\n }\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Trading Platform: Accounts List.\n ///\n /// Get list of Trading Platform accounts for client.\n /// For parameters information refer to [TradingPlatformAccountsRequest].\n /// Throws a [BaseAPIException] if API response contains an error.\n static Future getAccounts(\n TradingPlatformAccountsRequest request,\n ) async {\n final TradingPlatformAccountsReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingPlatformAccountsResponse.fromJson(\n response.tradingPlatformAccounts,\n );\n }\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/api.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/trading_platform_deposit_receive_methods.json b/lib/basic_api/generated/methods/trading_platform_deposit_receive_methods.json index 14ad129971..6984a43ff7 100644 --- a/lib/basic_api/generated/methods/trading_platform_deposit_receive_methods.json +++ b/lib/basic_api/generated/methods/trading_platform_deposit_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Trading Platform: Deposit.\n ///\n /// Information about deposit transaction, or status of demo account top up.\n /// For parameters information refer to [TradingPlatformDepositRequest].\n /// Throws a [TradingPlatformException] if API response contains an error.\n static Future deposit(\n TradingPlatformDepositRequest request,\n ) async {\n final TradingPlatformDepositReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TradingPlatformException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingPlatformDepositResponse.fromJson(\n response.tradingPlatformDeposit,\n );\n }\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Trading Platform: Deposit.\n ///\n /// Information about deposit transaction, or status of demo account top up.\n /// For parameters information refer to [TradingPlatformDepositRequest].\n /// Throws a [BaseAPIException] if API response contains an error.\n static Future deposit(\n TradingPlatformDepositRequest request,\n ) async {\n final TradingPlatformDepositReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingPlatformDepositResponse.fromJson(\n response.tradingPlatformDeposit,\n );\n }\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/api.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/trading_platform_new_account_receive_methods.json b/lib/basic_api/generated/methods/trading_platform_new_account_receive_methods.json index d6456cb7c8..37225fd692 100644 --- a/lib/basic_api/generated/methods/trading_platform_new_account_receive_methods.json +++ b/lib/basic_api/generated/methods/trading_platform_new_account_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Trading Platform: New Account (request).\n ///\n /// This call creates new Trading account, either demo or real money.\n /// For parameters information refer to [TradingPlatformNewAccountRequest].\n /// Throws a [TradingPlatformException] if API response contains an error.\n static Future create(\n TradingPlatformNewAccountRequest request,\n ) async {\n final TradingPlatformNewAccountReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TradingPlatformException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingPlatformNewAccountResponse.fromJson(\n response.tradingPlatformNewAccount,\n );\n}", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Trading Platform: New Account (request).\n ///\n /// This call creates new Trading account, either demo or real money.\n /// For parameters information refer to [TradingPlatformNewAccountRequest].\n /// Throws a [BaseAPIException] if API response contains an error.\n static Future create(\n TradingPlatformNewAccountRequest request,\n ) async {\n final TradingPlatformNewAccountReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingPlatformNewAccountResponse.fromJson(\n response.tradingPlatformNewAccount,\n );\n}", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/api.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/trading_servers_receive_methods.json b/lib/basic_api/generated/methods/trading_servers_receive_methods.json index 4f54b31644..4ef38ab477 100644 --- a/lib/basic_api/generated/methods/trading_servers_receive_methods.json +++ b/lib/basic_api/generated/methods/trading_servers_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Get the list of servers for platform. Currently, only mt5 is supported\n ///\n /// For parameters information refer to [TradingServersRequest].\n /// Throws a [TradingException] if API response contains an error\n static Future fetchTradingServers(\n TradingServersRequest request,\n ) async {\n final TradingServersReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TradingException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingServersResponse.fromJson(response.tradingServers);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Get the list of servers for platform. Currently, only mt5 is supported\n ///\n /// For parameters information refer to [TradingServersRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchTradingServers(\n TradingServersRequest request,\n ) async {\n final TradingServersReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingServersResponse.fromJson(response.tradingServers);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/trading_servers_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/trading_servers_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/trading_times_receive_methods.json b/lib/basic_api/generated/methods/trading_times_receive_methods.json index 54345f562d..93972a04c9 100644 --- a/lib/basic_api/generated/methods/trading_times_receive_methods.json +++ b/lib/basic_api/generated/methods/trading_times_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Receives a list of market opening times for a given date.\n ///\n /// For parameters information refer to [TradingTimesRequest].\n /// Throws a [TradingException] if API response contains an error\n static Future fetchTradingTimes(\n TradingTimesRequest request,\n ) async {\n final TradingTimesReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TradingException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingTimesResponse.fromJson(response.tradingTimes);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Receives a list of market opening times for a given date.\n ///\n /// For parameters information refer to [TradingTimesRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchTradingTimes(\n TradingTimesRequest request,\n ) async {\n final TradingTimesReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TradingTimesResponse.fromJson(response.tradingTimes);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/trading_times_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/trading_times_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/transaction_receive_methods.json b/lib/basic_api/generated/methods/transaction_receive_methods.json index 4f6f6118fa..08dd08ca02 100644 --- a/lib/basic_api/generated/methods/transaction_receive_methods.json +++ b/lib/basic_api/generated/methods/transaction_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Subscribes to account's transactions\n ///\n /// Throws a [TransactionsException] if API response contains an error\n static Stream subscribeTransactions({\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(\n request: const TransactionRequest(),\n comparePredicate: comparePredicate,\n )!\n .map((Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TransactionsException(baseExceptionModel: baseExceptionModel),\n );\n\n return response is TransactionReceive\n ? TransactionResponse.fromJson(\n response.transaction,\n response.subscription,\n )\n : null;\n });\n\n /// Unsubscribes from transaction subscription.\n ///\n /// Throws a [TransactionsException] if API response contains an error\n Future unsubscribeTransaction() async {\n if (subscription == null) {\n return null;\n }\n\n final ForgetReceive response =\n await _api.unsubscribe(subscriptionId: subscription!.id);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TransactionsException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }\n\n /// Unsubscribes all transaction subscriptions.\n ///\n /// Throws a [TransactionsException] if API response contains an error\n static Future unsubscribeAllTransaction() async {\n final ForgetAllReceive response =\n await _api.unsubscribeAll(method: ForgetStreamType.transaction);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TransactionsException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Subscribes to account's transactions\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Stream subscribeTransactions({\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(\n request: const TransactionRequest(),\n comparePredicate: comparePredicate,\n )!\n .map((Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return response is TransactionReceive\n ? TransactionResponse.fromJson(\n response.transaction,\n response.subscription,\n )\n : null;\n });\n\n /// Unsubscribes from transaction subscription.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future unsubscribeTransaction() async {\n if (subscription == null) {\n return null;\n }\n\n final ForgetReceive response =\n await _api.unsubscribe(subscriptionId: subscription!.id);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }\n\n /// Unsubscribes all transaction subscriptions.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future unsubscribeAllTransaction() async {\n final ForgetAllReceive response =\n await _api.unsubscribeAll(method: ForgetStreamType.transaction);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/transaction_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/transaction_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/transfer_between_accounts_receive_methods.json b/lib/basic_api/generated/methods/transfer_between_accounts_receive_methods.json index b983f5b292..bbb11fcf51 100644 --- a/lib/basic_api/generated/methods/transfer_between_accounts_receive_methods.json +++ b/lib/basic_api/generated/methods/transfer_between_accounts_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// This call allows transfers between accounts held by a given user.\n ///\n /// Transfer funds between your fiat and crypto currency accounts (for a fee).\n /// Please note that account_from should be same as current authorized account.\n /// For parameters information refer to [TransferBetweenAccountsRequest].\n /// Throws a [TransferException] if API response contains an error\n static Future transfer(\n TransferBetweenAccountsRequest request,\n ) async {\n final TransferBetweenAccountsReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n TransferException(baseExceptionModel: baseExceptionModel),\n );\n\n return TransferBetweenAccountsResponse.fromJson(\n response.transferBetweenAccounts,\n response.accounts,\n response.clientToFullName,\n response.clientToLoginid,\n response.transactionId);\n }\n", + "methods": "static final BaseAPI _api = Injector()();\n\n /// This call allows transfers between accounts held by a given user.\n ///\n /// Transfer funds between your fiat and crypto currency accounts (for a fee).\n /// Please note that account_from should be same as current authorized account.\n /// For parameters information refer to [TransferBetweenAccountsRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future transfer(\n TransferBetweenAccountsRequest request,\n ) async {\n final TransferBetweenAccountsReceive response =\n await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return TransferBetweenAccountsResponse.fromJson(\n response.transferBetweenAccounts,\n response.accounts,\n response.clientToFullName,\n response.clientToLoginid,\n response.transactionId);\n }\n", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/transfer_between_accounts_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/transfer_between_accounts_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/verify_email_receive_methods.json b/lib/basic_api/generated/methods/verify_email_receive_methods.json index 323f58da9c..115a828e9b 100644 --- a/lib/basic_api/generated/methods/verify_email_receive_methods.json +++ b/lib/basic_api/generated/methods/verify_email_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()();\n\n /// Verifies an email address for various purposes.\n ///\n /// The system will send an email to the address containing a security code for verification.\n /// For parameters information refer to [VerifyEmailRequest].\n /// Throws a [UserException] if API response contains an error\n static Future verify(\n VerifyEmailRequest request,\n ) async {\n final VerifyEmailReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n UserException(baseExceptionModel: baseExceptionModel),\n );\n\n return VerifyEmailResponse.fromJson(response.verifyEmail);\n }", + "methods": "static final BaseAPI _api = Injector()();\n\n /// Verifies an email address for various purposes.\n ///\n /// The system will send an email to the address containing a security code for verification.\n /// For parameters information refer to [VerifyEmailRequest].\n /// Throws a [BaseAPIException] if API response contains an error\n static Future verify(\n VerifyEmailRequest request,\n ) async {\n final VerifyEmailReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return VerifyEmailResponse.fromJson(response.verifyEmail);\n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/verify_email_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/verify_email_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/methods/website_status_receive_methods.json b/lib/basic_api/generated/methods/website_status_receive_methods.json index 76c2b5bc7d..91468647d4 100644 --- a/lib/basic_api/generated/methods/website_status_receive_methods.json +++ b/lib/basic_api/generated/methods/website_status_receive_methods.json @@ -1,4 +1,4 @@ { - "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets Website status. \n /// \n /// For parameters information refer to [WebsiteStatusRequest]. \n /// Throws a [WebsiteStatusException] if API response contains an error. \n static Future fetchWebsiteStatusRaw([ \n WebsiteStatusRequest? request, \n ]) async { \n final WebsiteStatusReceive response = await _api.call( \n request: request ?? const WebsiteStatusRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n WebsiteStatusException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Subscribes to website status. \n /// \n /// Throws a [WebsiteStatusException] if API response contains an error. \n static Stream subscribeWebsiteStatusRaw( \n WebsiteStatusRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n _api \n .subscribe(request: request, comparePredicate: comparePredicate)! \n .map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n WebsiteStatusException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is WebsiteStatusReceive ? response : null; \n }, \n ); \n \n /// Unsubscribes from website status. \n /// \n /// Throws an [WebsiteStatusException] if the API response contains an error. \n Future unsubscribeWebsiteStatusRaw() async { \n if (subscription == null) { \n return null; \n } \n \n final ForgetReceive response = \n await _api.unsubscribe(subscriptionId: subscription!.id); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n WebsiteStatusException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Unsubscribes all website status subscriptions. \n /// \n /// Throws an [WebsiteStatusException] if the API response contains an error. \n static Future unsubscribeAllWebsiteStatusRaw() async { \n final ForgetAllReceive response = \n await _api.unsubscribeAll(method: ForgetStreamType.websiteStatus); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n WebsiteStatusException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Gets Website status. \n /// \n /// Throws an [WebsiteStatusException] if the API response contains an error. \n static Future fetchWebsiteStatus([ \n WebsiteStatusRequest? request, \n ]) async { \n final WebsiteStatusReceive response = await fetchWebsiteStatusRaw(request); \n \n return WebsiteStatusResponse.fromJson( \n response.websiteStatus, \n response.subscription, \n ); \n } \n \n /// Subscribes to website status. \n static Stream subscribeWebsiteStatus( \n WebsiteStatusRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeWebsiteStatusRaw( \n request, \n comparePredicate: comparePredicate, \n ).map( \n (WebsiteStatusReceive? response) => response == null \n ? null \n : WebsiteStatusResponse.fromJson( \n response.websiteStatus, \n response.subscription, \n ), \n ); \n \n /// Unsubscribes from website status. \n /// \n /// Throws an [WebsiteStatusException] if the API response contains an error. \n Future unsubscribeWebsiteStatus() async { \n final ForgetReceive? response = await unsubscribeWebsiteStatusRaw(); \n \n return ForgetResponse.fromJson(response?.forget); \n } \n \n /// Unsubscribes all website status subscriptions. \n /// \n /// Throws an [WebsiteStatusException] if the API response contains an error. \n static Future unsubscribeAllWebsiteStatus() async { \n final ForgetAllReceive response = await unsubscribeAllWebsiteStatusRaw(); \n \n return ForgetAllResponse.fromJson(response.forgetAll); \n }", + "methods": "static final BaseAPI _api = Injector()(); \n \n /// Gets Website status. \n /// \n /// For parameters information refer to [WebsiteStatusRequest]. \n /// Throws a [BaseAPIException] if API response contains an error. \n static Future fetchWebsiteStatusRaw([ \n WebsiteStatusRequest? request, \n ]) async { \n final WebsiteStatusReceive response = await _api.call( \n request: request ?? const WebsiteStatusRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Subscribes to website status. \n /// \n /// Throws a [BaseAPIException] if API response contains an error. \n static Stream subscribeWebsiteStatusRaw( \n WebsiteStatusRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n _api \n .subscribe(request: request, comparePredicate: comparePredicate)! \n .map( \n (Response response) { \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response is WebsiteStatusReceive ? response : null; \n }, \n ); \n \n /// Unsubscribes from website status. \n /// \n /// Throws an [BaseAPIException] if the API response contains an error. \n Future unsubscribeWebsiteStatusRaw() async { \n if (subscription == null) { \n return null; \n } \n \n final ForgetReceive response = \n await _api.unsubscribe(subscriptionId: subscription!.id); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Unsubscribes all website status subscriptions. \n /// \n /// Throws an [BaseAPIException] if the API response contains an error. \n static Future unsubscribeAllWebsiteStatusRaw() async { \n final ForgetAllReceive response = \n await _api.unsubscribeAll(method: ForgetStreamType.websiteStatus); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Gets Website status. \n /// \n /// Throws an [BaseAPIException] if the API response contains an error. \n static Future fetchWebsiteStatus([ \n WebsiteStatusRequest? request, \n ]) async { \n final WebsiteStatusReceive response = await fetchWebsiteStatusRaw(request); \n \n return WebsiteStatusResponse.fromJson( \n response.websiteStatus, \n response.subscription, \n ); \n } \n \n /// Subscribes to website status. \n static Stream subscribeWebsiteStatus( \n WebsiteStatusRequest request, { \n RequestCompareFunction? comparePredicate, \n }) => \n subscribeWebsiteStatusRaw( \n request, \n comparePredicate: comparePredicate, \n ).map( \n (WebsiteStatusReceive? response) => response == null \n ? null \n : WebsiteStatusResponse.fromJson( \n response.websiteStatus, \n response.subscription, \n ), \n ); \n \n /// Unsubscribes from website status. \n /// \n /// Throws an [BaseAPIException] if the API response contains an error. \n Future unsubscribeWebsiteStatus() async { \n final ForgetReceive? response = await unsubscribeWebsiteStatusRaw(); \n \n return ForgetResponse.fromJson(response?.forget); \n } \n \n /// Unsubscribes all website status subscriptions. \n /// \n /// Throws an [BaseAPIException] if the API response contains an error. \n static Future unsubscribeAllWebsiteStatus() async { \n final ForgetAllReceive response = await unsubscribeAllWebsiteStatusRaw(); \n \n return ForgetAllResponse.fromJson(response.forgetAll); \n }", "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/website_status_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/website_status_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/helpers/miscellaneous_helper.dart b/lib/helpers/miscellaneous_helper.dart index 6d75cf53df..73a7c97323 100644 --- a/lib/helpers/miscellaneous_helper.dart +++ b/lib/helpers/miscellaneous_helper.dart @@ -2,7 +2,7 @@ import 'dart:io'; import 'package:device_info_plus/device_info_plus.dart'; -import 'package:flutter_deriv_api/api/exceptions/api_base_exception.dart'; +import 'package:flutter_deriv_api/api/exceptions/base_api_exception.dart'; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/basic_api/response.dart'; @@ -33,7 +33,7 @@ String? parseWebSocketUrl(String? url, {bool isAuthUrl = false}) { /// Checks for existence of error in [response] and throws exception created by [exceptionCreator] void checkException({ Response? response, - APIBaseException Function({BaseExceptionModel? baseExceptionModel})? + BaseAPIException Function({BaseExceptionModel? baseExceptionModel})? exceptionCreator, }) { if (response?.error != null) { diff --git a/test/api/exceptions/api_base_exception_test.dart b/test/api/exceptions/api_base_exception_test.dart new file mode 100644 index 0000000000..4ff9f125ba --- /dev/null +++ b/test/api/exceptions/api_base_exception_test.dart @@ -0,0 +1,46 @@ +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + group('APIBaseException tests =>', () { + test('should return the correct message.', () { + final BaseExceptionModel baseExceptionModel = + BaseExceptionModel(code: 'BAD_REQUEST', message: 'Bad Request'); + final BaseAPIException exception = + BaseAPIException(baseExceptionModel: baseExceptionModel); + + expect(exception.message, 'Bad Request'); + }); + + test('should return the correct code.', () { + final BaseExceptionModel baseExceptionModel = + BaseExceptionModel(code: 'BAD_REQUEST', message: 'Bad Request'); + final BaseAPIException exception = + BaseAPIException(baseExceptionModel: baseExceptionModel); + + expect(exception.code, 'BAD_REQUEST'); + }); + + test('should return the correct details.', () { + final BaseExceptionModel baseExceptionModel = BaseExceptionModel( + code: 'BAD_REQUEST', + message: 'Bad Request', + details: {'key': 'value'}, + ); + final BaseAPIException exception = + BaseAPIException(baseExceptionModel: baseExceptionModel); + + expect(exception.details, {'key': 'value'}); + }); + + test('should return the correct string representation.', () { + final BaseExceptionModel baseExceptionModel = + BaseExceptionModel(code: 'BAD_REQUEST', message: 'Bad Request'); + final BaseAPIException exception = + BaseAPIException(baseExceptionModel: baseExceptionModel); + final String stringRepresentation = '$exception'; + + expect(stringRepresentation, 'Bad Request'); + }); + }); +} diff --git a/test/helpers/boolean_helper_test.dart b/test/helpers/boolean_helper_test.dart new file mode 100644 index 0000000000..095708e887 --- /dev/null +++ b/test/helpers/boolean_helper_test.dart @@ -0,0 +1,49 @@ +import 'package:test/test.dart'; + +import 'package:flutter_deriv_api/helpers/boolean_helper.dart'; + +void main() { + group('getBool tests =>', () { + test('should return true for 1.', () { + final bool? result = getBool(1); + expect(result, true); + }); + + test('should return true for true.', () { + final bool? result = getBool(true); + expect(result, true); + }); + + test('should return false for 0.', () { + final bool? result = getBool(0); + expect(result, false); + }); + + test('should return false for false.', () { + final bool? result = getBool(false); + expect(result, false); + }); + + test('should return null for null.', () { + final bool? result = getBool(null); + expect(result, null); + }); + }); + + group('getInt tests =>', () { + test('should return 1 for true.', () { + final int? result = getInt(value: true); + expect(result, 1); + }); + + test('should return 0 for false.', () { + final int? result = getInt(value: false); + expect(result, 0); + }); + + test('should return null for null.', () { + final int? result = getInt(); + expect(result, null); + }); + }); +} diff --git a/test/helpers/date_time_helper_test.dart b/test/helpers/date_time_helper_test.dart new file mode 100644 index 0000000000..17b70ec9e5 --- /dev/null +++ b/test/helpers/date_time_helper_test.dart @@ -0,0 +1,120 @@ +// ignore_for_file: avoid_redundant_argument_values + +import 'package:test/test.dart'; + +import 'package:flutter_deriv_api/helpers/date_time_helper.dart'; + +void main() { + group('getCurrentLocalEpoch tests =>', () { + test('should return current epoch time in seconds.', () { + final int result = getCurrentLocalEpoch(); + + expect(result, isA()); + }); + }); + + group('getCurrentServerTime tests =>', () { + test('should return current server time.', () { + const int timeDifference = 3600; + final DateTime result = getCurrentServerTime(timeDifference); + + expect(result, isA()); + }); + }); + + group('getDateTime tests =>', () { + test('should return DateTime from time in seconds.', () { + const int timeInSeconds = 1633459200; + final DateTime? result = getDateTime(timeInSeconds); + + expect(result, isA()); + expect(result?.year, 2021); + expect(result?.month, 10); + expect(result?.day, 5); + expect(result?.hour, 18); + expect(result?.minute, 40); + expect(result?.second, 0); + }); + + test('should return null for null time in seconds.', () { + final DateTime? result = getDateTime(null); + + expect(result, null); + }); + }); + + group('getDateTimeFromString tests =>', () { + test('should return DateTime from string in seconds.', () { + const String timeInSeconds = '1633459200'; + final DateTime? result = getDateTimeFromString(timeInSeconds); + + expect(result, isA()); + expect(result?.year, 2021); + expect(result?.month, 10); + expect(result?.day, 5); + expect(result?.hour, 18); + expect(result?.minute, 40); + expect(result?.second, 0); + }); + + test('should return null for null string.', () { + final DateTime? result = getDateTimeFromString(null); + + expect(result, null); + }); + + test('should return null for invalid string.', () { + final DateTime? result = getDateTimeFromString('invalid'); + + expect(result, null); + }); + }); + + group('getSecondsSinceEpoch tests =>', () { + test('should return seconds since epoch from milliseconds since epoch.', + () { + const int millisecondsSinceEpoch = 1633459200000; + final int result = getSecondsSinceEpoch(millisecondsSinceEpoch); + + expect(result, 1633459200); + }); + }); + + group('getSecondsSinceEpochDateTime tests =>', () { + test('should return seconds since epoch from DateTime object.', () { + final DateTime dateTime = DateTime.utc(2021, 10, 6, 0, 0, 0); + final int? result = getSecondsSinceEpochDateTime(dateTime); + + expect(result, 1633478400); + }); + + test('should return null for null DateTime.', () { + final int? result = getSecondsSinceEpochDateTime(null); + + expect(result, null); + }); + }); + + group('getStringFromDateTime tests =>', () { + test('should return formatted string from DateTime object.', () { + final DateTime dateTime = DateTime.utc(2021, 10, 6); + final String? result = getStringFromDateTime(dateTime); + + expect(result, '2021-10-06'); + }); + + test('should return null for null DateTime.', () { + final String? result = getStringFromDateTime(null); + + expect(result, null); + }); + + test('should return formatted string with custom pattern.', () { + final DateTime dateTime = DateTime.utc(2021, 10, 6); + final String? result = + getStringFromDateTime(dateTime, pattern: 'MM/dd/yyyy'); + + expect(result, '10/06/2021'); + }); + }); +} diff --git a/test/helpers/enum_helper_test.dart b/test/helpers/enum_helper_test.dart new file mode 100644 index 0000000000..9951f1497b --- /dev/null +++ b/test/helpers/enum_helper_test.dart @@ -0,0 +1,208 @@ +import 'package:test/test.dart'; + +import 'package:flutter_deriv_api/api/models/enums.dart'; +import 'package:flutter_deriv_api/helpers/enum_helper.dart'; + +void main() { + group('getEnumName tests =>', () { + test('should return formatted enum name.', () { + final String result = getEnumName('enum_name'); + + expect(result, 'enumName'); + }); + + test('should handle special characters in enum name.', () { + final String result = getEnumName('enum_name_123_&'); + + expect(result, 'enumName123'); + }); + }); + + group('getStringFromEnum tests =>', () { + test('should return string from enum in snake case.', () { + final String result = getStringFromEnum(EnumCase.snakeCase); + + expect(result, 'snake_case'); + }); + + test('should return string from enum in param case.', () { + final String result = + getStringFromEnum(EnumCase.paramCase, enumCase: EnumCase.paramCase); + + expect(result, 'param-case'); + }); + + test('should return string from enum in upper case.', () { + final String result = + getStringFromEnum(EnumCase.upperCase, enumCase: EnumCase.upperCase); + + expect(result, 'UPPERCASE'); + }); + + test('should return empty string for null enum.', () { + final String result = getStringFromEnum(null); + + expect(result, ''); + }); + }); + + group('getEnumFromString tests =>', () { + test('should return enum from string in snake case.', () { + final EnumCase? result = getEnumFromString( + values: EnumCase.values, + name: 'snake_case', + ); + + expect(result, EnumCase.snakeCase); + }); + + test('should return enum from string in param case.', () { + final EnumCase? result = getEnumFromString( + values: EnumCase.values, + name: 'param-case', + enumCase: EnumCase.paramCase, + ); + + expect(result, EnumCase.paramCase); + }); + + test('should return enum from string in upper case.', () { + final EnumCase? result = getEnumFromString( + values: EnumCase.values, + name: 'UPPERCASE', + enumCase: EnumCase.upperCase, + ); + + expect(result, EnumCase.upperCase); + }); + + test('should return null for unknown string.', () { + final EnumCase? result = getEnumFromString( + values: EnumCase.values, + name: 'unknown_case', + ); + expect(result, null); + }); + + test('should return null for null string.', () { + final EnumCase? result = getEnumFromString( + values: EnumCase.values, + name: null, + ); + + expect(result, null); + }); + }); + + group('getStringListFromEnums tests =>', () { + test('should return list of strings from list of enums in snake case.', () { + final List result = getStringListFromEnums( + EnumCase.values, + ); + + expect(result, ['snake_case', 'param_case', 'upper_case']); + }); + + test('should return list of strings from list of enums in param case.', () { + final List result = getStringListFromEnums( + EnumCase.values, + enumCase: EnumCase.paramCase, + ); + + expect(result, ['snake-case', 'param-case', 'upper-case']); + }); + + test('should return list of strings from list of enums in upper case.', () { + final List result = getStringListFromEnums( + EnumCase.values, + enumCase: EnumCase.upperCase, + ); + + expect(result, ['SNAKECASE', 'PARAMCASE', 'UPPERCASE']); + }); + }); + + group('getEnumListFromStrings tests =>', () { + test('should return list of enums from list of strings in snake case.', () { + final List? result = getEnumListFromStrings( + values: EnumCase.values, + names: ['snake_case', 'param-case', 'UPPERCASE'], + ); + + expect(result, [EnumCase.snakeCase, null, null]); + }); + + test('should return list of enums from list of strings in param case.', () { + final List? result = getEnumListFromStrings( + values: EnumCase.values, + names: ['snake-case', 'param-case', 'UPPERCASE'], + enumCase: EnumCase.paramCase, + ); + + expect(result, [EnumCase.snakeCase, EnumCase.paramCase, null]); + }); + + test('should return list of enums from list of strings in upper case.', () { + final List? result = getEnumListFromStrings( + values: EnumCase.values, + names: ['snake_case', 'param_case', 'UPPERCASE'], + enumCase: EnumCase.upperCase, + ); + + expect(result, [null, null, EnumCase.upperCase]); + }); + + test('should return null for unknown strings.', () { + final List? result = getEnumListFromStrings( + values: EnumCase.values, + names: ['unknown_case'], + ); + + expect(result, [null]); + }); + + test('should return null for null strings.', () { + final List? result = getEnumListFromStrings( + values: EnumCase.values, + names: null, + ); + + expect(result, null); + }); + }); + + group('getEnumValueString tests =>', () { + test('should return the enum value string.', () { + final String result = getEnumValueString(EnumCase.snakeCase.toString()); + + expect(result, 'snakeCase'); + }); + }); + + group('EnumConverter tests =>', () { + test('should convert string to AccountRiskClassification enum.', () { + final AccountRiskClassification? result = + 'low'.toAccountRiskClassificationEnum; + + expect(result, AccountRiskClassification.low); + }); + + test('should convert string to VerificationType enum.', () { + final VerificationType? result = 'document'.toVerificationTypeEnum; + + expect(result, VerificationType.document); + }); + + test('should convert string to AccountStatusType enum.', () { + final AccountStatusType? result = 'disabled'.toAccountStatusTypeEnum; + + expect(result, AccountStatusType.disabled); + }); + + test('should convert string to ContractType enum.', () { + final ContractType? result = 'CALLSPREAD'.toContractTypeEnum; + + expect(result, ContractType.callSpread); + }); + }); +} diff --git a/test/helpers/map_helper_test.dart b/test/helpers/map_helper_test.dart new file mode 100644 index 0000000000..df45944991 --- /dev/null +++ b/test/helpers/map_helper_test.dart @@ -0,0 +1,104 @@ +import 'package:flutter_deriv_api/helpers/map_helper.dart'; +import 'package:test/test.dart'; + +void main() { + group('getListFromMap tests =>', () { + test('should return null for null map list.', () { + final List? result = getListFromMap(null); + + expect(result, null); + }); + + test('should return null for empty map list.', () { + final List? result = getListFromMap([]); + + expect(result, null); + }); + + test('should return list of models from map list.', () { + final List> mapList = >[ + {'id': 1, 'name': 'John'}, + {'id': 2, 'name': 'Jane'}, + ]; + + final List? result = getListFromMap( + mapList, + itemToTypeCallback: (dynamic item) => UserModel.fromMap(item), + ); + + expect(result, isNotNull); + expect(result!.length, 2); + expect(result[0], isA()); + expect(result[1], isA()); + expect(result[0]?.id, 1); + expect(result[0]?.name, 'John'); + expect(result[1]?.id, 2); + expect(result[1]?.name, 'Jane'); + }); + + test('should return list of models without callback function.', () { + final List> mapList = >[ + {'id': 1, 'name': 'John'}, + {'id': 2, 'name': 'Jane'}, + ]; + + final List? result = getListFromMap(mapList); + + expect(result, isNotNull); + expect(result!.length, 2); + expect(result[0], {'id': 1, 'name': 'John'}); + expect(result[1], {'id': 2, 'name': 'Jane'}); + }); + }); + + group('getItemFromMap tests =>', () { + test('should return null for null map.', () { + final dynamic result = getItemFromMap(null); + + expect(result, null); + }); + + test('should return model from map.', () { + final Map map = { + 'id': 1, + 'name': 'John' + }; + + final UserModel? result = getItemFromMap( + map, + itemToTypeCallback: (dynamic item) => UserModel.fromMap(item), + ); + + expect(result, isA()); + expect(result?.id, 1); + expect(result?.name, 'John'); + }); + + test('should return map without callback function.', () { + final Map map = { + 'id': 1, + 'name': 'John' + }; + + final Map? result = + getItemFromMap(map, itemToTypeCallback: (dynamic item) => item); + + expect(result, {'id': 1, 'name': 'John'}); + }); + }); +} + +class UserModel { + UserModel({ + required this.id, + required this.name, + }); + + factory UserModel.fromMap(Map map) => UserModel( + id: map['id'], + name: map['name'], + ); + + final int id; + final String name; +} diff --git a/test/helpers/number_helper_test.dart b/test/helpers/number_helper_test.dart new file mode 100644 index 0000000000..a634f6a596 --- /dev/null +++ b/test/helpers/number_helper_test.dart @@ -0,0 +1,212 @@ +import 'package:test/test.dart'; + +import 'package:flutter_deriv_api/helpers/number_helper.dart'; + +void main() { + group('getDecimalDigits tests =>', () { + test('should return 2 for a whole number string.', () { + expect(getDecimalDigits('123'), equals(2)); + }); + + test('should return 2 for a decimal number string.', () { + expect(getDecimalDigits('123.45'), equals(2)); + }); + + test( + 'should return 4 for a decimal number string with more than 2 decimal places.', + () { + expect(getDecimalDigits('123.4567'), equals(4)); + }); + + test('should return 2 for an empty string.', () { + expect(getDecimalDigits(''), equals(2)); + }); + }); + + group('NumberValidator tests =>', () { + test('isANumber should return true for a valid number string.', () { + expect(NumberValidator.isANumber('123'), isTrue); + }); + + test('isANumber should return true for a valid decimal number string.', () { + expect(NumberValidator.isANumber('123.45'), isTrue); + }); + + test('isANumber should return false for an invalid number string.', () { + expect(NumberValidator.isANumber('abc'), isFalse); + }); + + test( + 'isBetweenLimits should return true when the value is within the limits.', + () { + expect( + NumberValidator.isBetweenLimits( + stringValue: '5', + lowerLimit: 1, + upperLimit: 10, + ), + isTrue, + ); + }); + + test( + 'isBetweenLimits should return false when the value is below the lower limit.', + () { + expect( + NumberValidator.isBetweenLimits( + stringValue: '5', + lowerLimit: 10, + upperLimit: 20, + ), + isFalse, + ); + }); + + test( + 'isBetweenLimits should return false when the value is above the upper limit.', + () { + expect( + NumberValidator.isBetweenLimits( + stringValue: '25', + lowerLimit: 10, + upperLimit: 20, + ), + isFalse, + ); + }); + + test( + 'isLessThanLimit should return true when the value is less than the upper limit.', + () { + expect( + NumberValidator.isLessThanLimit(stringValue: '5', upperLimit: 10), + isTrue, + ); + }); + + test( + 'isLessThanLimit should return true when the value is equal to the upper limit.', + () { + expect( + NumberValidator.isLessThanLimit(stringValue: '10', upperLimit: 10), + isTrue, + ); + }); + + test( + 'isLessThanLimit should return false when the value is greater than the upper limit.', + () { + expect( + NumberValidator.isLessThanLimit(stringValue: '15', upperLimit: 10), + isFalse, + ); + }); + + test( + 'isMoreThanLimit should return true when the value is greater than the lower limit.', + () { + expect( + NumberValidator.isMoreThanLimit(stringValue: '5', lowerLimit: 1), + isTrue, + ); + }); + + test( + 'isMoreThanLimit should return true when the value is equal to the lower limit.', + () { + expect( + NumberValidator.isMoreThanLimit(stringValue: '1', lowerLimit: 1), + isTrue, + ); + }); + + test( + 'isMoreThanLimit should return false when the value is less than the lower limit.', + () { + expect( + NumberValidator.isMoreThanLimit(stringValue: '0', lowerLimit: 1), + isFalse, + ); + }); + + test('isAPositiveNumber should return true for a positive number string.', + () { + expect(NumberValidator.isAPositiveNumber('5'), isTrue); + }); + + test('isAPositiveNumber should return false for a negative number string.', + () { + expect(NumberValidator.isAPositiveNumber('-5'), isFalse); + }); + + test('isAPositiveNumber should return false for zero.', () { + expect(NumberValidator.isAPositiveNumber('0'), isFalse); + }); + + test( + 'hasValidPrecision should return true when the decimal number has valid precision.', + () { + expect( + NumberValidator.hasValidPrecision( + stringValue: '1.23', + validDecimalNumber: 2, + ), + isTrue, + ); + }); + + test( + 'hasValidPrecision should return true when the whole number is provided.', + () { + expect( + NumberValidator.hasValidPrecision( + stringValue: '5', + validDecimalNumber: 2, + ), + isTrue, + ); + }); + + test( + 'hasValidPrecision should return false when the decimal number has more decimal places than the valid precision.', + () { + expect( + NumberValidator.hasValidPrecision( + stringValue: '1.2345', + validDecimalNumber: 2, + ), + isFalse, + ); + }); + }); + + group('generateRandomInt tests =>', () { + test('should generate a random int between min and max (inclusive).', () { + final int randomInt = generateRandomInt(min: 1); + + expect(randomInt, greaterThanOrEqualTo(1)); + expect(randomInt, lessThanOrEqualTo(10)); + }); + + test('should generate a random int with default min and max values.', () { + final int randomInt = generateRandomInt(); + + expect(randomInt, greaterThanOrEqualTo(0)); + expect(randomInt, lessThanOrEqualTo(10)); + }); + }); + + group('getDouble tests =>', () { + test('should parse double value from a string.', () { + expect(getDouble('123.45'), equals(123.45)); + }); + + test('should parse double value from a number.', () { + expect(getDouble(123.45), equals(123.45)); + }); + + test('should return null for an invalid value.', () { + expect(getDouble('abc'), isNull); + }); + }); +} diff --git a/test/services/connection/api_manager/exceptions/api_manager_exception_test.dart b/test/services/connection/api_manager/exceptions/api_manager_exception_test.dart new file mode 100644 index 0000000000..21f9671b16 --- /dev/null +++ b/test/services/connection/api_manager/exceptions/api_manager_exception_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; + +import 'package:flutter_deriv_api/services/connection/api_manager/exceptions/api_manager_exception.dart'; + +void main() { + group('APIManagerException tests =>', () { + test( + 'should create an APIManagerException instance with the provided message.', + () { + final APIManagerException exception = + APIManagerException(message: 'Test Exception'); + + expect(exception, isA()); + expect(exception.message, 'Test Exception'); + }); + + test( + 'toString should return a string representation of the APIManagerException.', + () { + final APIManagerException exception = + APIManagerException(message: 'Test Exception'); + + expect(exception.toString(), 'APIManagerException: Test Exception'); + }); + }); +} From b4d3f63db1a64ca94e8a439cb005c6ec3034a127 Mon Sep 17 00:00:00 2001 From: sahani-deriv <125638269+sahani-deriv@users.noreply.github.com> Date: Thu, 10 Aug 2023 16:19:29 +0800 Subject: [PATCH 32/64] MOBC-450/fix_connectivity_issue (#275) - fix connectivity issue --- .../response/p2p_ping_response_result.dart | 2 +- lib/state/connection/connection_cubit.dart | 51 ++++++++++--------- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/lib/api/response/p2p_ping_response_result.dart b/lib/api/response/p2p_ping_response_result.dart index 02d97a4ccb..a82581922a 100644 --- a/lib/api/response/p2p_ping_response_result.dart +++ b/lib/api/response/p2p_ping_response_result.dart @@ -67,7 +67,7 @@ class P2pPingResponse extends P2pPingResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - APIBaseException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/state/connection/connection_cubit.dart b/lib/state/connection/connection_cubit.dart index 4a655bb363..c47d4db6ab 100644 --- a/lib/state/connection/connection_cubit.dart +++ b/lib/state/connection/connection_cubit.dart @@ -32,13 +32,9 @@ class ConnectionCubit extends Cubit { _connectionInformation = connectionInformation; - if (_api is BinaryAPI) { - _setupConnectivityListener(); - } + _connect(_connectionInformation); _startKeepAliveTimer(); - - _connect(_connectionInformation); } final String _key = '${UniqueKey()}'; @@ -74,6 +70,9 @@ class ConnectionCubit extends Cubit { /// Gets app id of websocket. static String get appId => _connectionInformation.appId; + /// Streamsubscription for connectivity. + StreamSubscription? connectivitySubscription; + /// Reconnect to Websocket. Future reconnect({ConnectionInformation? connectionInformation}) async { emit(const ConnectionDisconnectedState()); @@ -122,26 +121,30 @@ class ConnectionCubit extends Cubit { } }, ); + + if (_api is BinaryAPI) { + _setupConnectivityListener(); + } } - void _setupConnectivityListener() => - Connectivity().onConnectivityChanged.listen( - (ConnectivityResult status) async { - final bool isConnectedToNetwork = - status == ConnectivityResult.mobile || - status == ConnectivityResult.wifi; - - if (isConnectedToNetwork) { - final bool isConnected = await _ping(); - - if (!isConnected) { - await reconnect(); - } - } else if (status == ConnectivityResult.none) { - emit(const ConnectionDisconnectedState()); + void _setupConnectivityListener() { + connectivitySubscription ??= Connectivity().onConnectivityChanged.listen( + (ConnectivityResult status) async { + final bool isConnectedToNetwork = status == ConnectivityResult.mobile || + status == ConnectivityResult.wifi; + + if (isConnectedToNetwork) { + final bool isConnected = await _ping(); + + if (!isConnected) { + await reconnect(); } - }, - ); + } else if (status == ConnectivityResult.none) { + emit(const ConnectionDisconnectedState()); + } + }, + ); + } void _startKeepAliveTimer() { if (_connectivityTimer == null || !_connectivityTimer!.isActive) { @@ -154,7 +157,6 @@ class ConnectionCubit extends Cubit { try { final PingResponse response = await PingResponse.pingMethod().timeout(_pingTimeout); - return response.ping == PingEnum.pong; } on Exception catch (_) { return false; @@ -164,7 +166,8 @@ class ConnectionCubit extends Cubit { @override Future close() { _connectivityTimer?.cancel(); - + connectivitySubscription?.cancel(); + connectivitySubscription = null; return super.close(); } } From f0cf95ea4787d0e3876d6af70d3b07780665f07d Mon Sep 17 00:00:00 2001 From: Hamed Rezaee <57184669+hamed-deriv@users.noreply.github.com> Date: Wed, 6 Sep 2023 17:37:42 +0800 Subject: [PATCH 33/64] hamed/remove_http_client (#280) - remove http client --- .../exceptions/http_client_exception.dart | 21 --------- .../connection/http_client/http_client.dart | 43 ------------------- 2 files changed, 64 deletions(-) delete mode 100644 lib/services/connection/http_client/exceptions/http_client_exception.dart delete mode 100644 lib/services/connection/http_client/http_client.dart diff --git a/lib/services/connection/http_client/exceptions/http_client_exception.dart b/lib/services/connection/http_client/exceptions/http_client_exception.dart deleted file mode 100644 index ce3bd2759a..0000000000 --- a/lib/services/connection/http_client/exceptions/http_client_exception.dart +++ /dev/null @@ -1,21 +0,0 @@ -/// HTTP Client Exception exception class. -class HTTPClientException implements Exception { - /// Initializes http exception. - HTTPClientException({ - required this.statusCode, - required this.message, - required this.errorCode, - }); - - /// Exception message. - final String message; - - /// Http status code. - final int statusCode; - - /// Http error code. - final String? errorCode; - - @override - String toString() => '$statusCode HTTP Error Ocurred: $message'; -} \ No newline at end of file diff --git a/lib/services/connection/http_client/http_client.dart b/lib/services/connection/http_client/http_client.dart deleted file mode 100644 index e3b3bdf92f..0000000000 --- a/lib/services/connection/http_client/http_client.dart +++ /dev/null @@ -1,43 +0,0 @@ -import 'dart:convert' as convert; - -import 'package:flutter_deriv_api/services/connection/http_client/exceptions/http_client_exception.dart'; -import 'package:http/http.dart' as http; - -/// Singleton class for http requests. -class HttpClient { - /// Initializes http client. - factory HttpClient() => _instance; - - HttpClient._internal(); - - static final HttpClient _instance = HttpClient._internal(); - - /// Http get request. - Future get(String url) async => http.get(Uri.parse(url)); - - /// Http post request. - Future> post({ - required String url, - required Map jsonBody, - Map? headers, - }) async { - final String jsonString = convert.jsonEncode(jsonBody); - - final http.Response response = - await http.post(Uri.parse(url), body: jsonString, headers: headers); - - final Map jsonResponse = convert.jsonDecode(response.body); - - if (response.statusCode ~/ 100 != 2) { - throw HTTPClientException( - errorCode: jsonResponse['error_code'], - statusCode: response.statusCode, - message: jsonResponse.containsKey('message') - ? jsonResponse['message'] - : 'Server Error', - ); - } - - return jsonResponse; - } -} \ No newline at end of file From 15ad3bd8f147c86f36520de0071406baa1ac5731 Mon Sep 17 00:00:00 2001 From: ramin-deriv <55975218+ramin-deriv@users.noreply.github.com> Date: Wed, 27 Sep 2023 16:00:19 +0800 Subject: [PATCH 34/64] ramin/update_package_for_wallet (#281) - update package for wallet --- lib/api/models/enums.dart | 5 +- .../response/authorize_response_result.dart | 817 ++---- .../cashier_payments_response_extended.dart | 99 + .../cashier_payments_response_result.dart | 76 +- .../get_account_types_response_extended.dart | 28 + .../get_account_types_response_result.dart | 442 +--- ..._financial_assessment_response_result.dart | 200 +- .../response/get_limits_response_result.dart | 103 +- .../get_settings_response_result.dart | 172 +- ...nding_company_details_response_result.dart | 123 +- .../landing_company_response_result.dart | 2240 ++++++++++++----- .../response/link_wallet_response_result.dart | 6 +- .../mt5_get_settings_response_result.dart | 322 ++- .../new_account_wallet_response_extended.dart | 28 + .../new_account_wallet_response_result.dart | 27 +- .../residence_list_response_result.dart | 152 +- .../service_token_response_result.dart | 139 +- ...ing_platform_accounts_response_result.dart | 107 +- ...latform_asset_listing_response_result.dart | 274 ++ ...rm_available_accounts_response_result.dart | 114 +- ...ding_platform_deposit_response_result.dart | 10 +- ..._platform_new_account_response_result.dart | 56 +- ...tform_password_change_response_result.dart | 6 +- ...atform_password_reset_response_result.dart | 6 +- ...tform_product_listing_response_result.dart | 67 +- ...g_platform_withdrawal_response_result.dart | 12 +- ...sfer_between_accounts_response_result.dart | 53 +- .../wallet_migration_response_extended.dart | 57 + .../wallet_migration_response_result.dart | 417 +++ .../website_status_response_result.dart | 385 ++- .../generated/authorize_receive.dart | 15 +- lib/basic_api/generated/authorize_send.dart | 11 +- .../generated/get_account_types_receive.dart | 15 +- .../generated/get_account_types_send.dart | 19 +- .../generated/get_settings_receive.dart | 15 +- .../generated/get_settings_send.dart | 11 +- .../landing_company_details_send.dart | 19 +- .../generated/landing_company_send.dart | 11 +- .../generated/link_wallet_receive.dart | 15 +- lib/basic_api/generated/link_wallet_send.dart | 11 +- ...latform_asset_listing_receive_methods.json | 4 + .../wallet_migration_receive_methods.json | 4 + .../generated/mt5_new_account_receive.dart | 15 +- .../generated/mt5_new_account_send.dart | 21 +- .../mt5_password_change_receive.dart | 15 +- .../new_account_maltainvest_send.dart | 176 +- .../generated/new_account_real_receive.dart | 15 +- .../generated/new_account_real_send.dart | 21 +- .../new_account_virtual_receive.dart | 15 +- .../generated/new_account_virtual_send.dart | 11 +- .../generated/new_account_wallet_receive.dart | 15 +- .../generated/new_account_wallet_send.dart | 106 +- .../generated/profit_table_send.dart | 17 +- .../generated/set_settings_receive.dart | 15 +- .../generated/set_settings_send.dart | 33 +- .../generated/statement_receive.dart | 15 +- lib/basic_api/generated/statement_send.dart | 17 +- .../generated/trading_durations_receive.dart | 15 +- .../generated/trading_durations_send.dart | 23 +- ...rading_platform_asset_listing_receive.dart | 72 + .../trading_platform_asset_listing_send.dart | 97 + ...latform_investor_password_change_send.dart | 11 +- .../trading_platform_new_account_receive.dart | 15 +- .../trading_platform_new_account_send.dart | 13 +- .../generated/wallet_migration_receive.dart | 61 + .../generated/wallet_migration_send.dart | 52 + .../helper/response_mapper.helper.dart | 9 +- .../connection/api_manager/mock_api.dart | 12 + .../account/get_account_types_response.dart | 153 ++ .../account/new_account_wallet_response.dart | 16 + .../cashier/cashier_payments_response.dart | 27 + .../common/website_status_response.dart | 5 + .../mock_data/wallet_migration_response.dart | 42 + .../get_account_types_test.dart | 75 + .../new_account_wallet_test.dart | 31 + .../wallet_migration_test.dart | 63 + test/api/cashier/cashier_payments_test.dart | 30 + .../common/asset_index/asset_index_test.dart | 3 +- .../common/trading/trading_duration_test.dart | 2 +- test/api/mt5/mt5_account_test.dart | 2 +- 80 files changed, 5146 insertions(+), 2883 deletions(-) create mode 100644 lib/api/response/cashier_payments_response_extended.dart create mode 100644 lib/api/response/get_account_types_response_extended.dart create mode 100644 lib/api/response/new_account_wallet_response_extended.dart create mode 100644 lib/api/response/trading_platform_asset_listing_response_result.dart create mode 100644 lib/api/response/wallet_migration_response_extended.dart create mode 100644 lib/api/response/wallet_migration_response_result.dart create mode 100644 lib/basic_api/generated/methods/trading_platform_asset_listing_receive_methods.json create mode 100644 lib/basic_api/generated/methods/wallet_migration_receive_methods.json create mode 100644 lib/basic_api/generated/trading_platform_asset_listing_receive.dart create mode 100644 lib/basic_api/generated/trading_platform_asset_listing_send.dart create mode 100644 lib/basic_api/generated/wallet_migration_receive.dart create mode 100644 lib/basic_api/generated/wallet_migration_send.dart create mode 100644 lib/services/connection/api_manager/mock_data/account/get_account_types_response.dart create mode 100644 lib/services/connection/api_manager/mock_data/account/new_account_wallet_response.dart create mode 100644 lib/services/connection/api_manager/mock_data/cashier/cashier_payments_response.dart create mode 100644 lib/services/connection/api_manager/mock_data/wallet_migration_response.dart create mode 100644 test/api/account/get_account_types/get_account_types_test.dart create mode 100644 test/api/account/new_account_wallet/new_account_wallet_test.dart create mode 100644 test/api/account/wallet_migration/wallet_migration_test.dart create mode 100644 test/api/cashier/cashier_payments_test.dart diff --git a/lib/api/models/enums.dart b/lib/api/models/enums.dart index 388a6e1a2f..9e5ee5b304 100644 --- a/lib/api/models/enums.dart +++ b/lib/api/models/enums.dart @@ -319,7 +319,10 @@ enum ForgetStreamType { transaction, /// Website status - websiteStatus + websiteStatus, + + /// Cashier payments. + cashierPayments, } /// Contract types diff --git a/lib/api/response/authorize_response_result.dart b/lib/api/response/authorize_response_result.dart index 9e844223e2..555276e7f6 100644 --- a/lib/api/response/authorize_response_result.dart +++ b/lib/api/response/authorize_response_result.dart @@ -25,10 +25,8 @@ abstract class AuthorizeResponseModel { class AuthorizeResponse extends AuthorizeResponseModel { /// Initializes Authorize response class. const AuthorizeResponse({ - Authorize? authorize, - }) : super( - authorize: authorize, - ); + super.authorize, + }); /// Creates an instance from JSON. factory AuthorizeResponse.fromJson( @@ -93,17 +91,41 @@ class AuthorizeResponse extends AuthorizeResponseModel { ); } +/// AccountCategoryEnum mapper. +final Map accountCategoryEnumMapper = + { + "trading": AccountCategoryEnum.trading, + "wallet": AccountCategoryEnum.wallet, +}; + +/// AccountCategory Enum. +enum AccountCategoryEnum { + /// trading. + trading, + + /// wallet. + wallet, +} + /// PlatformEnum mapper. final Map platformEnumMapper = { - "deriv": PlatformEnum.deriv, + "derivez": PlatformEnum.derivez, + "dtrade": PlatformEnum.dtrade, + "dwallet": PlatformEnum.dwallet, "dxtrade": PlatformEnum.dxtrade, "mt5": PlatformEnum.mt5, }; /// Platform Enum. enum PlatformEnum { - /// deriv. - deriv, + /// derivez. + derivez, + + /// dtrade. + dtrade, + + /// dwallet. + dwallet, /// dxtrade. dxtrade, @@ -111,7 +133,6 @@ enum PlatformEnum { /// mt5. mt5, } - /// Authorize model class. abstract class AuthorizeModel { /// Initializes Authorize model class . @@ -125,14 +146,13 @@ abstract class AuthorizeModel { this.isVirtual, this.landingCompanyFullname, this.landingCompanyName, + this.linkedTo, this.localCurrencies, this.loginid, this.preferredLanguage, this.scopes, - this.trading, this.upgradeableLandingCompanies, this.userId, - this.wallet, }); /// List of accounts for current user. @@ -162,6 +182,9 @@ abstract class AuthorizeModel { /// Landing company shortcode the account belongs to. final String? landingCompanyName; + /// Details of the list of Trading accounts linked to the Wallet account. + final List? linkedTo; + /// Currencies in client's residence country final Map? localCurrencies; @@ -174,59 +197,34 @@ abstract class AuthorizeModel { /// Scopes available to the token. final List? scopes; - /// Details of the Trading account. - final AuthorizeTrading? trading; - /// List of landing company shortcodes the account can upgrade to. final List? upgradeableLandingCompanies; /// The internal user ID for this account. final int? userId; - - /// Details of the Wallet account. - final AuthorizeWallet? wallet; } /// Authorize class. class Authorize extends AuthorizeModel { /// Initializes Authorize class. const Authorize({ - List? accountList, - double? balance, - String? country, - String? currency, - String? email, - String? fullname, - bool? isVirtual, - String? landingCompanyFullname, - String? landingCompanyName, - Map? localCurrencies, - String? loginid, - String? preferredLanguage, - List? scopes, - AuthorizeTrading? trading, - List? upgradeableLandingCompanies, - int? userId, - AuthorizeWallet? wallet, - }) : super( - accountList: accountList, - balance: balance, - country: country, - currency: currency, - email: email, - fullname: fullname, - isVirtual: isVirtual, - landingCompanyFullname: landingCompanyFullname, - landingCompanyName: landingCompanyName, - localCurrencies: localCurrencies, - loginid: loginid, - preferredLanguage: preferredLanguage, - scopes: scopes, - trading: trading, - upgradeableLandingCompanies: upgradeableLandingCompanies, - userId: userId, - wallet: wallet, - ); + super.accountList, + super.balance, + super.country, + super.currency, + super.email, + super.fullname, + super.isVirtual, + super.landingCompanyFullname, + super.landingCompanyName, + super.linkedTo, + super.localCurrencies, + super.loginid, + super.preferredLanguage, + super.scopes, + super.upgradeableLandingCompanies, + super.userId, + }); /// Creates an instance from JSON. factory Authorize.fromJson(Map json) => Authorize( @@ -245,6 +243,13 @@ class Authorize extends AuthorizeModel { isVirtual: getBool(json['is_virtual']), landingCompanyFullname: json['landing_company_fullname'], landingCompanyName: json['landing_company_name'], + linkedTo: json['linked_to'] == null + ? null + : List.from( + json['linked_to']?.map( + (dynamic item) => AuthorizeLinkedToItem.fromJson(item), + ), + ), localCurrencies: json['local_currencies'] == null ? null : Map.fromEntries(json[ @@ -263,9 +268,6 @@ class Authorize extends AuthorizeModel { (dynamic item) => item, ), ), - trading: json['trading'] == null - ? null - : AuthorizeTrading.fromJson(json['trading']), upgradeableLandingCompanies: json['upgradeable_landing_companies'] == null ? null @@ -275,9 +277,6 @@ class Authorize extends AuthorizeModel { ), ), userId: json['user_id'], - wallet: json['wallet'] == null - ? null - : AuthorizeWallet.fromJson(json['wallet']), ); /// Converts an instance to JSON. @@ -299,6 +298,13 @@ class Authorize extends AuthorizeModel { resultMap['is_virtual'] = isVirtual; resultMap['landing_company_fullname'] = landingCompanyFullname; resultMap['landing_company_name'] = landingCompanyName; + if (linkedTo != null) { + resultMap['linked_to'] = linkedTo! + .map( + (AuthorizeLinkedToItem item) => item.toJson(), + ) + .toList(); + } resultMap['local_currencies'] = localCurrencies; resultMap['loginid'] = loginid; resultMap['preferred_language'] = preferredLanguage; @@ -309,9 +315,6 @@ class Authorize extends AuthorizeModel { ) .toList(); } - if (trading != null) { - resultMap['trading'] = trading!.toJson(); - } if (upgradeableLandingCompanies != null) { resultMap['upgradeable_landing_companies'] = upgradeableLandingCompanies! .map( @@ -320,9 +323,6 @@ class Authorize extends AuthorizeModel { .toList(); } resultMap['user_id'] = userId; - if (wallet != null) { - resultMap['wallet'] = wallet!.toJson(); - } return resultMap; } @@ -338,14 +338,13 @@ class Authorize extends AuthorizeModel { bool? isVirtual, String? landingCompanyFullname, String? landingCompanyName, + List? linkedTo, Map? localCurrencies, String? loginid, String? preferredLanguage, List? scopes, - AuthorizeTrading? trading, List? upgradeableLandingCompanies, int? userId, - AuthorizeWallet? wallet, }) => Authorize( accountList: accountList ?? this.accountList, @@ -358,22 +357,21 @@ class Authorize extends AuthorizeModel { landingCompanyFullname: landingCompanyFullname ?? this.landingCompanyFullname, landingCompanyName: landingCompanyName ?? this.landingCompanyName, + linkedTo: linkedTo ?? this.linkedTo, localCurrencies: localCurrencies ?? this.localCurrencies, loginid: loginid ?? this.loginid, preferredLanguage: preferredLanguage ?? this.preferredLanguage, scopes: scopes ?? this.scopes, - trading: trading ?? this.trading, upgradeableLandingCompanies: upgradeableLandingCompanies ?? this.upgradeableLandingCompanies, userId: userId ?? this.userId, - wallet: wallet ?? this.wallet, ); } - /// Account list item model class. abstract class AccountListItemModel { /// Initializes Account list item model class . const AccountListItemModel({ + this.accountCategory, this.accountType, this.createdAt, this.currency, @@ -381,11 +379,13 @@ abstract class AccountListItemModel { this.isDisabled, this.isVirtual, this.landingCompanyName, + this.linkedTo, this.loginid, - this.trading, - this.wallet, }); + /// Account category. + final AccountCategoryEnum? accountCategory; + /// Account type. final String? accountType; @@ -407,46 +407,35 @@ abstract class AccountListItemModel { /// Landing company shortcode the account belongs to. final String? landingCompanyName; + /// Details of the list of Trading accounts linked to the Wallet account. + final List? linkedTo; + /// The account ID of specified account. final String? loginid; - - /// Details of the Trading account. - final Trading? trading; - - /// Details of the Wallet account. - final Wallet? wallet; } /// Account list item class. class AccountListItem extends AccountListItemModel { /// Initializes Account list item class. const AccountListItem({ - String? accountType, - DateTime? createdAt, - String? currency, - DateTime? excludedUntil, - bool? isDisabled, - bool? isVirtual, - String? landingCompanyName, - String? loginid, - Trading? trading, - Wallet? wallet, - }) : super( - accountType: accountType, - createdAt: createdAt, - currency: currency, - excludedUntil: excludedUntil, - isDisabled: isDisabled, - isVirtual: isVirtual, - landingCompanyName: landingCompanyName, - loginid: loginid, - trading: trading, - wallet: wallet, - ); + super.accountCategory, + super.accountType, + super.createdAt, + super.currency, + super.excludedUntil, + super.isDisabled, + super.isVirtual, + super.landingCompanyName, + super.linkedTo, + super.loginid, + }); /// Creates an instance from JSON. factory AccountListItem.fromJson(Map json) => AccountListItem( + accountCategory: json['account_category'] == null + ? null + : accountCategoryEnumMapper[json['account_category']], accountType: json['account_type'], createdAt: getDateTime(json['created_at']), currency: json['currency'], @@ -454,16 +443,24 @@ class AccountListItem extends AccountListItemModel { isDisabled: getBool(json['is_disabled']), isVirtual: getBool(json['is_virtual']), landingCompanyName: json['landing_company_name'], + linkedTo: json['linked_to'] == null + ? null + : List.from( + json['linked_to']?.map( + (dynamic item) => LinkedToItem.fromJson(item), + ), + ), loginid: json['loginid'], - trading: - json['trading'] == null ? null : Trading.fromJson(json['trading']), - wallet: json['wallet'] == null ? null : Wallet.fromJson(json['wallet']), ); /// Converts an instance to JSON. Map toJson() { final Map resultMap = {}; + resultMap['account_category'] = accountCategoryEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == accountCategory) + .key; resultMap['account_type'] = accountType; resultMap['created_at'] = getSecondsSinceEpochDateTime(createdAt); resultMap['currency'] = currency; @@ -471,19 +468,21 @@ class AccountListItem extends AccountListItemModel { resultMap['is_disabled'] = isDisabled; resultMap['is_virtual'] = isVirtual; resultMap['landing_company_name'] = landingCompanyName; - resultMap['loginid'] = loginid; - if (trading != null) { - resultMap['trading'] = trading!.toJson(); - } - if (wallet != null) { - resultMap['wallet'] = wallet!.toJson(); + if (linkedTo != null) { + resultMap['linked_to'] = linkedTo! + .map( + (LinkedToItem item) => item.toJson(), + ) + .toList(); } + resultMap['loginid'] = loginid; return resultMap; } /// Creates a copy of instance with given parameters. AccountListItem copyWith({ + AccountCategoryEnum? accountCategory, String? accountType, DateTime? createdAt, String? currency, @@ -491,11 +490,11 @@ class AccountListItem extends AccountListItemModel { bool? isDisabled, bool? isVirtual, String? landingCompanyName, + List? linkedTo, String? loginid, - Trading? trading, - Wallet? wallet, }) => AccountListItem( + accountCategory: accountCategory ?? this.accountCategory, accountType: accountType ?? this.accountType, createdAt: createdAt ?? this.createdAt, currency: currency ?? this.currency, @@ -503,279 +502,91 @@ class AccountListItem extends AccountListItemModel { isDisabled: isDisabled ?? this.isDisabled, isVirtual: isVirtual ?? this.isVirtual, landingCompanyName: landingCompanyName ?? this.landingCompanyName, - loginid: loginid ?? this.loginid, - trading: trading ?? this.trading, - wallet: wallet ?? this.wallet, - ); -} - -/// Trading model class. -abstract class TradingModel { - /// Initializes Trading model class . - const TradingModel({ - this.linkedTo, - }); - - /// Details of the Wallet account linked to the Trading account. - final List? linkedTo; -} - -/// Trading class. -class Trading extends TradingModel { - /// Initializes Trading class. - const Trading({ - List? linkedTo, - }) : super( - linkedTo: linkedTo, - ); - - /// Creates an instance from JSON. - factory Trading.fromJson(Map json) => Trading( - linkedTo: json['linked_to'] == null - ? null - : List.from( - json['linked_to']?.map( - (dynamic item) => LinkedToItem.fromJson(item), - ), - ), - ); - - /// Converts an instance to JSON. - Map toJson() { - final Map resultMap = {}; - - if (linkedTo != null) { - resultMap['linked_to'] = linkedTo! - .map( - (LinkedToItem item) => item.toJson(), - ) - .toList(); - } - - return resultMap; - } - - /// Creates a copy of instance with given parameters. - Trading copyWith({ - List? linkedTo, - }) => - Trading( linkedTo: linkedTo ?? this.linkedTo, + loginid: loginid ?? this.loginid, ); } - /// Linked to item model class. abstract class LinkedToItemModel { /// Initializes Linked to item model class . const LinkedToItemModel({ - this.accountId, - this.balance, - this.currency, - this.paymentMethod, + this.loginid, + this.platform, }); - /// Wallet account ID. - final String? accountId; - - /// Wallet account balance. - final String? balance; - - /// Wallet account currency. - final String? currency; + /// Account ID. + final String? loginid; - /// Wallet account payment method. - final String? paymentMethod; + /// Account platform name. + final PlatformEnum? platform; } /// Linked to item class. class LinkedToItem extends LinkedToItemModel { /// Initializes Linked to item class. const LinkedToItem({ - String? accountId, - String? balance, - String? currency, - String? paymentMethod, - }) : super( - accountId: accountId, - balance: balance, - currency: currency, - paymentMethod: paymentMethod, - ); + super.loginid, + super.platform, + }); /// Creates an instance from JSON. factory LinkedToItem.fromJson(Map json) => LinkedToItem( - accountId: json['account_id'], - balance: json['balance'], - currency: json['currency'], - paymentMethod: json['payment_method'], + loginid: json['loginid'], + platform: json['platform'] == null + ? null + : platformEnumMapper[json['platform']], ); /// Converts an instance to JSON. Map toJson() { final Map resultMap = {}; - resultMap['account_id'] = accountId; - resultMap['balance'] = balance; - resultMap['currency'] = currency; - resultMap['payment_method'] = paymentMethod; + resultMap['loginid'] = loginid; + resultMap['platform'] = platformEnumMapper.entries + .firstWhere( + (MapEntry entry) => entry.value == platform) + .key; return resultMap; } /// Creates a copy of instance with given parameters. LinkedToItem copyWith({ - String? accountId, - String? balance, - String? currency, - String? paymentMethod, + String? loginid, + PlatformEnum? platform, }) => LinkedToItem( - accountId: accountId ?? this.accountId, - balance: balance ?? this.balance, - currency: currency ?? this.currency, - paymentMethod: paymentMethod ?? this.paymentMethod, - ); -} - -/// Wallet model class. -abstract class WalletModel { - /// Initializes Wallet model class . - const WalletModel({ - this.accountId, - this.balance, - this.currency, - this.linkedTo, - this.paymentMethod, - }); - - /// Wallet account ID. - final String? accountId; - - /// Wallet account balance. - final double? balance; - - /// Wallet account currency. - final String? currency; - - /// Details of the list of Trading accounts linked to the Wallet account. - final List? linkedTo; - - /// Wallet account payment method. - final String? paymentMethod; -} - -/// Wallet class. -class Wallet extends WalletModel { - /// Initializes Wallet class. - const Wallet({ - String? accountId, - double? balance, - String? currency, - List? linkedTo, - String? paymentMethod, - }) : super( - accountId: accountId, - balance: balance, - currency: currency, - linkedTo: linkedTo, - paymentMethod: paymentMethod, - ); - - /// Creates an instance from JSON. - factory Wallet.fromJson(Map json) => Wallet( - accountId: json['account_id'], - balance: getDouble(json['balance']), - currency: json['currency'], - linkedTo: json['linked_to'] == null - ? null - : List.from( - json['linked_to']?.map( - (dynamic item) => WalletLinkedToItem.fromJson(item), - ), - ), - paymentMethod: json['payment_method'], - ); - - /// Converts an instance to JSON. - Map toJson() { - final Map resultMap = {}; - - resultMap['account_id'] = accountId; - resultMap['balance'] = balance; - resultMap['currency'] = currency; - if (linkedTo != null) { - resultMap['linked_to'] = linkedTo! - .map( - (WalletLinkedToItem item) => item.toJson(), - ) - .toList(); - } - resultMap['payment_method'] = paymentMethod; - - return resultMap; - } - - /// Creates a copy of instance with given parameters. - Wallet copyWith({ - String? accountId, - double? balance, - String? currency, - List? linkedTo, - String? paymentMethod, - }) => - Wallet( - accountId: accountId ?? this.accountId, - balance: balance ?? this.balance, - currency: currency ?? this.currency, - linkedTo: linkedTo ?? this.linkedTo, - paymentMethod: paymentMethod ?? this.paymentMethod, + loginid: loginid ?? this.loginid, + platform: platform ?? this.platform, ); } - -/// Wallet linked to item model class. -abstract class WalletLinkedToItemModel { - /// Initializes Wallet linked to item model class . - const WalletLinkedToItemModel({ - this.accountId, - this.balance, - this.currency, +/// Authorize linked to item model class. +abstract class AuthorizeLinkedToItemModel { + /// Initializes Authorize linked to item model class . + const AuthorizeLinkedToItemModel({ + this.loginid, this.platform, }); - /// Trading account ID. - final String? accountId; - - /// Trading account balance. - final String? balance; - - /// Trading account currency. - final String? currency; + /// Account ID. + final String? loginid; - /// Trading account platform name. + /// Account platform name. final PlatformEnum? platform; } -/// Wallet linked to item class. -class WalletLinkedToItem extends WalletLinkedToItemModel { - /// Initializes Wallet linked to item class. - const WalletLinkedToItem({ - String? accountId, - String? balance, - String? currency, - PlatformEnum? platform, - }) : super( - accountId: accountId, - balance: balance, - currency: currency, - platform: platform, - ); +/// Authorize linked to item class. +class AuthorizeLinkedToItem extends AuthorizeLinkedToItemModel { + /// Initializes Authorize linked to item class. + const AuthorizeLinkedToItem({ + super.loginid, + super.platform, + }); /// Creates an instance from JSON. - factory WalletLinkedToItem.fromJson(Map json) => - WalletLinkedToItem( - accountId: json['account_id'], - balance: json['balance'], - currency: json['currency'], + factory AuthorizeLinkedToItem.fromJson(Map json) => + AuthorizeLinkedToItem( + loginid: json['loginid'], platform: json['platform'] == null ? null : platformEnumMapper[json['platform']], @@ -785,9 +596,7 @@ class WalletLinkedToItem extends WalletLinkedToItemModel { Map toJson() { final Map resultMap = {}; - resultMap['account_id'] = accountId; - resultMap['balance'] = balance; - resultMap['currency'] = currency; + resultMap['loginid'] = loginid; resultMap['platform'] = platformEnumMapper.entries .firstWhere( (MapEntry entry) => entry.value == platform) @@ -797,20 +606,15 @@ class WalletLinkedToItem extends WalletLinkedToItemModel { } /// Creates a copy of instance with given parameters. - WalletLinkedToItem copyWith({ - String? accountId, - String? balance, - String? currency, + AuthorizeLinkedToItem copyWith({ + String? loginid, PlatformEnum? platform, }) => - WalletLinkedToItem( - accountId: accountId ?? this.accountId, - balance: balance ?? this.balance, - currency: currency ?? this.currency, + AuthorizeLinkedToItem( + loginid: loginid ?? this.loginid, platform: platform ?? this.platform, ); } - /// Local currencies property model class. abstract class LocalCurrenciesPropertyModel { /// Initializes Local currencies property model class . @@ -826,10 +630,8 @@ abstract class LocalCurrenciesPropertyModel { class LocalCurrenciesProperty extends LocalCurrenciesPropertyModel { /// Initializes Local currencies property class. const LocalCurrenciesProperty({ - required int fractionalDigits, - }) : super( - fractionalDigits: fractionalDigits, - ); + required super.fractionalDigits, + }); /// Creates an instance from JSON. factory LocalCurrenciesProperty.fromJson(Map json) => @@ -854,308 +656,3 @@ class LocalCurrenciesProperty extends LocalCurrenciesPropertyModel { fractionalDigits: fractionalDigits ?? this.fractionalDigits, ); } - -/// Authorize trading model class. -abstract class AuthorizeTradingModel { - /// Initializes Authorize trading model class . - const AuthorizeTradingModel({ - this.linkedTo, - }); - - /// Details of the Wallet account linked to the Trading account. - final List? linkedTo; -} - -/// Authorize trading class. -class AuthorizeTrading extends AuthorizeTradingModel { - /// Initializes Authorize trading class. - const AuthorizeTrading({ - List? linkedTo, - }) : super( - linkedTo: linkedTo, - ); - - /// Creates an instance from JSON. - factory AuthorizeTrading.fromJson(Map json) => - AuthorizeTrading( - linkedTo: json['linked_to'] == null - ? null - : List.from( - json['linked_to']?.map( - (dynamic item) => TradingLinkedToItem.fromJson(item), - ), - ), - ); - - /// Converts an instance to JSON. - Map toJson() { - final Map resultMap = {}; - - if (linkedTo != null) { - resultMap['linked_to'] = linkedTo! - .map( - (TradingLinkedToItem item) => item.toJson(), - ) - .toList(); - } - - return resultMap; - } - - /// Creates a copy of instance with given parameters. - AuthorizeTrading copyWith({ - List? linkedTo, - }) => - AuthorizeTrading( - linkedTo: linkedTo ?? this.linkedTo, - ); -} - -/// Trading linked to item model class. -abstract class TradingLinkedToItemModel { - /// Initializes Trading linked to item model class . - const TradingLinkedToItemModel({ - this.accountId, - this.balance, - this.currency, - this.paymentMethod, - }); - - /// Wallet account ID. - final String? accountId; - - /// Wallet account balance. - final String? balance; - - /// Wallet account currency. - final String? currency; - - /// Wallet account payment method. - final String? paymentMethod; -} - -/// Trading linked to item class. -class TradingLinkedToItem extends TradingLinkedToItemModel { - /// Initializes Trading linked to item class. - const TradingLinkedToItem({ - String? accountId, - String? balance, - String? currency, - String? paymentMethod, - }) : super( - accountId: accountId, - balance: balance, - currency: currency, - paymentMethod: paymentMethod, - ); - - /// Creates an instance from JSON. - factory TradingLinkedToItem.fromJson(Map json) => - TradingLinkedToItem( - accountId: json['account_id'], - balance: json['balance'], - currency: json['currency'], - paymentMethod: json['payment_method'], - ); - - /// Converts an instance to JSON. - Map toJson() { - final Map resultMap = {}; - - resultMap['account_id'] = accountId; - resultMap['balance'] = balance; - resultMap['currency'] = currency; - resultMap['payment_method'] = paymentMethod; - - return resultMap; - } - - /// Creates a copy of instance with given parameters. - TradingLinkedToItem copyWith({ - String? accountId, - String? balance, - String? currency, - String? paymentMethod, - }) => - TradingLinkedToItem( - accountId: accountId ?? this.accountId, - balance: balance ?? this.balance, - currency: currency ?? this.currency, - paymentMethod: paymentMethod ?? this.paymentMethod, - ); -} - -/// Authorize wallet model class. -abstract class AuthorizeWalletModel { - /// Initializes Authorize wallet model class . - const AuthorizeWalletModel({ - this.accountId, - this.balance, - this.currency, - this.linkedTo, - this.paymentMethod, - }); - - /// Wallet account ID. - final String? accountId; - - /// Wallet account balance. - final double? balance; - - /// Wallet account currency. - final String? currency; - - /// Details of the list of Trading accounts linked to the Wallet account. - final List? linkedTo; - - /// Wallet account payment method. - final String? paymentMethod; -} - -/// Authorize wallet class. -class AuthorizeWallet extends AuthorizeWalletModel { - /// Initializes Authorize wallet class. - const AuthorizeWallet({ - String? accountId, - double? balance, - String? currency, - List? linkedTo, - String? paymentMethod, - }) : super( - accountId: accountId, - balance: balance, - currency: currency, - linkedTo: linkedTo, - paymentMethod: paymentMethod, - ); - - /// Creates an instance from JSON. - factory AuthorizeWallet.fromJson(Map json) => - AuthorizeWallet( - accountId: json['account_id'], - balance: getDouble(json['balance']), - currency: json['currency'], - linkedTo: json['linked_to'] == null - ? null - : List.from( - json['linked_to']?.map( - (dynamic item) => WalletLinkedToItem8.fromJson(item), - ), - ), - paymentMethod: json['payment_method'], - ); - - /// Converts an instance to JSON. - Map toJson() { - final Map resultMap = {}; - - resultMap['account_id'] = accountId; - resultMap['balance'] = balance; - resultMap['currency'] = currency; - if (linkedTo != null) { - resultMap['linked_to'] = linkedTo! - .map( - (WalletLinkedToItem8 item) => item.toJson(), - ) - .toList(); - } - resultMap['payment_method'] = paymentMethod; - - return resultMap; - } - - /// Creates a copy of instance with given parameters. - AuthorizeWallet copyWith({ - String? accountId, - double? balance, - String? currency, - List? linkedTo, - String? paymentMethod, - }) => - AuthorizeWallet( - accountId: accountId ?? this.accountId, - balance: balance ?? this.balance, - currency: currency ?? this.currency, - linkedTo: linkedTo ?? this.linkedTo, - paymentMethod: paymentMethod ?? this.paymentMethod, - ); -} - -/// Wallet linked to item8 model class. -abstract class WalletLinkedToItem8Model { - /// Initializes Wallet linked to item8 model class . - const WalletLinkedToItem8Model({ - this.accountId, - this.balance, - this.currency, - this.platform, - }); - - /// Trading account ID. - final String? accountId; - - /// Trading account balance. - final String? balance; - - /// Trading account currency. - final String? currency; - - /// Trading account platform name. - final PlatformEnum? platform; -} - -/// Wallet linked to item8 class. -class WalletLinkedToItem8 extends WalletLinkedToItem8Model { - /// Initializes Wallet linked to item8 class. - const WalletLinkedToItem8({ - String? accountId, - String? balance, - String? currency, - PlatformEnum? platform, - }) : super( - accountId: accountId, - balance: balance, - currency: currency, - platform: platform, - ); - - /// Creates an instance from JSON. - factory WalletLinkedToItem8.fromJson(Map json) => - WalletLinkedToItem8( - accountId: json['account_id'], - balance: json['balance'], - currency: json['currency'], - platform: json['platform'] == null - ? null - : platformEnumMapper[json['platform']], - ); - - /// Converts an instance to JSON. - Map toJson() { - final Map resultMap = {}; - - resultMap['account_id'] = accountId; - resultMap['balance'] = balance; - resultMap['currency'] = currency; - resultMap['platform'] = platformEnumMapper.entries - .firstWhere( - (MapEntry entry) => entry.value == platform) - .key; - - return resultMap; - } - - /// Creates a copy of instance with given parameters. - WalletLinkedToItem8 copyWith({ - String? accountId, - String? balance, - String? currency, - PlatformEnum? platform, - }) => - WalletLinkedToItem8( - accountId: accountId ?? this.accountId, - balance: balance ?? this.balance, - currency: currency ?? this.currency, - platform: platform ?? this.platform, - ); -} diff --git a/lib/api/response/cashier_payments_response_extended.dart b/lib/api/response/cashier_payments_response_extended.dart new file mode 100644 index 0000000000..335f3cd5fc --- /dev/null +++ b/lib/api/response/cashier_payments_response_extended.dart @@ -0,0 +1,99 @@ +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/api/models/enums.dart'; +import 'package:flutter_deriv_api/basic_api/generated/api.dart'; +import 'package:flutter_deriv_api/basic_api/response.dart'; +import 'package:flutter_deriv_api/helpers/helpers.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; +import 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart'; + +import 'cashier_payments_response_result.dart'; +import 'forget_all_response_result.dart'; +import 'forget_response_result.dart'; + +/// The extended version of the [CashierPaymentsResponse] class to implement +/// the API call methods. +class CashierPaymentsResponseExtended extends CashierPaymentsResponse { + static final BaseAPI _api = Injector()(); + + /// Fetches the cashier payments. + static Future fetchCashierPayments({ + required CashierPaymentsRequest request, + }) async { + final CashierPaymentsReceive response = await _api.call(request: request); + + checkException( + response: response, + exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => + BaseAPIException(baseExceptionModel: baseExceptionModel), + ); + + return CashierPaymentsResponse.fromJson( + response.cashierPayments, + response.subscription, + ); + } + + /// Subscribes to the bought contract state specified in [ProposalOpenContractRequest] + /// + /// Throws a [BaseAPIException] if API response contains an error + static Stream subscribeCashierPayment( + CashierPaymentsRequest request, { + RequestCompareFunction? comparePredicate, + }) => + _api + .subscribe(request: request, comparePredicate: comparePredicate)! + .map( + (Response response) { + checkException( + response: response, + exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => + BaseAPIException(baseExceptionModel: baseExceptionModel), + ); + + return response is CashierPaymentsReceive + ? CashierPaymentsResponse.fromJson( + response.cashierPayments, + response.subscription, + ) + : null; + }, + ); + + /// Unsubscribes from cashier payments subscription. + /// + /// Throws a [BaseAPIException] if API response contains an error + Future unsubscribeCashierPayments() async { + if (subscription == null) { + return null; + } + + final ForgetReceive response = + await _api.unsubscribe(subscriptionId: subscription!.id); + + checkException( + response: response, + exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => + BaseAPIException(baseExceptionModel: baseExceptionModel), + ); + + return ForgetResponse.fromJson(response.forget); + } + + /// Unsubscribes all open contract subscriptions. + /// + /// Throws a [BaseAPIException] if API response contains an error + static Future unsubscribeAllCashierPayments() async { + final ForgetAllReceive response = await _api.unsubscribeAll( + method: ForgetStreamType.cashierPayments, + ); + + checkException( + response: response, + exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => + BaseAPIException(baseExceptionModel: baseExceptionModel), + ); + + return ForgetAllResponse.fromJson(response.forgetAll); + } +} diff --git a/lib/api/response/cashier_payments_response_result.dart b/lib/api/response/cashier_payments_response_result.dart index 944787f374..5a7266a601 100644 --- a/lib/api/response/cashier_payments_response_result.dart +++ b/lib/api/response/cashier_payments_response_result.dart @@ -23,12 +23,9 @@ abstract class CashierPaymentsResponseModel { class CashierPaymentsResponse extends CashierPaymentsResponseModel { /// Initializes Cashier payments response class. const CashierPaymentsResponse({ - CashierPayments? cashierPayments, - Subscription? subscription, - }) : super( - cashierPayments: cashierPayments, - subscription: subscription, - ); + super.cashierPayments, + super.subscription, + }); /// Creates an instance from JSON. factory CashierPaymentsResponse.fromJson( @@ -80,6 +77,8 @@ final Map statusCodeEnumMapper = "PERFORMING_BLOCKCHAIN_TXN": StatusCodeEnum.performingBlockchainTxn, "PROCESSING": StatusCodeEnum.processing, "REJECTED": StatusCodeEnum.rejected, + "REVERTED": StatusCodeEnum.reverted, + "REVERTING": StatusCodeEnum.reverting, "SENT": StatusCodeEnum.sent, "VERIFIED": StatusCodeEnum.verified, }; @@ -110,6 +109,12 @@ enum StatusCodeEnum { /// REJECTED. rejected, + /// REVERTED. + reverted, + + /// REVERTING. + reverting, + /// SENT. sent, @@ -147,10 +152,8 @@ abstract class CashierPaymentsModel { class CashierPayments extends CashierPaymentsModel { /// Initializes Cashier payments class. const CashierPayments({ - List? crypto, - }) : super( - crypto: crypto, - ); + super.crypto, + }); /// Creates an instance from JSON. factory CashierPayments.fromJson(Map json) => @@ -198,6 +201,7 @@ abstract class CryptoItemModel { required this.addressUrl, required this.addressHash, this.amount, + this.confirmations, this.isValidToCancel, this.submitDate, this.transactionHash, @@ -210,7 +214,7 @@ abstract class CryptoItemModel { /// The status message of the transaction. final String statusMessage; - /// The status code of the transaction. Possible values for **deposit:** `PENDING|CONFIRMED|ERROR`, possible values for **withdrawal:** `LOCKED|VERIFIED|REJECTED|PERFORMING_BLOCKCHAIN_TXN|PROCESSING|SENT|ERROR|CANCELLED`. + /// The status code of the transaction. Possible values for **deposit:** `PENDING|CONFIRMED|ERROR`, possible values for **withdrawal:** `LOCKED|VERIFIED|REJECTED|PERFORMING_BLOCKCHAIN_TXN|PROCESSING|SENT|ERROR|CANCELLED|REVERTING|REVERTED`. final StatusCodeEnum statusCode; /// The unique identifier for the transaction. @@ -225,6 +229,9 @@ abstract class CryptoItemModel { /// [Optional] The transaction amount. Not present when deposit transaction still unconfirmed. final double? amount; + /// [Optional] The number of confirmations for pending deposits or withdrawals + final int? confirmations; + /// [Optional] Boolean value: `true` or `false`, indicating whether the transaction can be cancelled. Only applicable for `withdrawal` transactions. final bool? isValidToCancel; @@ -242,30 +249,19 @@ abstract class CryptoItemModel { class CryptoItem extends CryptoItemModel { /// Initializes Crypto item class. const CryptoItem({ - required String addressHash, - required String addressUrl, - required String id, - required StatusCodeEnum statusCode, - required String statusMessage, - required TransactionTypeEnum transactionType, - double? amount, - bool? isValidToCancel, - DateTime? submitDate, - String? transactionHash, - String? transactionUrl, - }) : super( - addressHash: addressHash, - addressUrl: addressUrl, - id: id, - statusCode: statusCode, - statusMessage: statusMessage, - transactionType: transactionType, - amount: amount, - isValidToCancel: isValidToCancel, - submitDate: submitDate, - transactionHash: transactionHash, - transactionUrl: transactionUrl, - ); + required super.addressHash, + required super.addressUrl, + required super.id, + required super.statusCode, + required super.statusMessage, + required super.transactionType, + super.amount, + super.confirmations, + super.isValidToCancel, + super.submitDate, + super.transactionHash, + super.transactionUrl, + }); /// Creates an instance from JSON. factory CryptoItem.fromJson(Map json) => CryptoItem( @@ -276,6 +272,7 @@ class CryptoItem extends CryptoItemModel { statusMessage: json['status_message'], transactionType: transactionTypeEnumMapper[json['transaction_type']]!, amount: getDouble(json['amount']), + confirmations: json['confirmations'], isValidToCancel: getBool(json['is_valid_to_cancel']), submitDate: getDateTime(json['submit_date']), transactionHash: json['transaction_hash'], @@ -299,6 +296,7 @@ class CryptoItem extends CryptoItemModel { entry.value == transactionType) .key; resultMap['amount'] = amount; + resultMap['confirmations'] = confirmations; resultMap['is_valid_to_cancel'] = isValidToCancel; resultMap['submit_date'] = getSecondsSinceEpochDateTime(submitDate); resultMap['transaction_hash'] = transactionHash; @@ -316,6 +314,7 @@ class CryptoItem extends CryptoItemModel { String? statusMessage, TransactionTypeEnum? transactionType, double? amount, + int? confirmations, bool? isValidToCancel, DateTime? submitDate, String? transactionHash, @@ -329,6 +328,7 @@ class CryptoItem extends CryptoItemModel { statusMessage: statusMessage ?? this.statusMessage, transactionType: transactionType ?? this.transactionType, amount: amount ?? this.amount, + confirmations: confirmations ?? this.confirmations, isValidToCancel: isValidToCancel ?? this.isValidToCancel, submitDate: submitDate ?? this.submitDate, transactionHash: transactionHash ?? this.transactionHash, @@ -350,10 +350,8 @@ abstract class SubscriptionModel { class Subscription extends SubscriptionModel { /// Initializes Subscription class. const Subscription({ - required String id, - }) : super( - id: id, - ); + required super.id, + }); /// Creates an instance from JSON. factory Subscription.fromJson(Map json) => Subscription( diff --git a/lib/api/response/get_account_types_response_extended.dart b/lib/api/response/get_account_types_response_extended.dart new file mode 100644 index 0000000000..6d18f1ead6 --- /dev/null +++ b/lib/api/response/get_account_types_response_extended.dart @@ -0,0 +1,28 @@ +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/api/response/get_account_status_response_result.dart'; +import 'package:flutter_deriv_api/api/response/get_account_types_response_result.dart'; +import 'package:flutter_deriv_api/basic_api/generated/api.dart'; +import 'package:flutter_deriv_api/helpers/helpers.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; + +/// The extended version of the [GetAccountStatusResponse] class to implement +/// the API call methods. +class GetAccountTypesResponseExtended extends GetAccountStatusResponse { + static final BaseAPI _api = Injector()(); + + /// Gets the account types user can register for. + static Future fetchAccountTypes({ + required GetAccountTypesRequest request, + }) async { + final GetAccountTypesReceive response = await _api.call(request: request); + + checkException( + response: response, + exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => + BaseAPIException(baseExceptionModel: baseExceptionModel), + ); + + return GetAccountTypesResponse.fromJson(response.getAccountTypes); + } +} diff --git a/lib/api/response/get_account_types_response_result.dart b/lib/api/response/get_account_types_response_result.dart index 96f3811415..e582c3a1a7 100644 --- a/lib/api/response/get_account_types_response_result.dart +++ b/lib/api/response/get_account_types_response_result.dart @@ -19,10 +19,8 @@ abstract class GetAccountTypesResponseModel { class GetAccountTypesResponse extends GetAccountTypesResponseModel { /// Initializes Get account types response class. const GetAccountTypesResponse({ - GetAccountTypes? getAccountTypes, - }) : super( - getAccountTypes: getAccountTypes, - ); + super.getAccountTypes, + }); /// Creates an instance from JSON. factory GetAccountTypesResponse.fromJson( @@ -59,408 +57,184 @@ abstract class GetAccountTypesModel { const GetAccountTypesModel({ required this.wallet, required this.trading, - this.binary, - this.derivx, - this.mt5, }); - /// Details of the wallet accounts. - final Wallet wallet; - - /// Trading accounts can trade in the Deriv website and apps - final Trading trading; - - /// Traditional accounts of binary.com - final Binary? binary; - - /// The accuonts created for the DerivX platform - final Derivx? derivx; + /// Wallet accounts types that are available to create or link to + final Map wallet; - /// Accounts created for the MT5 platfrom - final Mt5? mt5; + /// Trading account types that are available to create or link to + final Map trading; } /// Get account types class. class GetAccountTypes extends GetAccountTypesModel { /// Initializes Get account types class. const GetAccountTypes({ - required Trading trading, - required Wallet wallet, - Binary? binary, - Derivx? derivx, - Mt5? mt5, - }) : super( - trading: trading, - wallet: wallet, - binary: binary, - derivx: derivx, - mt5: mt5, - ); + required super.trading, + required super.wallet, + }); /// Creates an instance from JSON. factory GetAccountTypes.fromJson(Map json) => GetAccountTypes( - trading: Trading.fromJson(json['trading']), - wallet: Wallet.fromJson(json['wallet']), - binary: json['binary'] == null ? null : Binary.fromJson(json['binary']), - derivx: json['derivx'] == null ? null : Derivx.fromJson(json['derivx']), - mt5: json['mt5'] == null ? null : Mt5.fromJson(json['mt5']), + trading: Map.fromEntries(json['trading'] + .entries + .map>( + (MapEntry entry) => + MapEntry( + entry.key, TradingProperty.fromJson(entry.value)))), + wallet: Map.fromEntries(json['wallet'] + .entries + .map>( + (MapEntry entry) => + MapEntry( + entry.key, WalletProperty.fromJson(entry.value)))), ); /// Converts an instance to JSON. Map toJson() { final Map resultMap = {}; - resultMap['trading'] = trading.toJson(); - - resultMap['wallet'] = wallet.toJson(); - - if (binary != null) { - resultMap['binary'] = binary!.toJson(); - } - if (derivx != null) { - resultMap['derivx'] = derivx!.toJson(); - } - if (mt5 != null) { - resultMap['mt5'] = mt5!.toJson(); - } + resultMap['trading'] = trading; + resultMap['wallet'] = wallet; return resultMap; } /// Creates a copy of instance with given parameters. GetAccountTypes copyWith({ - Trading? trading, - Wallet? wallet, - Binary? binary, - Derivx? derivx, - Mt5? mt5, + Map? trading, + Map? wallet, }) => GetAccountTypes( trading: trading ?? this.trading, wallet: wallet ?? this.wallet, - binary: binary ?? this.binary, - derivx: derivx ?? this.derivx, - mt5: mt5 ?? this.mt5, - ); -} -/// Trading model class. -abstract class TradingModel { - /// Initializes Trading model class . - const TradingModel({ - required this.real, - required this.demo, - }); - - /// Real trading acocounts - final Map real; - - /// Demo trading account - final Map demo; -} - -/// Trading class. -class Trading extends TradingModel { - /// Initializes Trading class. - const Trading({ - required Map demo, - required Map real, - }) : super( - demo: demo, - real: real, - ); - - /// Creates an instance from JSON. - factory Trading.fromJson(Map json) => Trading( - demo: json['demo'], - real: json['real'], - ); - - /// Converts an instance to JSON. - Map toJson() { - final Map resultMap = {}; - - resultMap['demo'] = demo; - resultMap['real'] = real; - - return resultMap; - } - - /// Creates a copy of instance with given parameters. - Trading copyWith({ - Map? demo, - Map? real, - }) => - Trading( - demo: demo ?? this.demo, - real: real ?? this.real, ); } -/// Wallet model class. -abstract class WalletModel { - /// Initializes Wallet model class . - const WalletModel({ - required this.paymentagentClient, - required this.paymentagent, - required this.p2p, - required this.fiat, - required this.demo, - required this.crypto, - required this.affiliate, +/// Trading property model class. +abstract class TradingPropertyModel { + /// Initializes Trading property model class . + const TradingPropertyModel({ + required this.linkableWalletTypes, + required this.linkableToDifferentCurrency, + required this.allowedWalletCurrencies, }); - /// Can receive funds from a payment agent - final Map paymentagentClient; - - /// Can act as a payment agent to other clients - final Map paymentagent; - - /// Can buy/sell using P2P exchanges - final Map p2p; - - /// Can deposit and withdraw through the primary cashier - final Map fiat; + /// Wallet types that this trading account can be linked to. + final List linkableWalletTypes; - /// Demo wallets, linkable to demo accounts only - final Map demo; + /// Can this trading account linked to another currency after opening + final bool linkableToDifferentCurrency; - /// Can deposit and withdraw through the crypto-cashier - final Map crypto; - - /// Can receive affiliate commissions - final Map affiliate; + /// Wallet currencies allowed for this trading account + final List allowedWalletCurrencies; } -/// Wallet class. -class Wallet extends WalletModel { - /// Initializes Wallet class. - const Wallet({ - required Map affiliate, - required Map crypto, - required Map demo, - required Map fiat, - required Map p2p, - required Map paymentagent, - required Map paymentagentClient, - }) : super( - affiliate: affiliate, - crypto: crypto, - demo: demo, - fiat: fiat, - p2p: p2p, - paymentagent: paymentagent, - paymentagentClient: paymentagentClient, - ); - - /// Creates an instance from JSON. - factory Wallet.fromJson(Map json) => Wallet( - affiliate: json['affiliate'], - crypto: json['crypto'], - demo: json['demo'], - fiat: json['fiat'], - p2p: json['p2p'], - paymentagent: json['paymentagent'], - paymentagentClient: json['paymentagent_client'], - ); - - /// Converts an instance to JSON. - Map toJson() { - final Map resultMap = {}; - - resultMap['affiliate'] = affiliate; - resultMap['crypto'] = crypto; - resultMap['demo'] = demo; - resultMap['fiat'] = fiat; - resultMap['p2p'] = p2p; - resultMap['paymentagent'] = paymentagent; - resultMap['paymentagent_client'] = paymentagentClient; - - return resultMap; - } - - /// Creates a copy of instance with given parameters. - Wallet copyWith({ - Map? affiliate, - Map? crypto, - Map? demo, - Map? fiat, - Map? p2p, - Map? paymentagent, - Map? paymentagentClient, - }) => - Wallet( - affiliate: affiliate ?? this.affiliate, - crypto: crypto ?? this.crypto, - demo: demo ?? this.demo, - fiat: fiat ?? this.fiat, - p2p: p2p ?? this.p2p, - paymentagent: paymentagent ?? this.paymentagent, - paymentagentClient: paymentagentClient ?? this.paymentagentClient, - ); -} -/// Binary model class. -abstract class BinaryModel { - /// Initializes Binary model class . - const BinaryModel({ - required this.real, - required this.demo, +/// Trading property class. +class TradingProperty extends TradingPropertyModel { + /// Initializes Trading property class. + const TradingProperty({ + required super.allowedWalletCurrencies, + required super.linkableToDifferentCurrency, + required super.linkableWalletTypes, }); - /// Real acocount - final Map real; - - /// Demo account - final Map demo; -} - -/// Binary class. -class Binary extends BinaryModel { - /// Initializes Binary class. - const Binary({ - required Map demo, - required Map real, - }) : super( - demo: demo, - real: real, - ); - /// Creates an instance from JSON. - factory Binary.fromJson(Map json) => Binary( - demo: json['demo'], - real: json['real'], + factory TradingProperty.fromJson(Map json) => + TradingProperty( + allowedWalletCurrencies: List.from( + json['allowed_wallet_currencies'].map( + (dynamic item) => item, + ), + ), + linkableToDifferentCurrency: + getBool(json['linkable_to_different_currency'])!, + linkableWalletTypes: List.from( + json['linkable_wallet_types'].map( + (dynamic item) => item, + ), + ), ); /// Converts an instance to JSON. Map toJson() { final Map resultMap = {}; - resultMap['demo'] = demo; - resultMap['real'] = real; + resultMap['allowed_wallet_currencies'] = allowedWalletCurrencies + .map( + (String item) => item, + ) + .toList(); - return resultMap; - } - - /// Creates a copy of instance with given parameters. - Binary copyWith({ - Map? demo, - Map? real, - }) => - Binary( - demo: demo ?? this.demo, - real: real ?? this.real, - ); -} -/// Derivx model class. -abstract class DerivxModel { - /// Initializes Derivx model class . - const DerivxModel({ - required this.real, - required this.demo, - }); - - /// Real acocount - final Map real; - - /// Demo account - final Map demo; -} - -/// Derivx class. -class Derivx extends DerivxModel { - /// Initializes Derivx class. - const Derivx({ - required Map demo, - required Map real, - }) : super( - demo: demo, - real: real, - ); - - /// Creates an instance from JSON. - factory Derivx.fromJson(Map json) => Derivx( - demo: json['demo'], - real: json['real'], - ); - - /// Converts an instance to JSON. - Map toJson() { - final Map resultMap = {}; - - resultMap['demo'] = demo; - resultMap['real'] = real; + resultMap['linkable_to_different_currency'] = linkableToDifferentCurrency; + resultMap['linkable_wallet_types'] = linkableWalletTypes + .map( + (String item) => item, + ) + .toList(); return resultMap; } /// Creates a copy of instance with given parameters. - Derivx copyWith({ - Map? demo, - Map? real, + TradingProperty copyWith({ + List? allowedWalletCurrencies, + bool? linkableToDifferentCurrency, + List? linkableWalletTypes, }) => - Derivx( - demo: demo ?? this.demo, - real: real ?? this.real, + TradingProperty( + allowedWalletCurrencies: + allowedWalletCurrencies ?? this.allowedWalletCurrencies, + linkableToDifferentCurrency: + linkableToDifferentCurrency ?? this.linkableToDifferentCurrency, + linkableWalletTypes: linkableWalletTypes ?? this.linkableWalletTypes, ); } -/// Mt5 model class. -abstract class Mt5Model { - /// Initializes Mt5 model class . - const Mt5Model({ - required this.gaming, - required this.financial, - required this.demo, +/// Wallet property model class. +abstract class WalletPropertyModel { + /// Initializes Wallet property model class . + const WalletPropertyModel({ + required this.currencies, }); - /// MT5 trading with synthetic indices - final Map gaming; - - /// MT5 trading with finacial indices - final Map financial; - - /// Demo account - final Map demo; + /// Allowed currencies for creating accounts of this type; used or disallowed currencies are not listed. + final List currencies; } -/// Mt5 class. -class Mt5 extends Mt5Model { - /// Initializes Mt5 class. - const Mt5({ - required Map demo, - required Map financial, - required Map gaming, - }) : super( - demo: demo, - financial: financial, - gaming: gaming, - ); +/// Wallet property class. +class WalletProperty extends WalletPropertyModel { + /// Initializes Wallet property class. + const WalletProperty({ + required super.currencies, + }); /// Creates an instance from JSON. - factory Mt5.fromJson(Map json) => Mt5( - demo: json['demo'], - financial: json['financial'], - gaming: json['gaming'], + factory WalletProperty.fromJson(Map json) => WalletProperty( + currencies: List.from( + json['currencies'].map( + (dynamic item) => item, + ), + ), ); /// Converts an instance to JSON. Map toJson() { final Map resultMap = {}; - resultMap['demo'] = demo; - resultMap['financial'] = financial; - resultMap['gaming'] = gaming; + resultMap['currencies'] = currencies + .map( + (String item) => item, + ) + .toList(); return resultMap; } /// Creates a copy of instance with given parameters. - Mt5 copyWith({ - Map? demo, - Map? financial, - Map? gaming, + WalletProperty copyWith({ + List? currencies, }) => - Mt5( - demo: demo ?? this.demo, - financial: financial ?? this.financial, - gaming: gaming ?? this.gaming, + WalletProperty( + currencies: currencies ?? this.currencies, ); } diff --git a/lib/api/response/get_financial_assessment_response_result.dart b/lib/api/response/get_financial_assessment_response_result.dart index e19869c19e..0829e6d906 100644 --- a/lib/api/response/get_financial_assessment_response_result.dart +++ b/lib/api/response/get_financial_assessment_response_result.dart @@ -26,10 +26,8 @@ class GetFinancialAssessmentResponse extends GetFinancialAssessmentResponseModel { /// Initializes Get financial assessment response class. const GetFinancialAssessmentResponse({ - GetFinancialAssessment? getFinancialAssessment, - }) : super( - getFinancialAssessment: getFinancialAssessment, - ); + super.getFinancialAssessment, + }); /// Creates an instance from JSON. factory GetFinancialAssessmentResponse.fromJson( @@ -84,7 +82,6 @@ class GetFinancialAssessmentResponse getFinancialAssessment ?? this.getFinancialAssessment, ); } - /// Get financial assessment model class. abstract class GetFinancialAssessmentModel { /// Initializes Get financial assessment model class . @@ -92,7 +89,10 @@ abstract class GetFinancialAssessmentModel { this.accountTurnover, this.binaryOptionsTradingExperience, this.binaryOptionsTradingFrequency, + this.cfdExperience, + this.cfdFrequency, this.cfdScore, + this.cfdTradingDefinition, this.cfdTradingExperience, this.cfdTradingFrequency, this.commoditiesTradingExperience, @@ -107,16 +107,23 @@ abstract class GetFinancialAssessmentModel { this.incomeSource, this.indicesTradingExperience, this.indicesTradingFrequency, + this.leverageImpactTrading, + this.leverageTradingHighRiskStopLoss, this.netIncome, this.occupation, this.otherDerivativesTradingExperience, this.otherDerivativesTradingFrequency, this.otherInstrumentsTradingExperience, this.otherInstrumentsTradingFrequency, + this.requiredInitialMargin, + this.riskTolerance, + this.sourceOfExperience, this.sourceOfWealth, this.stocksTradingExperience, this.stocksTradingFrequency, this.totalScore, + this.tradingExperienceFinancialInstruments, + this.tradingFrequencyFinancialInstruments, this.tradingScore, }); @@ -129,9 +136,18 @@ abstract class GetFinancialAssessmentModel { /// Binary options trading frequency final String? binaryOptionsTradingFrequency; + /// How much experience do you have in CFD trading? + final String? cfdExperience; + + /// How many CFD trades have you placed in the past 12 months? + final String? cfdFrequency; + /// CFD Score final int? cfdScore; + /// In your understanding, CFD trading allows you to: + final String? cfdTradingDefinition; + /// CFDs trading experience final String? cfdTradingExperience; @@ -174,6 +190,12 @@ abstract class GetFinancialAssessmentModel { /// Indices trading frequency final String? indicesTradingFrequency; + /// How does leverage affect CFD trading? + final String? leverageImpactTrading; + + /// Leverage trading is high-risk, so it's a good idea to use risk management features such as stop loss. Stop loss allows you to + final String? leverageTradingHighRiskStopLoss; + /// Net Annual Income final String? netIncome; @@ -192,6 +214,15 @@ abstract class GetFinancialAssessmentModel { /// Trading frequency in other financial instruments final String? otherInstrumentsTradingFrequency; + /// When would you be required to pay an initial margin? + final String? requiredInitialMargin; + + /// Do you understand that you could potentially lose 100% of the money you use to trade? + final String? riskTolerance; + + /// How much knowledge and experience do you have in relation to online trading? + final String? sourceOfExperience; + /// Source of wealth final String? sourceOfWealth; @@ -204,6 +235,12 @@ abstract class GetFinancialAssessmentModel { /// Total Score final int? totalScore; + /// How much experience do you have with other financial instruments? + final String? tradingExperienceFinancialInstruments; + + /// How many trades have you placed with other financial instruments in the past 12 months? + final String? tradingFrequencyFinancialInstruments; + /// Trading Experience Score final int? tradingScore; } @@ -212,66 +249,46 @@ abstract class GetFinancialAssessmentModel { class GetFinancialAssessment extends GetFinancialAssessmentModel { /// Initializes Get financial assessment class. const GetFinancialAssessment({ - String? accountTurnover, - String? binaryOptionsTradingExperience, - String? binaryOptionsTradingFrequency, - int? cfdScore, - String? cfdTradingExperience, - String? cfdTradingFrequency, - String? commoditiesTradingExperience, - String? commoditiesTradingFrequency, - String? educationLevel, - String? employmentIndustry, - String? employmentStatus, - String? estimatedWorth, - int? financialInformationScore, - String? forexTradingExperience, - String? forexTradingFrequency, - String? incomeSource, - String? indicesTradingExperience, - String? indicesTradingFrequency, - String? netIncome, - String? occupation, - String? otherDerivativesTradingExperience, - String? otherDerivativesTradingFrequency, - String? otherInstrumentsTradingExperience, - String? otherInstrumentsTradingFrequency, - String? sourceOfWealth, - String? stocksTradingExperience, - String? stocksTradingFrequency, - int? totalScore, - int? tradingScore, - }) : super( - accountTurnover: accountTurnover, - binaryOptionsTradingExperience: binaryOptionsTradingExperience, - binaryOptionsTradingFrequency: binaryOptionsTradingFrequency, - cfdScore: cfdScore, - cfdTradingExperience: cfdTradingExperience, - cfdTradingFrequency: cfdTradingFrequency, - commoditiesTradingExperience: commoditiesTradingExperience, - commoditiesTradingFrequency: commoditiesTradingFrequency, - educationLevel: educationLevel, - employmentIndustry: employmentIndustry, - employmentStatus: employmentStatus, - estimatedWorth: estimatedWorth, - financialInformationScore: financialInformationScore, - forexTradingExperience: forexTradingExperience, - forexTradingFrequency: forexTradingFrequency, - incomeSource: incomeSource, - indicesTradingExperience: indicesTradingExperience, - indicesTradingFrequency: indicesTradingFrequency, - netIncome: netIncome, - occupation: occupation, - otherDerivativesTradingExperience: otherDerivativesTradingExperience, - otherDerivativesTradingFrequency: otherDerivativesTradingFrequency, - otherInstrumentsTradingExperience: otherInstrumentsTradingExperience, - otherInstrumentsTradingFrequency: otherInstrumentsTradingFrequency, - sourceOfWealth: sourceOfWealth, - stocksTradingExperience: stocksTradingExperience, - stocksTradingFrequency: stocksTradingFrequency, - totalScore: totalScore, - tradingScore: tradingScore, - ); + super.accountTurnover, + super.binaryOptionsTradingExperience, + super.binaryOptionsTradingFrequency, + super.cfdExperience, + super.cfdFrequency, + super.cfdScore, + super.cfdTradingDefinition, + super.cfdTradingExperience, + super.cfdTradingFrequency, + super.commoditiesTradingExperience, + super.commoditiesTradingFrequency, + super.educationLevel, + super.employmentIndustry, + super.employmentStatus, + super.estimatedWorth, + super.financialInformationScore, + super.forexTradingExperience, + super.forexTradingFrequency, + super.incomeSource, + super.indicesTradingExperience, + super.indicesTradingFrequency, + super.leverageImpactTrading, + super.leverageTradingHighRiskStopLoss, + super.netIncome, + super.occupation, + super.otherDerivativesTradingExperience, + super.otherDerivativesTradingFrequency, + super.otherInstrumentsTradingExperience, + super.otherInstrumentsTradingFrequency, + super.requiredInitialMargin, + super.riskTolerance, + super.sourceOfExperience, + super.sourceOfWealth, + super.stocksTradingExperience, + super.stocksTradingFrequency, + super.totalScore, + super.tradingExperienceFinancialInstruments, + super.tradingFrequencyFinancialInstruments, + super.tradingScore, + }); /// Creates an instance from JSON. factory GetFinancialAssessment.fromJson(Map json) => @@ -280,7 +297,10 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { binaryOptionsTradingExperience: json['binary_options_trading_experience'], binaryOptionsTradingFrequency: json['binary_options_trading_frequency'], + cfdExperience: json['cfd_experience'], + cfdFrequency: json['cfd_frequency'], cfdScore: json['cfd_score'], + cfdTradingDefinition: json['cfd_trading_definition'], cfdTradingExperience: json['cfd_trading_experience'], cfdTradingFrequency: json['cfd_trading_frequency'], commoditiesTradingExperience: json['commodities_trading_experience'], @@ -295,6 +315,9 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { incomeSource: json['income_source'], indicesTradingExperience: json['indices_trading_experience'], indicesTradingFrequency: json['indices_trading_frequency'], + leverageImpactTrading: json['leverage_impact_trading'], + leverageTradingHighRiskStopLoss: + json['leverage_trading_high_risk_stop_loss'], netIncome: json['net_income'], occupation: json['occupation'], otherDerivativesTradingExperience: @@ -305,10 +328,17 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { json['other_instruments_trading_experience'], otherInstrumentsTradingFrequency: json['other_instruments_trading_frequency'], + requiredInitialMargin: json['required_initial_margin'], + riskTolerance: json['risk_tolerance'], + sourceOfExperience: json['source_of_experience'], sourceOfWealth: json['source_of_wealth'], stocksTradingExperience: json['stocks_trading_experience'], stocksTradingFrequency: json['stocks_trading_frequency'], totalScore: json['total_score'], + tradingExperienceFinancialInstruments: + json['trading_experience_financial_instruments'], + tradingFrequencyFinancialInstruments: + json['trading_frequency_financial_instruments'], tradingScore: json['trading_score'], ); @@ -321,7 +351,10 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { binaryOptionsTradingExperience; resultMap['binary_options_trading_frequency'] = binaryOptionsTradingFrequency; + resultMap['cfd_experience'] = cfdExperience; + resultMap['cfd_frequency'] = cfdFrequency; resultMap['cfd_score'] = cfdScore; + resultMap['cfd_trading_definition'] = cfdTradingDefinition; resultMap['cfd_trading_experience'] = cfdTradingExperience; resultMap['cfd_trading_frequency'] = cfdTradingFrequency; resultMap['commodities_trading_experience'] = commoditiesTradingExperience; @@ -336,6 +369,9 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { resultMap['income_source'] = incomeSource; resultMap['indices_trading_experience'] = indicesTradingExperience; resultMap['indices_trading_frequency'] = indicesTradingFrequency; + resultMap['leverage_impact_trading'] = leverageImpactTrading; + resultMap['leverage_trading_high_risk_stop_loss'] = + leverageTradingHighRiskStopLoss; resultMap['net_income'] = netIncome; resultMap['occupation'] = occupation; resultMap['other_derivatives_trading_experience'] = @@ -346,10 +382,17 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { otherInstrumentsTradingExperience; resultMap['other_instruments_trading_frequency'] = otherInstrumentsTradingFrequency; + resultMap['required_initial_margin'] = requiredInitialMargin; + resultMap['risk_tolerance'] = riskTolerance; + resultMap['source_of_experience'] = sourceOfExperience; resultMap['source_of_wealth'] = sourceOfWealth; resultMap['stocks_trading_experience'] = stocksTradingExperience; resultMap['stocks_trading_frequency'] = stocksTradingFrequency; resultMap['total_score'] = totalScore; + resultMap['trading_experience_financial_instruments'] = + tradingExperienceFinancialInstruments; + resultMap['trading_frequency_financial_instruments'] = + tradingFrequencyFinancialInstruments; resultMap['trading_score'] = tradingScore; return resultMap; @@ -360,7 +403,10 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { String? accountTurnover, String? binaryOptionsTradingExperience, String? binaryOptionsTradingFrequency, + String? cfdExperience, + String? cfdFrequency, int? cfdScore, + String? cfdTradingDefinition, String? cfdTradingExperience, String? cfdTradingFrequency, String? commoditiesTradingExperience, @@ -375,16 +421,23 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { String? incomeSource, String? indicesTradingExperience, String? indicesTradingFrequency, + String? leverageImpactTrading, + String? leverageTradingHighRiskStopLoss, String? netIncome, String? occupation, String? otherDerivativesTradingExperience, String? otherDerivativesTradingFrequency, String? otherInstrumentsTradingExperience, String? otherInstrumentsTradingFrequency, + String? requiredInitialMargin, + String? riskTolerance, + String? sourceOfExperience, String? sourceOfWealth, String? stocksTradingExperience, String? stocksTradingFrequency, int? totalScore, + String? tradingExperienceFinancialInstruments, + String? tradingFrequencyFinancialInstruments, int? tradingScore, }) => GetFinancialAssessment( @@ -393,7 +446,10 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { this.binaryOptionsTradingExperience, binaryOptionsTradingFrequency: binaryOptionsTradingFrequency ?? this.binaryOptionsTradingFrequency, + cfdExperience: cfdExperience ?? this.cfdExperience, + cfdFrequency: cfdFrequency ?? this.cfdFrequency, cfdScore: cfdScore ?? this.cfdScore, + cfdTradingDefinition: cfdTradingDefinition ?? this.cfdTradingDefinition, cfdTradingExperience: cfdTradingExperience ?? this.cfdTradingExperience, cfdTradingFrequency: cfdTradingFrequency ?? this.cfdTradingFrequency, commoditiesTradingExperience: @@ -415,6 +471,10 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { indicesTradingExperience ?? this.indicesTradingExperience, indicesTradingFrequency: indicesTradingFrequency ?? this.indicesTradingFrequency, + leverageImpactTrading: + leverageImpactTrading ?? this.leverageImpactTrading, + leverageTradingHighRiskStopLoss: leverageTradingHighRiskStopLoss ?? + this.leverageTradingHighRiskStopLoss, netIncome: netIncome ?? this.netIncome, occupation: occupation ?? this.occupation, otherDerivativesTradingExperience: otherDerivativesTradingExperience ?? @@ -425,12 +485,22 @@ class GetFinancialAssessment extends GetFinancialAssessmentModel { this.otherInstrumentsTradingExperience, otherInstrumentsTradingFrequency: otherInstrumentsTradingFrequency ?? this.otherInstrumentsTradingFrequency, + requiredInitialMargin: + requiredInitialMargin ?? this.requiredInitialMargin, + riskTolerance: riskTolerance ?? this.riskTolerance, + sourceOfExperience: sourceOfExperience ?? this.sourceOfExperience, sourceOfWealth: sourceOfWealth ?? this.sourceOfWealth, stocksTradingExperience: stocksTradingExperience ?? this.stocksTradingExperience, stocksTradingFrequency: stocksTradingFrequency ?? this.stocksTradingFrequency, totalScore: totalScore ?? this.totalScore, + tradingExperienceFinancialInstruments: + tradingExperienceFinancialInstruments ?? + this.tradingExperienceFinancialInstruments, + tradingFrequencyFinancialInstruments: + tradingFrequencyFinancialInstruments ?? + this.tradingFrequencyFinancialInstruments, tradingScore: tradingScore ?? this.tradingScore, ); } diff --git a/lib/api/response/get_limits_response_result.dart b/lib/api/response/get_limits_response_result.dart index b1c4217b4d..98c0e57a60 100644 --- a/lib/api/response/get_limits_response_result.dart +++ b/lib/api/response/get_limits_response_result.dart @@ -25,10 +25,8 @@ abstract class GetLimitsResponseModel { class GetLimitsResponse extends GetLimitsResponseModel { /// Initializes Get limits response class. const GetLimitsResponse({ - GetLimits? getLimits, - }) : super( - getLimits: getLimits, - ); + super.getLimits, + }); /// Creates an instance from JSON. factory GetLimitsResponse.fromJson( @@ -79,12 +77,12 @@ class GetLimitsResponse extends GetLimitsResponseModel { getLimits: getLimits ?? this.getLimits, ); } - /// Get limits model class. abstract class GetLimitsModel { /// Initializes Get limits model class . const GetLimitsModel({ this.accountBalance, + this.dailyCumulativeAmountTransfers, this.dailyTransfers, this.dailyTurnover, this.lifetimeLimit, @@ -103,6 +101,9 @@ abstract class GetLimitsModel { /// Maximum account cash balance final double? accountBalance; + /// Cumulative daily transfer limits + final Map? dailyCumulativeAmountTransfers; + /// Daily transfers final Map? dailyTransfers; @@ -147,40 +148,28 @@ abstract class GetLimitsModel { class GetLimits extends GetLimitsModel { /// Initializes Get limits class. const GetLimits({ - double? accountBalance, - Map? dailyTransfers, - double? dailyTurnover, - double? lifetimeLimit, - Map>? marketSpecific, - int? numOfDays, - double? numOfDaysLimit, - int? openPositions, - double? payout, - PayoutPerSymbol? payoutPerSymbol, - double? payoutPerSymbolAndContractType, - double? remainder, - double? withdrawalForXDaysMonetary, - double? withdrawalSinceInceptionMonetary, - }) : super( - accountBalance: accountBalance, - dailyTransfers: dailyTransfers, - dailyTurnover: dailyTurnover, - lifetimeLimit: lifetimeLimit, - marketSpecific: marketSpecific, - numOfDays: numOfDays, - numOfDaysLimit: numOfDaysLimit, - openPositions: openPositions, - payout: payout, - payoutPerSymbol: payoutPerSymbol, - payoutPerSymbolAndContractType: payoutPerSymbolAndContractType, - remainder: remainder, - withdrawalForXDaysMonetary: withdrawalForXDaysMonetary, - withdrawalSinceInceptionMonetary: withdrawalSinceInceptionMonetary, - ); + super.accountBalance, + super.dailyCumulativeAmountTransfers, + super.dailyTransfers, + super.dailyTurnover, + super.lifetimeLimit, + super.marketSpecific, + super.numOfDays, + super.numOfDaysLimit, + super.openPositions, + super.payout, + super.payoutPerSymbol, + super.payoutPerSymbolAndContractType, + super.remainder, + super.withdrawalForXDaysMonetary, + super.withdrawalSinceInceptionMonetary, + }); /// Creates an instance from JSON. factory GetLimits.fromJson(Map json) => GetLimits( accountBalance: getDouble(json['account_balance']), + dailyCumulativeAmountTransfers: + json['daily_cumulative_amount_transfers'], dailyTransfers: json['daily_transfers'], dailyTurnover: getDouble(json['daily_turnover']), lifetimeLimit: getDouble(json['lifetime_limit']), @@ -220,6 +209,8 @@ class GetLimits extends GetLimitsModel { final Map resultMap = {}; resultMap['account_balance'] = accountBalance; + resultMap['daily_cumulative_amount_transfers'] = + dailyCumulativeAmountTransfers; resultMap['daily_transfers'] = dailyTransfers; resultMap['daily_turnover'] = dailyTurnover; resultMap['lifetime_limit'] = lifetimeLimit; @@ -244,6 +235,7 @@ class GetLimits extends GetLimitsModel { /// Creates a copy of instance with given parameters. GetLimits copyWith({ double? accountBalance, + Map? dailyCumulativeAmountTransfers, Map? dailyTransfers, double? dailyTurnover, double? lifetimeLimit, @@ -260,6 +252,8 @@ class GetLimits extends GetLimitsModel { }) => GetLimits( accountBalance: accountBalance ?? this.accountBalance, + dailyCumulativeAmountTransfers: dailyCumulativeAmountTransfers ?? + this.dailyCumulativeAmountTransfers, dailyTransfers: dailyTransfers ?? this.dailyTransfers, dailyTurnover: dailyTurnover ?? this.dailyTurnover, lifetimeLimit: lifetimeLimit ?? this.lifetimeLimit, @@ -278,7 +272,6 @@ class GetLimits extends GetLimitsModel { this.withdrawalSinceInceptionMonetary, ); } - /// Market specific property item model class. abstract class MarketSpecificPropertyItemModel { /// Initializes Market specific property item model class . @@ -310,18 +303,12 @@ abstract class MarketSpecificPropertyItemModel { class MarketSpecificPropertyItem extends MarketSpecificPropertyItemModel { /// Initializes Market specific property item class. const MarketSpecificPropertyItem({ - String? level, - String? name, - double? payoutLimit, - String? profileName, - double? turnoverLimit, - }) : super( - level: level, - name: name, - payoutLimit: payoutLimit, - profileName: profileName, - turnoverLimit: turnoverLimit, - ); + super.level, + super.name, + super.payoutLimit, + super.profileName, + super.turnoverLimit, + }); /// Creates an instance from JSON. factory MarketSpecificPropertyItem.fromJson(Map json) => @@ -362,7 +349,6 @@ class MarketSpecificPropertyItem extends MarketSpecificPropertyItemModel { turnoverLimit: turnoverLimit ?? this.turnoverLimit, ); } - /// Payout per symbol model class. abstract class PayoutPerSymbolModel { /// Initializes Payout per symbol model class . @@ -382,12 +368,9 @@ abstract class PayoutPerSymbolModel { class PayoutPerSymbol extends PayoutPerSymbolModel { /// Initializes Payout per symbol class. const PayoutPerSymbol({ - double? atm, - NonAtm? nonAtm, - }) : super( - atm: atm, - nonAtm: nonAtm, - ); + super.atm, + super.nonAtm, + }); /// Creates an instance from JSON. factory PayoutPerSymbol.fromJson(Map json) => @@ -419,7 +402,6 @@ class PayoutPerSymbol extends PayoutPerSymbolModel { nonAtm: nonAtm ?? this.nonAtm, ); } - /// Non atm model class. abstract class NonAtmModel { /// Initializes Non atm model class . @@ -439,12 +421,9 @@ abstract class NonAtmModel { class NonAtm extends NonAtmModel { /// Initializes Non atm class. const NonAtm({ - double? lessThanSevenDays, - double? moreThanSevenDays, - }) : super( - lessThanSevenDays: lessThanSevenDays, - moreThanSevenDays: moreThanSevenDays, - ); + super.lessThanSevenDays, + super.moreThanSevenDays, + }); /// Creates an instance from JSON. factory NonAtm.fromJson(Map json) => NonAtm( diff --git a/lib/api/response/get_settings_response_result.dart b/lib/api/response/get_settings_response_result.dart index 4d9fde44a8..1489031c2d 100644 --- a/lib/api/response/get_settings_response_result.dart +++ b/lib/api/response/get_settings_response_result.dart @@ -28,10 +28,8 @@ abstract class GetSettingsResponseModel { class GetSettingsResponse extends GetSettingsResponseModel { /// Initializes Get settings response class. const GetSettingsResponse({ - GetSettings? getSettings, - }) : super( - getSettings: getSettings, - ); + super.getSettings, + }); /// Creates an instance from JSON. factory GetSettingsResponse.fromJson( @@ -132,6 +130,7 @@ class GetSettingsResponse extends GetSettingsResponseModel { allowCopiers: getSettings?.allowCopiers, citizen: getSettings?.citizen, dateOfBirth: getStringFromDateTime(getSettings?.dateOfBirth), + dxtradeUserException: getSettings?.dxtradeUserException, emailConsent: getSettings?.emailConsent, firstName: getSettings?.firstName, lastName: getSettings?.lastName, @@ -157,6 +156,34 @@ class GetSettingsResponse extends GetSettingsResponseModel { ); } +/// EmploymentStatusEnum mapper. +final Map employmentStatusEnumMapper = + { + "Employed": EmploymentStatusEnum.employed, + "Pensioner": EmploymentStatusEnum.pensioner, + "Self-Employed": EmploymentStatusEnum.selfEmployed, + "Student": EmploymentStatusEnum.student, + "Unemployed": EmploymentStatusEnum.unemployed, +}; + +/// EmploymentStatus Enum. +enum EmploymentStatusEnum { + /// Employed. + employed, + + /// Pensioner. + pensioner, + + /// Self-Employed. + selfEmployed, + + /// Student. + student, + + /// Unemployed. + unemployed, +} + /// Get settings model class. abstract class GetSettingsModel { /// Initializes Get settings model class . @@ -170,11 +197,14 @@ abstract class GetSettingsModel { this.allowCopiers, this.citizen, this.clientTncStatus, + this.coolingOffExpirationDate, this.country, this.countryCode, this.dateOfBirth, + this.dxtradeUserException, this.email, this.emailConsent, + this.employmentStatus, this.featureFlag, this.firstName, this.hasSecretAnswer, @@ -221,6 +251,9 @@ abstract class GetSettingsModel { /// Latest terms and conditions version accepted by client final String? clientTncStatus; + /// Cooldown expiration epoch date when a client fails appropriateness tests + final DateTime? coolingOffExpirationDate; + /// User Country (same as residence field) - deprecated final String? country; @@ -230,12 +263,18 @@ abstract class GetSettingsModel { /// Epoch of user's birthday (note: Only available for users who have at least one real account) final DateTime? dateOfBirth; + /// Boolean value `true` or `false`, indicating if user email belong to dxtrade exception list. + final bool? dxtradeUserException; + /// User Email final String? email; /// Boolean value `true` or `false`, indicating permission to use email address for any contact which may include marketing final bool? emailConsent; + /// Employment Status. + final EmploymentStatusEnum? employmentStatus; + /// Contains features that are enabled or disabled for this user final FeatureFlag? featureFlag; @@ -292,70 +331,41 @@ abstract class GetSettingsModel { class GetSettings extends GetSettingsModel { /// Initializes Get settings class. const GetSettings({ - String? accountOpeningReason, - String? addressCity, - String? addressLine1, - String? addressLine2, - String? addressPostcode, - String? addressState, - bool? allowCopiers, - String? citizen, - String? clientTncStatus, - String? country, - String? countryCode, - DateTime? dateOfBirth, - String? email, - bool? emailConsent, - FeatureFlag? featureFlag, - String? firstName, - bool? hasSecretAnswer, - List? immutableFields, - bool? isAuthenticatedPaymentAgent, - String? lastName, - bool? nonPepDeclaration, - String? phone, - String? placeOfBirth, - String? preferredLanguage, - bool? requestProfessionalStatus, - String? residence, - String? salutation, - String? taxIdentificationNumber, - String? taxResidence, - int? tradingHub, - String? userHash, - }) : super( - accountOpeningReason: accountOpeningReason, - addressCity: addressCity, - addressLine1: addressLine1, - addressLine2: addressLine2, - addressPostcode: addressPostcode, - addressState: addressState, - allowCopiers: allowCopiers, - citizen: citizen, - clientTncStatus: clientTncStatus, - country: country, - countryCode: countryCode, - dateOfBirth: dateOfBirth, - email: email, - emailConsent: emailConsent, - featureFlag: featureFlag, - firstName: firstName, - hasSecretAnswer: hasSecretAnswer, - immutableFields: immutableFields, - isAuthenticatedPaymentAgent: isAuthenticatedPaymentAgent, - lastName: lastName, - nonPepDeclaration: nonPepDeclaration, - phone: phone, - placeOfBirth: placeOfBirth, - preferredLanguage: preferredLanguage, - requestProfessionalStatus: requestProfessionalStatus, - residence: residence, - salutation: salutation, - taxIdentificationNumber: taxIdentificationNumber, - taxResidence: taxResidence, - tradingHub: tradingHub, - userHash: userHash, - ); + super.accountOpeningReason, + super.addressCity, + super.addressLine1, + super.addressLine2, + super.addressPostcode, + super.addressState, + super.allowCopiers, + super.citizen, + super.clientTncStatus, + super.coolingOffExpirationDate, + super.country, + super.countryCode, + super.dateOfBirth, + super.dxtradeUserException, + super.email, + super.emailConsent, + super.employmentStatus, + super.featureFlag, + super.firstName, + super.hasSecretAnswer, + super.immutableFields, + super.isAuthenticatedPaymentAgent, + super.lastName, + super.nonPepDeclaration, + super.phone, + super.placeOfBirth, + super.preferredLanguage, + super.requestProfessionalStatus, + super.residence, + super.salutation, + super.taxIdentificationNumber, + super.taxResidence, + super.tradingHub, + super.userHash, + }); /// Creates an instance from JSON. factory GetSettings.fromJson(Map json) => GetSettings( @@ -368,11 +378,17 @@ class GetSettings extends GetSettingsModel { allowCopiers: getBool(json['allow_copiers']), citizen: json['citizen'], clientTncStatus: json['client_tnc_status'], + coolingOffExpirationDate: + getDateTime(json['cooling_off_expiration_date']), country: json['country'], countryCode: json['country_code'], dateOfBirth: getDateTime(json['date_of_birth']), + dxtradeUserException: getBool(json['dxtrade_user_exception']), email: json['email'], emailConsent: getBool(json['email_consent']), + employmentStatus: json['employment_status'] == null + ? null + : employmentStatusEnumMapper[json['employment_status']], featureFlag: json['feature_flag'] == null ? null : FeatureFlag.fromJson(json['feature_flag']), @@ -414,11 +430,18 @@ class GetSettings extends GetSettingsModel { resultMap['allow_copiers'] = allowCopiers; resultMap['citizen'] = citizen; resultMap['client_tnc_status'] = clientTncStatus; + resultMap['cooling_off_expiration_date'] = + getSecondsSinceEpochDateTime(coolingOffExpirationDate); resultMap['country'] = country; resultMap['country_code'] = countryCode; resultMap['date_of_birth'] = getSecondsSinceEpochDateTime(dateOfBirth); + resultMap['dxtrade_user_exception'] = dxtradeUserException; resultMap['email'] = email; resultMap['email_consent'] = emailConsent; + resultMap['employment_status'] = employmentStatusEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == employmentStatus) + .key; if (featureFlag != null) { resultMap['feature_flag'] = featureFlag!.toJson(); } @@ -459,11 +482,14 @@ class GetSettings extends GetSettingsModel { bool? allowCopiers, String? citizen, String? clientTncStatus, + DateTime? coolingOffExpirationDate, String? country, String? countryCode, DateTime? dateOfBirth, + bool? dxtradeUserException, String? email, bool? emailConsent, + EmploymentStatusEnum? employmentStatus, FeatureFlag? featureFlag, String? firstName, bool? hasSecretAnswer, @@ -492,11 +518,15 @@ class GetSettings extends GetSettingsModel { allowCopiers: allowCopiers ?? this.allowCopiers, citizen: citizen ?? this.citizen, clientTncStatus: clientTncStatus ?? this.clientTncStatus, + coolingOffExpirationDate: + coolingOffExpirationDate ?? this.coolingOffExpirationDate, country: country ?? this.country, countryCode: countryCode ?? this.countryCode, dateOfBirth: dateOfBirth ?? this.dateOfBirth, + dxtradeUserException: dxtradeUserException ?? this.dxtradeUserException, email: email ?? this.email, emailConsent: emailConsent ?? this.emailConsent, + employmentStatus: employmentStatus ?? this.employmentStatus, featureFlag: featureFlag ?? this.featureFlag, firstName: firstName ?? this.firstName, hasSecretAnswer: hasSecretAnswer ?? this.hasSecretAnswer, @@ -535,10 +565,8 @@ abstract class FeatureFlagModel { class FeatureFlag extends FeatureFlagModel { /// Initializes Feature flag class. const FeatureFlag({ - bool? wallet, - }) : super( - wallet: wallet, - ); + super.wallet, + }); /// Creates an instance from JSON. factory FeatureFlag.fromJson(Map json) => FeatureFlag( diff --git a/lib/api/response/landing_company_details_response_result.dart b/lib/api/response/landing_company_details_response_result.dart index 78eed6e04b..aa9c3ccce2 100644 --- a/lib/api/response/landing_company_details_response_result.dart +++ b/lib/api/response/landing_company_details_response_result.dart @@ -18,10 +18,8 @@ abstract class LandingCompanyDetailsResponseModel { class LandingCompanyDetailsResponse extends LandingCompanyDetailsResponseModel { /// Initializes Landing company details response class. const LandingCompanyDetailsResponse({ - LandingCompanyDetails? landingCompanyDetails, - }) : super( - landingCompanyDetails: landingCompanyDetails, - ); + super.landingCompanyDetails, + }); /// Creates an instance from JSON. factory LandingCompanyDetailsResponse.fromJson( @@ -70,6 +68,7 @@ abstract class LandingCompanyDetailsModel { this.requirements, this.shortcode, this.supportProfessionalClient, + this.tinNotMandatory, }); /// Landing Company address. @@ -110,40 +109,30 @@ abstract class LandingCompanyDetailsModel { /// Flag that indicates whether the landing company supports professional accounts or not final bool? supportProfessionalClient; + + /// Flag that indicates whether tax identifier number is not mandatory for the current country and landing company. + final bool? tinNotMandatory; } /// Landing company details class. class LandingCompanyDetails extends LandingCompanyDetailsModel { /// Initializes Landing company details class. const LandingCompanyDetails({ - List? address, - Map? changeableFields, - String? country, - CurrencyConfig? currencyConfig, - bool? hasRealityCheck, - List? legalAllowedContractCategories, - List? legalAllowedCurrencies, - List? legalAllowedMarkets, - String? legalDefaultCurrency, - String? name, - Requirements? requirements, - String? shortcode, - bool? supportProfessionalClient, - }) : super( - address: address, - changeableFields: changeableFields, - country: country, - currencyConfig: currencyConfig, - hasRealityCheck: hasRealityCheck, - legalAllowedContractCategories: legalAllowedContractCategories, - legalAllowedCurrencies: legalAllowedCurrencies, - legalAllowedMarkets: legalAllowedMarkets, - legalDefaultCurrency: legalDefaultCurrency, - name: name, - requirements: requirements, - shortcode: shortcode, - supportProfessionalClient: supportProfessionalClient, - ); + super.address, + super.changeableFields, + super.country, + super.currencyConfig, + super.hasRealityCheck, + super.legalAllowedContractCategories, + super.legalAllowedCurrencies, + super.legalAllowedMarkets, + super.legalDefaultCurrency, + super.name, + super.requirements, + super.shortcode, + super.supportProfessionalClient, + super.tinNotMandatory, + }); /// Creates an instance from JSON. factory LandingCompanyDetails.fromJson(Map json) => @@ -190,6 +179,7 @@ class LandingCompanyDetails extends LandingCompanyDetailsModel { : Requirements.fromJson(json['requirements']), shortcode: json['shortcode'], supportProfessionalClient: getBool(json['support_professional_client']), + tinNotMandatory: getBool(json['tin_not_mandatory']), ); /// Converts an instance to JSON. @@ -238,6 +228,7 @@ class LandingCompanyDetails extends LandingCompanyDetailsModel { } resultMap['shortcode'] = shortcode; resultMap['support_professional_client'] = supportProfessionalClient; + resultMap['tin_not_mandatory'] = tinNotMandatory; return resultMap; } @@ -257,6 +248,7 @@ class LandingCompanyDetails extends LandingCompanyDetailsModel { Requirements? requirements, String? shortcode, bool? supportProfessionalClient, + bool? tinNotMandatory, }) => LandingCompanyDetails( address: address ?? this.address, @@ -275,6 +267,7 @@ class LandingCompanyDetails extends LandingCompanyDetailsModel { shortcode: shortcode ?? this.shortcode, supportProfessionalClient: supportProfessionalClient ?? this.supportProfessionalClient, + tinNotMandatory: tinNotMandatory ?? this.tinNotMandatory, ); } /// Currency config model class. @@ -312,20 +305,13 @@ abstract class CurrencyConfigModel { class CurrencyConfig extends CurrencyConfigModel { /// Initializes Currency config class. const CurrencyConfig({ - Map? commodities, - Map? cryptocurrency, - Map? forex, - Map? indices, - Market? market, - Map? syntheticIndex, - }) : super( - commodities: commodities, - cryptocurrency: cryptocurrency, - forex: forex, - indices: indices, - market: market, - syntheticIndex: syntheticIndex, - ); + super.commodities, + super.cryptocurrency, + super.forex, + super.indices, + super.market, + super.syntheticIndex, + }); /// Creates an instance from JSON. factory CurrencyConfig.fromJson(Map json) => CurrencyConfig( @@ -386,10 +372,8 @@ abstract class MarketModel { class Market extends MarketModel { /// Initializes Market class. const Market({ - Currency? currency, - }) : super( - currency: currency, - ); + super.currency, + }); /// Creates an instance from JSON. factory Market.fromJson(Map json) => Market( @@ -436,12 +420,9 @@ abstract class CurrencyModel { class Currency extends CurrencyModel { /// Initializes Currency class. const Currency({ - int? maxPayout, - int? minStake, - }) : super( - maxPayout: maxPayout, - minStake: minStake, - ); + super.maxPayout, + super.minStake, + }); /// Creates an instance from JSON. factory Currency.fromJson(Map json) => Currency( @@ -496,16 +477,11 @@ abstract class RequirementsModel { class Requirements extends RequirementsModel { /// Initializes Requirements class. const Requirements({ - AfterFirstDeposit? afterFirstDeposit, - Compliance? compliance, - List? signup, - List? withdrawal, - }) : super( - afterFirstDeposit: afterFirstDeposit, - compliance: compliance, - signup: signup, - withdrawal: withdrawal, - ); + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); /// Creates an instance from JSON. factory Requirements.fromJson(Map json) => Requirements( @@ -588,10 +564,8 @@ abstract class AfterFirstDepositModel { class AfterFirstDeposit extends AfterFirstDepositModel { /// Initializes After first deposit class. const AfterFirstDeposit({ - List? financialAssessment, - }) : super( - financialAssessment: financialAssessment, - ); + super.financialAssessment, + }); /// Creates an instance from JSON. factory AfterFirstDeposit.fromJson(Map json) => @@ -647,12 +621,9 @@ abstract class ComplianceModel { class Compliance extends ComplianceModel { /// Initializes Compliance class. const Compliance({ - List? mt5, - List? taxInformation, - }) : super( - mt5: mt5, - taxInformation: taxInformation, - ); + super.mt5, + super.taxInformation, + }); /// Creates an instance from JSON. factory Compliance.fromJson(Map json) => Compliance( diff --git a/lib/api/response/landing_company_response_result.dart b/lib/api/response/landing_company_response_result.dart index 2c5434b3b5..009547c9ae 100644 --- a/lib/api/response/landing_company_response_result.dart +++ b/lib/api/response/landing_company_response_result.dart @@ -28,10 +28,8 @@ abstract class LandingCompanyResponseModel { class LandingCompanyResponse extends LandingCompanyResponseModel { /// Initializes Landing company response class. const LandingCompanyResponse({ - LandingCompany? landingCompany, - }) : super( - landingCompany: landingCompany, - ); + super.landingCompany, + }); /// Creates an instance from JSON. factory LandingCompanyResponse.fromJson( @@ -132,7 +130,6 @@ enum StandardEnum { /// none. none, } - /// Landing company model class. abstract class LandingCompanyModel { /// Initializes Landing company model class . @@ -140,6 +137,7 @@ abstract class LandingCompanyModel { this.addressParseable, this.allCompany, this.config, + this.ctrader, this.derivez, this.dxtradeAllCompany, this.dxtradeFinancialCompany, @@ -147,12 +145,12 @@ abstract class LandingCompanyModel { this.financialCompany, this.forbiddenPostcodePattern, this.gamingCompany, - this.gamstopCompany, this.id, this.isIdvSupported, this.lcToOpenMfAccount, this.minimumAge, this.mt5AgeVerification, + this.mtAllCompany, this.mtFinancialCompany, this.mtGamingCompany, this.name, @@ -176,6 +174,9 @@ abstract class LandingCompanyModel { /// Config structure with document types ,taxRequired ,tin format details. final Map? config; + /// Available CTrader accounts. + final Ctrader? ctrader; + /// Available DerivEZ accounts. final Derivez? derivez; @@ -197,9 +198,6 @@ abstract class LandingCompanyModel { /// Landing Company for gaming contracts (Synthetic Indices) final GamingCompany? gamingCompany; - /// Gamestop company details. - final List? gamstopCompany; - /// Country code final String? id; @@ -215,6 +213,9 @@ abstract class LandingCompanyModel { /// Flag to indicate if mt5 age verification detail. final bool? mt5AgeVerification; + /// Landing Company for MT5 standard combined all Synthetic and financial, currently has Financial as subtype. + final MtAllCompany? mtAllCompany; + /// Landing Company for MT5 financial contracts (all except Synthetic Indices), currently divided into Financial STP, Financial (standard) as subtypes. final MtFinancialCompany? mtFinancialCompany; @@ -256,65 +257,36 @@ abstract class LandingCompanyModel { class LandingCompany extends LandingCompanyModel { /// Initializes Landing company class. const LandingCompany({ - bool? addressParseable, - AllCompanyEnum? allCompany, - Map? config, - Derivez? derivez, - DxtradeAllCompany? dxtradeAllCompany, - DxtradeFinancialCompany? dxtradeFinancialCompany, - DxtradeGamingCompany? dxtradeGamingCompany, - FinancialCompany? financialCompany, - String? forbiddenPostcodePattern, - GamingCompany? gamingCompany, - List? gamstopCompany, - String? id, - bool? isIdvSupported, - String? lcToOpenMfAccount, - int? minimumAge, - bool? mt5AgeVerification, - MtFinancialCompany? mtFinancialCompany, - MtGamingCompany? mtGamingCompany, - String? name, - bool? needSetMaxTurnoverLimit, - bool? noProvince, - bool? requireAddressPostcode, - bool? requireAgeVerifiedForSynthetic, - bool? requirePoi, - bool? requireVerificationWhenNotAgeVerified, - bool? skipDepositVerification, - bool? ukgcFundsProtection, - String? virtualCompany, - }) : super( - addressParseable: addressParseable, - allCompany: allCompany, - config: config, - derivez: derivez, - dxtradeAllCompany: dxtradeAllCompany, - dxtradeFinancialCompany: dxtradeFinancialCompany, - dxtradeGamingCompany: dxtradeGamingCompany, - financialCompany: financialCompany, - forbiddenPostcodePattern: forbiddenPostcodePattern, - gamingCompany: gamingCompany, - gamstopCompany: gamstopCompany, - id: id, - isIdvSupported: isIdvSupported, - lcToOpenMfAccount: lcToOpenMfAccount, - minimumAge: minimumAge, - mt5AgeVerification: mt5AgeVerification, - mtFinancialCompany: mtFinancialCompany, - mtGamingCompany: mtGamingCompany, - name: name, - needSetMaxTurnoverLimit: needSetMaxTurnoverLimit, - noProvince: noProvince, - requireAddressPostcode: requireAddressPostcode, - requireAgeVerifiedForSynthetic: requireAgeVerifiedForSynthetic, - requirePoi: requirePoi, - requireVerificationWhenNotAgeVerified: - requireVerificationWhenNotAgeVerified, - skipDepositVerification: skipDepositVerification, - ukgcFundsProtection: ukgcFundsProtection, - virtualCompany: virtualCompany, - ); + super.addressParseable, + super.allCompany, + super.config, + super.ctrader, + super.derivez, + super.dxtradeAllCompany, + super.dxtradeFinancialCompany, + super.dxtradeGamingCompany, + super.financialCompany, + super.forbiddenPostcodePattern, + super.gamingCompany, + super.id, + super.isIdvSupported, + super.lcToOpenMfAccount, + super.minimumAge, + super.mt5AgeVerification, + super.mtAllCompany, + super.mtFinancialCompany, + super.mtGamingCompany, + super.name, + super.needSetMaxTurnoverLimit, + super.noProvince, + super.requireAddressPostcode, + super.requireAgeVerifiedForSynthetic, + super.requirePoi, + super.requireVerificationWhenNotAgeVerified, + super.skipDepositVerification, + super.ukgcFundsProtection, + super.virtualCompany, + }); /// Creates an instance from JSON. factory LandingCompany.fromJson(Map json) => LandingCompany( @@ -323,6 +295,8 @@ class LandingCompany extends LandingCompanyModel { ? null : allCompanyEnumMapper[json['all_company']], config: json['config'], + ctrader: + json['ctrader'] == null ? null : Ctrader.fromJson(json['ctrader']), derivez: json['derivez'] == null ? null : Derivez.fromJson(json['derivez']), dxtradeAllCompany: json['dxtrade_all_company'] == null @@ -342,18 +316,14 @@ class LandingCompany extends LandingCompanyModel { gamingCompany: json['gaming_company'] == null ? null : GamingCompany.fromJson(json['gaming_company']), - gamstopCompany: json['gamstop_company'] == null - ? null - : List.from( - json['gamstop_company']?.map( - (dynamic item) => item, - ), - ), id: json['id'], isIdvSupported: getBool(json['is_idv_supported']), lcToOpenMfAccount: json['lc_to_open_mf_account'], minimumAge: json['minimum_age'], mt5AgeVerification: getBool(json['mt5_age_verification']), + mtAllCompany: json['mt_all_company'] == null + ? null + : MtAllCompany.fromJson(json['mt_all_company']), mtFinancialCompany: json['mt_financial_company'] == null ? null : MtFinancialCompany.fromJson(json['mt_financial_company']), @@ -384,6 +354,9 @@ class LandingCompany extends LandingCompanyModel { entry.value == allCompany) .key; resultMap['config'] = config; + if (ctrader != null) { + resultMap['ctrader'] = ctrader!.toJson(); + } if (derivez != null) { resultMap['derivez'] = derivez!.toJson(); } @@ -404,18 +377,14 @@ class LandingCompany extends LandingCompanyModel { if (gamingCompany != null) { resultMap['gaming_company'] = gamingCompany!.toJson(); } - if (gamstopCompany != null) { - resultMap['gamstop_company'] = gamstopCompany! - .map( - (String item) => item, - ) - .toList(); - } resultMap['id'] = id; resultMap['is_idv_supported'] = isIdvSupported; resultMap['lc_to_open_mf_account'] = lcToOpenMfAccount; resultMap['minimum_age'] = minimumAge; resultMap['mt5_age_verification'] = mt5AgeVerification; + if (mtAllCompany != null) { + resultMap['mt_all_company'] = mtAllCompany!.toJson(); + } if (mtFinancialCompany != null) { resultMap['mt_financial_company'] = mtFinancialCompany!.toJson(); } @@ -443,6 +412,7 @@ class LandingCompany extends LandingCompanyModel { bool? addressParseable, AllCompanyEnum? allCompany, Map? config, + Ctrader? ctrader, Derivez? derivez, DxtradeAllCompany? dxtradeAllCompany, DxtradeFinancialCompany? dxtradeFinancialCompany, @@ -450,12 +420,12 @@ class LandingCompany extends LandingCompanyModel { FinancialCompany? financialCompany, String? forbiddenPostcodePattern, GamingCompany? gamingCompany, - List? gamstopCompany, String? id, bool? isIdvSupported, String? lcToOpenMfAccount, int? minimumAge, bool? mt5AgeVerification, + MtAllCompany? mtAllCompany, MtFinancialCompany? mtFinancialCompany, MtGamingCompany? mtGamingCompany, String? name, @@ -473,6 +443,7 @@ class LandingCompany extends LandingCompanyModel { addressParseable: addressParseable ?? this.addressParseable, allCompany: allCompany ?? this.allCompany, config: config ?? this.config, + ctrader: ctrader ?? this.ctrader, derivez: derivez ?? this.derivez, dxtradeAllCompany: dxtradeAllCompany ?? this.dxtradeAllCompany, dxtradeFinancialCompany: @@ -482,12 +453,12 @@ class LandingCompany extends LandingCompanyModel { forbiddenPostcodePattern: forbiddenPostcodePattern ?? this.forbiddenPostcodePattern, gamingCompany: gamingCompany ?? this.gamingCompany, - gamstopCompany: gamstopCompany ?? this.gamstopCompany, id: id ?? this.id, isIdvSupported: isIdvSupported ?? this.isIdvSupported, lcToOpenMfAccount: lcToOpenMfAccount ?? this.lcToOpenMfAccount, minimumAge: minimumAge ?? this.minimumAge, mt5AgeVerification: mt5AgeVerification ?? this.mt5AgeVerification, + mtAllCompany: mtAllCompany ?? this.mtAllCompany, mtFinancialCompany: mtFinancialCompany ?? this.mtFinancialCompany, mtGamingCompany: mtGamingCompany ?? this.mtGamingCompany, name: name ?? this.name, @@ -508,29 +479,26 @@ class LandingCompany extends LandingCompanyModel { virtualCompany: virtualCompany ?? this.virtualCompany, ); } - -/// Derivez model class. -abstract class DerivezModel { - /// Initializes Derivez model class . - const DerivezModel({ +/// Ctrader model class. +abstract class CtraderModel { + /// Initializes Ctrader model class . + const CtraderModel({ this.all, }); - /// DerivEZ all account types (Synthetic Indices and Financials). + /// CTrader all account types (Synthetic Indices and Financials). final All? all; } -/// Derivez class. -class Derivez extends DerivezModel { - /// Initializes Derivez class. - const Derivez({ - All? all, - }) : super( - all: all, - ); +/// Ctrader class. +class Ctrader extends CtraderModel { + /// Initializes Ctrader class. + const Ctrader({ + super.all, + }); /// Creates an instance from JSON. - factory Derivez.fromJson(Map json) => Derivez( + factory Ctrader.fromJson(Map json) => Ctrader( all: json['all'] == null ? null : All.fromJson(json['all']), ); @@ -546,14 +514,13 @@ class Derivez extends DerivezModel { } /// Creates a copy of instance with given parameters. - Derivez copyWith({ + Ctrader copyWith({ All? all, }) => - Derivez( + Ctrader( all: all ?? this.all, ); } - /// All model class. abstract class AllModel { /// Initializes All model class . @@ -569,10 +536,8 @@ abstract class AllModel { class All extends AllModel { /// Initializes All class. const All({ - StandardEnum? standard, - }) : super( - standard: standard, - ); + super.standard, + }); /// Creates an instance from JSON. factory All.fromJson(Map json) => All( @@ -601,7 +566,93 @@ class All extends AllModel { standard: standard ?? this.standard, ); } +/// Derivez model class. +abstract class DerivezModel { + /// Initializes Derivez model class . + const DerivezModel({ + this.all, + }); + + /// DerivEZ all account types (Synthetic Indices and Financials). + final DerivezAll? all; +} + +/// Derivez class. +class Derivez extends DerivezModel { + /// Initializes Derivez class. + const Derivez({ + super.all, + }); + + /// Creates an instance from JSON. + factory Derivez.fromJson(Map json) => Derivez( + all: json['all'] == null ? null : DerivezAll.fromJson(json['all']), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (all != null) { + resultMap['all'] = all!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + Derivez copyWith({ + DerivezAll? all, + }) => + Derivez( + all: all ?? this.all, + ); +} +/// Derivez all model class. +abstract class DerivezAllModel { + /// Initializes Derivez all model class . + const DerivezAllModel({ + this.standard, + }); + + /// For standard client + final StandardEnum? standard; +} + +/// Derivez all class. +class DerivezAll extends DerivezAllModel { + /// Initializes Derivez all class. + const DerivezAll({ + super.standard, + }); + + /// Creates an instance from JSON. + factory DerivezAll.fromJson(Map json) => DerivezAll( + standard: json['standard'] == null + ? null + : standardEnumMapper[json['standard']], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['standard'] = standardEnumMapper.entries + .firstWhere( + (MapEntry entry) => entry.value == standard) + .key; + + return resultMap; + } + /// Creates a copy of instance with given parameters. + DerivezAll copyWith({ + StandardEnum? standard, + }) => + DerivezAll( + standard: standard ?? this.standard, + ); +} /// Dxtrade all company model class. abstract class DxtradeAllCompanyModel { /// Initializes Dxtrade all company model class . @@ -617,10 +668,8 @@ abstract class DxtradeAllCompanyModel { class DxtradeAllCompany extends DxtradeAllCompanyModel { /// Initializes Dxtrade all company class. const DxtradeAllCompany({ - Standard? standard, - }) : super( - standard: standard, - ); + super.standard, + }); /// Creates an instance from JSON. factory DxtradeAllCompany.fromJson(Map json) => @@ -649,7 +698,6 @@ class DxtradeAllCompany extends DxtradeAllCompanyModel { standard: standard ?? this.standard, ); } - /// Standard model class. abstract class StandardModel { /// Initializes Standard model class . @@ -667,6 +715,7 @@ abstract class StandardModel { this.requirements, this.shortcode, this.supportProfessionalClient, + this.tinNotMandatory, }); /// Landing Company address @@ -707,40 +756,30 @@ abstract class StandardModel { /// Flag that indicates whether the landing company supports professional accounts or not final bool? supportProfessionalClient; + + /// Flag that indicates whether tax identifier number is not mandatory for the current country and landing company. + final bool? tinNotMandatory; } /// Standard class. class Standard extends StandardModel { /// Initializes Standard class. const Standard({ - List? address, - Map? changeableFields, - String? country, - Map? currencyConfig, - bool? hasRealityCheck, - List? legalAllowedContractCategories, - List? legalAllowedCurrencies, - List? legalAllowedMarkets, - String? legalDefaultCurrency, - String? name, - Requirements? requirements, - String? shortcode, - bool? supportProfessionalClient, - }) : super( - address: address, - changeableFields: changeableFields, - country: country, - currencyConfig: currencyConfig, - hasRealityCheck: hasRealityCheck, - legalAllowedContractCategories: legalAllowedContractCategories, - legalAllowedCurrencies: legalAllowedCurrencies, - legalAllowedMarkets: legalAllowedMarkets, - legalDefaultCurrency: legalDefaultCurrency, - name: name, - requirements: requirements, - shortcode: shortcode, - supportProfessionalClient: supportProfessionalClient, - ); + super.address, + super.changeableFields, + super.country, + super.currencyConfig, + super.hasRealityCheck, + super.legalAllowedContractCategories, + super.legalAllowedCurrencies, + super.legalAllowedMarkets, + super.legalDefaultCurrency, + super.name, + super.requirements, + super.shortcode, + super.supportProfessionalClient, + super.tinNotMandatory, + }); /// Creates an instance from JSON. factory Standard.fromJson(Map json) => Standard( @@ -784,6 +823,7 @@ class Standard extends StandardModel { : Requirements.fromJson(json['requirements']), shortcode: json['shortcode'], supportProfessionalClient: getBool(json['support_professional_client']), + tinNotMandatory: getBool(json['tin_not_mandatory']), ); /// Converts an instance to JSON. @@ -830,6 +870,7 @@ class Standard extends StandardModel { } resultMap['shortcode'] = shortcode; resultMap['support_professional_client'] = supportProfessionalClient; + resultMap['tin_not_mandatory'] = tinNotMandatory; return resultMap; } @@ -849,6 +890,7 @@ class Standard extends StandardModel { Requirements? requirements, String? shortcode, bool? supportProfessionalClient, + bool? tinNotMandatory, }) => Standard( address: address ?? this.address, @@ -867,9 +909,9 @@ class Standard extends StandardModel { shortcode: shortcode ?? this.shortcode, supportProfessionalClient: supportProfessionalClient ?? this.supportProfessionalClient, + tinNotMandatory: tinNotMandatory ?? this.tinNotMandatory, ); } - /// Requirements model class. abstract class RequirementsModel { /// Initializes Requirements model class . @@ -897,16 +939,11 @@ abstract class RequirementsModel { class Requirements extends RequirementsModel { /// Initializes Requirements class. const Requirements({ - AfterFirstDeposit? afterFirstDeposit, - Compliance? compliance, - List? signup, - List? withdrawal, - }) : super( - afterFirstDeposit: afterFirstDeposit, - compliance: compliance, - signup: signup, - withdrawal: withdrawal, - ); + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); /// Creates an instance from JSON. factory Requirements.fromJson(Map json) => Requirements( @@ -974,7 +1011,6 @@ class Requirements extends RequirementsModel { withdrawal: withdrawal ?? this.withdrawal, ); } - /// After first deposit model class. abstract class AfterFirstDepositModel { /// Initializes After first deposit model class . @@ -990,10 +1026,8 @@ abstract class AfterFirstDepositModel { class AfterFirstDeposit extends AfterFirstDepositModel { /// Initializes After first deposit class. const AfterFirstDeposit({ - List? financialAssessment, - }) : super( - financialAssessment: financialAssessment, - ); + super.financialAssessment, + }); /// Creates an instance from JSON. factory AfterFirstDeposit.fromJson(Map json) => @@ -1030,7 +1064,6 @@ class AfterFirstDeposit extends AfterFirstDepositModel { financialAssessment: financialAssessment ?? this.financialAssessment, ); } - /// Compliance model class. abstract class ComplianceModel { /// Initializes Compliance model class . @@ -1050,12 +1083,9 @@ abstract class ComplianceModel { class Compliance extends ComplianceModel { /// Initializes Compliance class. const Compliance({ - List? mt5, - List? taxInformation, - }) : super( - mt5: mt5, - taxInformation: taxInformation, - ); + super.mt5, + super.taxInformation, + }); /// Creates an instance from JSON. factory Compliance.fromJson(Map json) => Compliance( @@ -1107,7 +1137,6 @@ class Compliance extends ComplianceModel { taxInformation: taxInformation ?? this.taxInformation, ); } - /// Dxtrade financial company model class. abstract class DxtradeFinancialCompanyModel { /// Initializes Dxtrade financial company model class . @@ -1123,10 +1152,8 @@ abstract class DxtradeFinancialCompanyModel { class DxtradeFinancialCompany extends DxtradeFinancialCompanyModel { /// Initializes Dxtrade financial company class. const DxtradeFinancialCompany({ - DxtradeFinancialCompanyStandard? standard, - }) : super( - standard: standard, - ); + super.standard, + }); /// Creates an instance from JSON. factory DxtradeFinancialCompany.fromJson(Map json) => @@ -1155,7 +1182,6 @@ class DxtradeFinancialCompany extends DxtradeFinancialCompanyModel { standard: standard ?? this.standard, ); } - /// Dxtrade financial company standard model class. abstract class DxtradeFinancialCompanyStandardModel { /// Initializes Dxtrade financial company standard model class . @@ -1173,6 +1199,7 @@ abstract class DxtradeFinancialCompanyStandardModel { this.requirements, this.shortcode, this.supportProfessionalClient, + this.tinNotMandatory, }); /// Landing Company address @@ -1213,6 +1240,9 @@ abstract class DxtradeFinancialCompanyStandardModel { /// Flag that indicates whether the landing company supports professional accounts or not final bool? supportProfessionalClient; + + /// Flag that indicates whether tax identifier number is not mandatory for the current country and landing company. + final bool? tinNotMandatory; } /// Dxtrade financial company standard class. @@ -1220,34 +1250,21 @@ class DxtradeFinancialCompanyStandard extends DxtradeFinancialCompanyStandardModel { /// Initializes Dxtrade financial company standard class. const DxtradeFinancialCompanyStandard({ - List? address, - Map? changeableFields, - String? country, - Map? currencyConfig, - bool? hasRealityCheck, - List? legalAllowedContractCategories, - List? legalAllowedCurrencies, - List? legalAllowedMarkets, - String? legalDefaultCurrency, - String? name, - StandardRequirements? requirements, - String? shortcode, - bool? supportProfessionalClient, - }) : super( - address: address, - changeableFields: changeableFields, - country: country, - currencyConfig: currencyConfig, - hasRealityCheck: hasRealityCheck, - legalAllowedContractCategories: legalAllowedContractCategories, - legalAllowedCurrencies: legalAllowedCurrencies, - legalAllowedMarkets: legalAllowedMarkets, - legalDefaultCurrency: legalDefaultCurrency, - name: name, - requirements: requirements, - shortcode: shortcode, - supportProfessionalClient: supportProfessionalClient, - ); + super.address, + super.changeableFields, + super.country, + super.currencyConfig, + super.hasRealityCheck, + super.legalAllowedContractCategories, + super.legalAllowedCurrencies, + super.legalAllowedMarkets, + super.legalDefaultCurrency, + super.name, + super.requirements, + super.shortcode, + super.supportProfessionalClient, + super.tinNotMandatory, + }); /// Creates an instance from JSON. factory DxtradeFinancialCompanyStandard.fromJson(Map json) => @@ -1292,6 +1309,7 @@ class DxtradeFinancialCompanyStandard : StandardRequirements.fromJson(json['requirements']), shortcode: json['shortcode'], supportProfessionalClient: getBool(json['support_professional_client']), + tinNotMandatory: getBool(json['tin_not_mandatory']), ); /// Converts an instance to JSON. @@ -1338,6 +1356,7 @@ class DxtradeFinancialCompanyStandard } resultMap['shortcode'] = shortcode; resultMap['support_professional_client'] = supportProfessionalClient; + resultMap['tin_not_mandatory'] = tinNotMandatory; return resultMap; } @@ -1357,6 +1376,7 @@ class DxtradeFinancialCompanyStandard StandardRequirements? requirements, String? shortcode, bool? supportProfessionalClient, + bool? tinNotMandatory, }) => DxtradeFinancialCompanyStandard( address: address ?? this.address, @@ -1375,9 +1395,9 @@ class DxtradeFinancialCompanyStandard shortcode: shortcode ?? this.shortcode, supportProfessionalClient: supportProfessionalClient ?? this.supportProfessionalClient, + tinNotMandatory: tinNotMandatory ?? this.tinNotMandatory, ); } - /// Standard requirements model class. abstract class StandardRequirementsModel { /// Initializes Standard requirements model class . @@ -1405,16 +1425,11 @@ abstract class StandardRequirementsModel { class StandardRequirements extends StandardRequirementsModel { /// Initializes Standard requirements class. const StandardRequirements({ - RequirementsAfterFirstDeposit? afterFirstDeposit, - RequirementsCompliance? compliance, - List? signup, - List? withdrawal, - }) : super( - afterFirstDeposit: afterFirstDeposit, - compliance: compliance, - signup: signup, - withdrawal: withdrawal, - ); + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); /// Creates an instance from JSON. factory StandardRequirements.fromJson(Map json) => @@ -1484,7 +1499,6 @@ class StandardRequirements extends StandardRequirementsModel { withdrawal: withdrawal ?? this.withdrawal, ); } - /// Requirements after first deposit model class. abstract class RequirementsAfterFirstDepositModel { /// Initializes Requirements after first deposit model class . @@ -1500,10 +1514,8 @@ abstract class RequirementsAfterFirstDepositModel { class RequirementsAfterFirstDeposit extends RequirementsAfterFirstDepositModel { /// Initializes Requirements after first deposit class. const RequirementsAfterFirstDeposit({ - List? financialAssessment, - }) : super( - financialAssessment: financialAssessment, - ); + super.financialAssessment, + }); /// Creates an instance from JSON. factory RequirementsAfterFirstDeposit.fromJson(Map json) => @@ -1540,7 +1552,6 @@ class RequirementsAfterFirstDeposit extends RequirementsAfterFirstDepositModel { financialAssessment: financialAssessment ?? this.financialAssessment, ); } - /// Requirements compliance model class. abstract class RequirementsComplianceModel { /// Initializes Requirements compliance model class . @@ -1560,12 +1571,9 @@ abstract class RequirementsComplianceModel { class RequirementsCompliance extends RequirementsComplianceModel { /// Initializes Requirements compliance class. const RequirementsCompliance({ - List? mt5, - List? taxInformation, - }) : super( - mt5: mt5, - taxInformation: taxInformation, - ); + super.mt5, + super.taxInformation, + }); /// Creates an instance from JSON. factory RequirementsCompliance.fromJson(Map json) => @@ -1618,7 +1626,6 @@ class RequirementsCompliance extends RequirementsComplianceModel { taxInformation: taxInformation ?? this.taxInformation, ); } - /// Dxtrade gaming company model class. abstract class DxtradeGamingCompanyModel { /// Initializes Dxtrade gaming company model class . @@ -1634,10 +1641,8 @@ abstract class DxtradeGamingCompanyModel { class DxtradeGamingCompany extends DxtradeGamingCompanyModel { /// Initializes Dxtrade gaming company class. const DxtradeGamingCompany({ - DxtradeGamingCompanyStandard? standard, - }) : super( - standard: standard, - ); + super.standard, + }); /// Creates an instance from JSON. factory DxtradeGamingCompany.fromJson(Map json) => @@ -1666,7 +1671,6 @@ class DxtradeGamingCompany extends DxtradeGamingCompanyModel { standard: standard ?? this.standard, ); } - /// Dxtrade gaming company standard model class. abstract class DxtradeGamingCompanyStandardModel { /// Initializes Dxtrade gaming company standard model class . @@ -1684,6 +1688,7 @@ abstract class DxtradeGamingCompanyStandardModel { this.requirements, this.shortcode, this.supportProfessionalClient, + this.tinNotMandatory, }); /// Landing Company address @@ -1717,47 +1722,37 @@ abstract class DxtradeGamingCompanyStandardModel { final String? name; /// Legal requirements for the Landing Company - final StandardRequirements2? requirements; + final StandardRequirements16? requirements; /// Landing Company short code final String? shortcode; /// Flag that indicates whether the landing company supports professional accounts or not final bool? supportProfessionalClient; + + /// Flag that indicates whether tax identifier number is not mandatory for the current country and landing company. + final bool? tinNotMandatory; } /// Dxtrade gaming company standard class. class DxtradeGamingCompanyStandard extends DxtradeGamingCompanyStandardModel { /// Initializes Dxtrade gaming company standard class. const DxtradeGamingCompanyStandard({ - List? address, - Map? changeableFields, - String? country, - Map? currencyConfig, - bool? hasRealityCheck, - List? legalAllowedContractCategories, - List? legalAllowedCurrencies, - List? legalAllowedMarkets, - String? legalDefaultCurrency, - String? name, - StandardRequirements2? requirements, - String? shortcode, - bool? supportProfessionalClient, - }) : super( - address: address, - changeableFields: changeableFields, - country: country, - currencyConfig: currencyConfig, - hasRealityCheck: hasRealityCheck, - legalAllowedContractCategories: legalAllowedContractCategories, - legalAllowedCurrencies: legalAllowedCurrencies, - legalAllowedMarkets: legalAllowedMarkets, - legalDefaultCurrency: legalDefaultCurrency, - name: name, - requirements: requirements, - shortcode: shortcode, - supportProfessionalClient: supportProfessionalClient, - ); + super.address, + super.changeableFields, + super.country, + super.currencyConfig, + super.hasRealityCheck, + super.legalAllowedContractCategories, + super.legalAllowedCurrencies, + super.legalAllowedMarkets, + super.legalDefaultCurrency, + super.name, + super.requirements, + super.shortcode, + super.supportProfessionalClient, + super.tinNotMandatory, + }); /// Creates an instance from JSON. factory DxtradeGamingCompanyStandard.fromJson(Map json) => @@ -1799,9 +1794,10 @@ class DxtradeGamingCompanyStandard extends DxtradeGamingCompanyStandardModel { name: json['name'], requirements: json['requirements'] == null ? null - : StandardRequirements2.fromJson(json['requirements']), + : StandardRequirements16.fromJson(json['requirements']), shortcode: json['shortcode'], supportProfessionalClient: getBool(json['support_professional_client']), + tinNotMandatory: getBool(json['tin_not_mandatory']), ); /// Converts an instance to JSON. @@ -1848,6 +1844,7 @@ class DxtradeGamingCompanyStandard extends DxtradeGamingCompanyStandardModel { } resultMap['shortcode'] = shortcode; resultMap['support_professional_client'] = supportProfessionalClient; + resultMap['tin_not_mandatory'] = tinNotMandatory; return resultMap; } @@ -1864,9 +1861,10 @@ class DxtradeGamingCompanyStandard extends DxtradeGamingCompanyStandardModel { List? legalAllowedMarkets, String? legalDefaultCurrency, String? name, - StandardRequirements2? requirements, + StandardRequirements16? requirements, String? shortcode, bool? supportProfessionalClient, + bool? tinNotMandatory, }) => DxtradeGamingCompanyStandard( address: address ?? this.address, @@ -1885,13 +1883,13 @@ class DxtradeGamingCompanyStandard extends DxtradeGamingCompanyStandardModel { shortcode: shortcode ?? this.shortcode, supportProfessionalClient: supportProfessionalClient ?? this.supportProfessionalClient, + tinNotMandatory: tinNotMandatory ?? this.tinNotMandatory, ); } - -/// Standard requirements2 model class. -abstract class StandardRequirements2Model { - /// Initializes Standard requirements2 model class . - const StandardRequirements2Model({ +/// Standard requirements16 model class. +abstract class StandardRequirements16Model { + /// Initializes Standard requirements16 model class . + const StandardRequirements16Model({ this.afterFirstDeposit, this.compliance, this.signup, @@ -1899,10 +1897,10 @@ abstract class StandardRequirements2Model { }); /// After first deposit requirements - final RequirementsAfterFirstDeposit2? afterFirstDeposit; + final RequirementsAfterFirstDeposit14? afterFirstDeposit; /// Compliance requirements - final RequirementsCompliance2? compliance; + final RequirementsCompliance15? compliance; /// Sign up requirements final List? signup; @@ -1911,31 +1909,26 @@ abstract class StandardRequirements2Model { final List? withdrawal; } -/// Standard requirements2 class. -class StandardRequirements2 extends StandardRequirements2Model { - /// Initializes Standard requirements2 class. - const StandardRequirements2({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, - List? signup, - List? withdrawal, - }) : super( - afterFirstDeposit: afterFirstDeposit, - compliance: compliance, - signup: signup, - withdrawal: withdrawal, - ); +/// Standard requirements16 class. +class StandardRequirements16 extends StandardRequirements16Model { + /// Initializes Standard requirements16 class. + const StandardRequirements16({ + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); /// Creates an instance from JSON. - factory StandardRequirements2.fromJson(Map json) => - StandardRequirements2( + factory StandardRequirements16.fromJson(Map json) => + StandardRequirements16( afterFirstDeposit: json['after_first_deposit'] == null ? null - : RequirementsAfterFirstDeposit2.fromJson( + : RequirementsAfterFirstDeposit14.fromJson( json['after_first_deposit']), compliance: json['compliance'] == null ? null - : RequirementsCompliance2.fromJson(json['compliance']), + : RequirementsCompliance15.fromJson(json['compliance']), signup: json['signup'] == null ? null : List.from( @@ -1981,24 +1974,23 @@ class StandardRequirements2 extends StandardRequirements2Model { } /// Creates a copy of instance with given parameters. - StandardRequirements2 copyWith({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, + StandardRequirements16 copyWith({ + RequirementsAfterFirstDeposit14? afterFirstDeposit, + RequirementsCompliance15? compliance, List? signup, List? withdrawal, }) => - StandardRequirements2( + StandardRequirements16( afterFirstDeposit: afterFirstDeposit ?? this.afterFirstDeposit, compliance: compliance ?? this.compliance, signup: signup ?? this.signup, withdrawal: withdrawal ?? this.withdrawal, ); } - -/// Requirements after first deposit2 model class. -abstract class RequirementsAfterFirstDeposit2Model { - /// Initializes Requirements after first deposit2 model class . - const RequirementsAfterFirstDeposit2Model({ +/// Requirements after first deposit14 model class. +abstract class RequirementsAfterFirstDeposit14Model { + /// Initializes Requirements after first deposit14 model class . + const RequirementsAfterFirstDeposit14Model({ this.financialAssessment, }); @@ -2006,19 +1998,17 @@ abstract class RequirementsAfterFirstDeposit2Model { final List? financialAssessment; } -/// Requirements after first deposit2 class. -class RequirementsAfterFirstDeposit2 - extends RequirementsAfterFirstDeposit2Model { - /// Initializes Requirements after first deposit2 class. - const RequirementsAfterFirstDeposit2({ - List? financialAssessment, - }) : super( - financialAssessment: financialAssessment, - ); +/// Requirements after first deposit14 class. +class RequirementsAfterFirstDeposit14 + extends RequirementsAfterFirstDeposit14Model { + /// Initializes Requirements after first deposit14 class. + const RequirementsAfterFirstDeposit14({ + super.financialAssessment, + }); /// Creates an instance from JSON. - factory RequirementsAfterFirstDeposit2.fromJson(Map json) => - RequirementsAfterFirstDeposit2( + factory RequirementsAfterFirstDeposit14.fromJson(Map json) => + RequirementsAfterFirstDeposit14( financialAssessment: json['financial_assessment'] == null ? null : List.from( @@ -2044,18 +2034,17 @@ class RequirementsAfterFirstDeposit2 } /// Creates a copy of instance with given parameters. - RequirementsAfterFirstDeposit2 copyWith({ + RequirementsAfterFirstDeposit14 copyWith({ List? financialAssessment, }) => - RequirementsAfterFirstDeposit2( + RequirementsAfterFirstDeposit14( financialAssessment: financialAssessment ?? this.financialAssessment, ); } - -/// Requirements compliance2 model class. -abstract class RequirementsCompliance2Model { - /// Initializes Requirements compliance2 model class . - const RequirementsCompliance2Model({ +/// Requirements compliance15 model class. +abstract class RequirementsCompliance15Model { + /// Initializes Requirements compliance15 model class . + const RequirementsCompliance15Model({ this.mt5, this.taxInformation, }); @@ -2067,20 +2056,17 @@ abstract class RequirementsCompliance2Model { final List? taxInformation; } -/// Requirements compliance2 class. -class RequirementsCompliance2 extends RequirementsCompliance2Model { - /// Initializes Requirements compliance2 class. - const RequirementsCompliance2({ - List? mt5, - List? taxInformation, - }) : super( - mt5: mt5, - taxInformation: taxInformation, - ); +/// Requirements compliance15 class. +class RequirementsCompliance15 extends RequirementsCompliance15Model { + /// Initializes Requirements compliance15 class. + const RequirementsCompliance15({ + super.mt5, + super.taxInformation, + }); /// Creates an instance from JSON. - factory RequirementsCompliance2.fromJson(Map json) => - RequirementsCompliance2( + factory RequirementsCompliance15.fromJson(Map json) => + RequirementsCompliance15( mt5: json['mt5'] == null ? null : List.from( @@ -2120,16 +2106,15 @@ class RequirementsCompliance2 extends RequirementsCompliance2Model { } /// Creates a copy of instance with given parameters. - RequirementsCompliance2 copyWith({ + RequirementsCompliance15 copyWith({ List? mt5, List? taxInformation, }) => - RequirementsCompliance2( + RequirementsCompliance15( mt5: mt5 ?? this.mt5, taxInformation: taxInformation ?? this.taxInformation, ); } - /// Financial company model class. abstract class FinancialCompanyModel { /// Initializes Financial company model class . @@ -2147,6 +2132,7 @@ abstract class FinancialCompanyModel { this.requirements, this.shortcode, this.supportProfessionalClient, + this.tinNotMandatory, }); /// Landing Company address @@ -2187,40 +2173,30 @@ abstract class FinancialCompanyModel { /// Flag that indicates whether the landing company supports professional accounts or not final bool? supportProfessionalClient; + + /// Flag that indicates whether tax identifier number is not mandatory for the current country and landing company. + final bool? tinNotMandatory; } /// Financial company class. class FinancialCompany extends FinancialCompanyModel { /// Initializes Financial company class. const FinancialCompany({ - List? address, - Map? changeableFields, - String? country, - Map? currencyConfig, - bool? hasRealityCheck, - List? legalAllowedContractCategories, - List? legalAllowedCurrencies, - List? legalAllowedMarkets, - String? legalDefaultCurrency, - String? name, - FinancialCompanyRequirements? requirements, - String? shortcode, - bool? supportProfessionalClient, - }) : super( - address: address, - changeableFields: changeableFields, - country: country, - currencyConfig: currencyConfig, - hasRealityCheck: hasRealityCheck, - legalAllowedContractCategories: legalAllowedContractCategories, - legalAllowedCurrencies: legalAllowedCurrencies, - legalAllowedMarkets: legalAllowedMarkets, - legalDefaultCurrency: legalDefaultCurrency, - name: name, - requirements: requirements, - shortcode: shortcode, - supportProfessionalClient: supportProfessionalClient, - ); + super.address, + super.changeableFields, + super.country, + super.currencyConfig, + super.hasRealityCheck, + super.legalAllowedContractCategories, + super.legalAllowedCurrencies, + super.legalAllowedMarkets, + super.legalDefaultCurrency, + super.name, + super.requirements, + super.shortcode, + super.supportProfessionalClient, + super.tinNotMandatory, + }); /// Creates an instance from JSON. factory FinancialCompany.fromJson(Map json) => @@ -2265,6 +2241,7 @@ class FinancialCompany extends FinancialCompanyModel { : FinancialCompanyRequirements.fromJson(json['requirements']), shortcode: json['shortcode'], supportProfessionalClient: getBool(json['support_professional_client']), + tinNotMandatory: getBool(json['tin_not_mandatory']), ); /// Converts an instance to JSON. @@ -2311,6 +2288,7 @@ class FinancialCompany extends FinancialCompanyModel { } resultMap['shortcode'] = shortcode; resultMap['support_professional_client'] = supportProfessionalClient; + resultMap['tin_not_mandatory'] = tinNotMandatory; return resultMap; } @@ -2330,6 +2308,7 @@ class FinancialCompany extends FinancialCompanyModel { FinancialCompanyRequirements? requirements, String? shortcode, bool? supportProfessionalClient, + bool? tinNotMandatory, }) => FinancialCompany( address: address ?? this.address, @@ -2348,9 +2327,9 @@ class FinancialCompany extends FinancialCompanyModel { shortcode: shortcode ?? this.shortcode, supportProfessionalClient: supportProfessionalClient ?? this.supportProfessionalClient, + tinNotMandatory: tinNotMandatory ?? this.tinNotMandatory, ); } - /// Financial company requirements model class. abstract class FinancialCompanyRequirementsModel { /// Initializes Financial company requirements model class . @@ -2362,10 +2341,10 @@ abstract class FinancialCompanyRequirementsModel { }); /// After first deposit requirements - final RequirementsAfterFirstDeposit2? afterFirstDeposit; + final RequirementsAfterFirstDeposit19? afterFirstDeposit; /// Compliance requirements - final RequirementsCompliance2? compliance; + final RequirementsCompliance20? compliance; /// Sign up requirements final List? signup; @@ -2378,27 +2357,22 @@ abstract class FinancialCompanyRequirementsModel { class FinancialCompanyRequirements extends FinancialCompanyRequirementsModel { /// Initializes Financial company requirements class. const FinancialCompanyRequirements({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, - List? signup, - List? withdrawal, - }) : super( - afterFirstDeposit: afterFirstDeposit, - compliance: compliance, - signup: signup, - withdrawal: withdrawal, - ); + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); /// Creates an instance from JSON. factory FinancialCompanyRequirements.fromJson(Map json) => FinancialCompanyRequirements( afterFirstDeposit: json['after_first_deposit'] == null ? null - : RequirementsAfterFirstDeposit2.fromJson( + : RequirementsAfterFirstDeposit19.fromJson( json['after_first_deposit']), compliance: json['compliance'] == null ? null - : RequirementsCompliance2.fromJson(json['compliance']), + : RequirementsCompliance20.fromJson(json['compliance']), signup: json['signup'] == null ? null : List.from( @@ -2445,8 +2419,8 @@ class FinancialCompanyRequirements extends FinancialCompanyRequirementsModel { /// Creates a copy of instance with given parameters. FinancialCompanyRequirements copyWith({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, + RequirementsAfterFirstDeposit19? afterFirstDeposit, + RequirementsCompliance20? compliance, List? signup, List? withdrawal, }) => @@ -2457,14 +2431,141 @@ class FinancialCompanyRequirements extends FinancialCompanyRequirementsModel { withdrawal: withdrawal ?? this.withdrawal, ); } +/// Requirements after first deposit19 model class. +abstract class RequirementsAfterFirstDeposit19Model { + /// Initializes Requirements after first deposit19 model class . + const RequirementsAfterFirstDeposit19Model({ + this.financialAssessment, + }); -/// Gaming company model class. -abstract class GamingCompanyModel { - /// Initializes Gaming company model class . - const GamingCompanyModel({ - this.address, - this.changeableFields, - this.country, + /// Financial assessment requirements + final List? financialAssessment; +} + +/// Requirements after first deposit19 class. +class RequirementsAfterFirstDeposit19 + extends RequirementsAfterFirstDeposit19Model { + /// Initializes Requirements after first deposit19 class. + const RequirementsAfterFirstDeposit19({ + super.financialAssessment, + }); + + /// Creates an instance from JSON. + factory RequirementsAfterFirstDeposit19.fromJson(Map json) => + RequirementsAfterFirstDeposit19( + financialAssessment: json['financial_assessment'] == null + ? null + : List.from( + json['financial_assessment']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (financialAssessment != null) { + resultMap['financial_assessment'] = financialAssessment! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + RequirementsAfterFirstDeposit19 copyWith({ + List? financialAssessment, + }) => + RequirementsAfterFirstDeposit19( + financialAssessment: financialAssessment ?? this.financialAssessment, + ); +} +/// Requirements compliance20 model class. +abstract class RequirementsCompliance20Model { + /// Initializes Requirements compliance20 model class . + const RequirementsCompliance20Model({ + this.mt5, + this.taxInformation, + }); + + /// Compliance MT5 requirements + final List? mt5; + + /// Compliance tax information requirements + final List? taxInformation; +} + +/// Requirements compliance20 class. +class RequirementsCompliance20 extends RequirementsCompliance20Model { + /// Initializes Requirements compliance20 class. + const RequirementsCompliance20({ + super.mt5, + super.taxInformation, + }); + + /// Creates an instance from JSON. + factory RequirementsCompliance20.fromJson(Map json) => + RequirementsCompliance20( + mt5: json['mt5'] == null + ? null + : List.from( + json['mt5']?.map( + (dynamic item) => item, + ), + ), + taxInformation: json['tax_information'] == null + ? null + : List.from( + json['tax_information']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (mt5 != null) { + resultMap['mt5'] = mt5! + .map( + (String item) => item, + ) + .toList(); + } + if (taxInformation != null) { + resultMap['tax_information'] = taxInformation! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + RequirementsCompliance20 copyWith({ + List? mt5, + List? taxInformation, + }) => + RequirementsCompliance20( + mt5: mt5 ?? this.mt5, + taxInformation: taxInformation ?? this.taxInformation, + ); +} +/// Gaming company model class. +abstract class GamingCompanyModel { + /// Initializes Gaming company model class . + const GamingCompanyModel({ + this.address, + this.changeableFields, + this.country, this.currencyConfig, this.hasRealityCheck, this.legalAllowedContractCategories, @@ -2475,6 +2576,7 @@ abstract class GamingCompanyModel { this.requirements, this.shortcode, this.supportProfessionalClient, + this.tinNotMandatory, }); /// Landing Company address @@ -2515,12 +2617,127 @@ abstract class GamingCompanyModel { /// Flag that indicates whether the landing company supports professional accounts or not final bool? supportProfessionalClient; + + /// Flag that indicates whether tax identifier number is not mandatory for the current country and landing company. + final bool? tinNotMandatory; } /// Gaming company class. class GamingCompany extends GamingCompanyModel { /// Initializes Gaming company class. const GamingCompany({ + super.address, + super.changeableFields, + super.country, + super.currencyConfig, + super.hasRealityCheck, + super.legalAllowedContractCategories, + super.legalAllowedCurrencies, + super.legalAllowedMarkets, + super.legalDefaultCurrency, + super.name, + super.requirements, + super.shortcode, + super.supportProfessionalClient, + super.tinNotMandatory, + }); + + /// Creates an instance from JSON. + factory GamingCompany.fromJson(Map json) => GamingCompany( + address: json['address'] == null + ? null + : List.from( + json['address']?.map( + (dynamic item) => item, + ), + ), + changeableFields: json['changeable_fields'], + country: json['country'], + currencyConfig: json['currency_config'], + hasRealityCheck: getBool(json['has_reality_check']), + legalAllowedContractCategories: + json['legal_allowed_contract_categories'] == null + ? null + : List.from( + json['legal_allowed_contract_categories']?.map( + (dynamic item) => item, + ), + ), + legalAllowedCurrencies: json['legal_allowed_currencies'] == null + ? null + : List.from( + json['legal_allowed_currencies']?.map( + (dynamic item) => item, + ), + ), + legalAllowedMarkets: json['legal_allowed_markets'] == null + ? null + : List.from( + json['legal_allowed_markets']?.map( + (dynamic item) => item, + ), + ), + legalDefaultCurrency: json['legal_default_currency'], + name: json['name'], + requirements: json['requirements'] == null + ? null + : GamingCompanyRequirements.fromJson(json['requirements']), + shortcode: json['shortcode'], + supportProfessionalClient: getBool(json['support_professional_client']), + tinNotMandatory: getBool(json['tin_not_mandatory']), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (address != null) { + resultMap['address'] = address! + .map( + (String item) => item, + ) + .toList(); + } + resultMap['changeable_fields'] = changeableFields; + resultMap['country'] = country; + resultMap['currency_config'] = currencyConfig; + resultMap['has_reality_check'] = hasRealityCheck; + if (legalAllowedContractCategories != null) { + resultMap['legal_allowed_contract_categories'] = + legalAllowedContractCategories! + .map( + (String item) => item, + ) + .toList(); + } + if (legalAllowedCurrencies != null) { + resultMap['legal_allowed_currencies'] = legalAllowedCurrencies! + .map( + (String item) => item, + ) + .toList(); + } + if (legalAllowedMarkets != null) { + resultMap['legal_allowed_markets'] = legalAllowedMarkets! + .map( + (String item) => item, + ) + .toList(); + } + resultMap['legal_default_currency'] = legalDefaultCurrency; + resultMap['name'] = name; + if (requirements != null) { + resultMap['requirements'] = requirements!.toJson(); + } + resultMap['shortcode'] = shortcode; + resultMap['support_professional_client'] = supportProfessionalClient; + resultMap['tin_not_mandatory'] = tinNotMandatory; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + GamingCompany copyWith({ List? address, Map? changeableFields, String? country, @@ -2534,24 +2751,386 @@ class GamingCompany extends GamingCompanyModel { GamingCompanyRequirements? requirements, String? shortcode, bool? supportProfessionalClient, - }) : super( - address: address, - changeableFields: changeableFields, - country: country, - currencyConfig: currencyConfig, - hasRealityCheck: hasRealityCheck, - legalAllowedContractCategories: legalAllowedContractCategories, - legalAllowedCurrencies: legalAllowedCurrencies, - legalAllowedMarkets: legalAllowedMarkets, - legalDefaultCurrency: legalDefaultCurrency, - name: name, - requirements: requirements, - shortcode: shortcode, - supportProfessionalClient: supportProfessionalClient, - ); + bool? tinNotMandatory, + }) => + GamingCompany( + address: address ?? this.address, + changeableFields: changeableFields ?? this.changeableFields, + country: country ?? this.country, + currencyConfig: currencyConfig ?? this.currencyConfig, + hasRealityCheck: hasRealityCheck ?? this.hasRealityCheck, + legalAllowedContractCategories: legalAllowedContractCategories ?? + this.legalAllowedContractCategories, + legalAllowedCurrencies: + legalAllowedCurrencies ?? this.legalAllowedCurrencies, + legalAllowedMarkets: legalAllowedMarkets ?? this.legalAllowedMarkets, + legalDefaultCurrency: legalDefaultCurrency ?? this.legalDefaultCurrency, + name: name ?? this.name, + requirements: requirements ?? this.requirements, + shortcode: shortcode ?? this.shortcode, + supportProfessionalClient: + supportProfessionalClient ?? this.supportProfessionalClient, + tinNotMandatory: tinNotMandatory ?? this.tinNotMandatory, + ); +} +/// Gaming company requirements model class. +abstract class GamingCompanyRequirementsModel { + /// Initializes Gaming company requirements model class . + const GamingCompanyRequirementsModel({ + this.afterFirstDeposit, + this.compliance, + this.signup, + this.withdrawal, + }); + + /// After first deposit requirements + final RequirementsAfterFirstDeposit23? afterFirstDeposit; + + /// Compliance requirements + final RequirementsCompliance24? compliance; + + /// Sign up requirements + final List? signup; + + /// Withdrawal requirements + final List? withdrawal; +} + +/// Gaming company requirements class. +class GamingCompanyRequirements extends GamingCompanyRequirementsModel { + /// Initializes Gaming company requirements class. + const GamingCompanyRequirements({ + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); + + /// Creates an instance from JSON. + factory GamingCompanyRequirements.fromJson(Map json) => + GamingCompanyRequirements( + afterFirstDeposit: json['after_first_deposit'] == null + ? null + : RequirementsAfterFirstDeposit23.fromJson( + json['after_first_deposit']), + compliance: json['compliance'] == null + ? null + : RequirementsCompliance24.fromJson(json['compliance']), + signup: json['signup'] == null + ? null + : List.from( + json['signup']?.map( + (dynamic item) => item, + ), + ), + withdrawal: json['withdrawal'] == null + ? null + : List.from( + json['withdrawal']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (afterFirstDeposit != null) { + resultMap['after_first_deposit'] = afterFirstDeposit!.toJson(); + } + if (compliance != null) { + resultMap['compliance'] = compliance!.toJson(); + } + if (signup != null) { + resultMap['signup'] = signup! + .map( + (String item) => item, + ) + .toList(); + } + if (withdrawal != null) { + resultMap['withdrawal'] = withdrawal! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + GamingCompanyRequirements copyWith({ + RequirementsAfterFirstDeposit23? afterFirstDeposit, + RequirementsCompliance24? compliance, + List? signup, + List? withdrawal, + }) => + GamingCompanyRequirements( + afterFirstDeposit: afterFirstDeposit ?? this.afterFirstDeposit, + compliance: compliance ?? this.compliance, + signup: signup ?? this.signup, + withdrawal: withdrawal ?? this.withdrawal, + ); +} +/// Requirements after first deposit23 model class. +abstract class RequirementsAfterFirstDeposit23Model { + /// Initializes Requirements after first deposit23 model class . + const RequirementsAfterFirstDeposit23Model({ + this.financialAssessment, + }); + + /// Financial assessment requirements + final List? financialAssessment; +} + +/// Requirements after first deposit23 class. +class RequirementsAfterFirstDeposit23 + extends RequirementsAfterFirstDeposit23Model { + /// Initializes Requirements after first deposit23 class. + const RequirementsAfterFirstDeposit23({ + super.financialAssessment, + }); + + /// Creates an instance from JSON. + factory RequirementsAfterFirstDeposit23.fromJson(Map json) => + RequirementsAfterFirstDeposit23( + financialAssessment: json['financial_assessment'] == null + ? null + : List.from( + json['financial_assessment']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (financialAssessment != null) { + resultMap['financial_assessment'] = financialAssessment! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + RequirementsAfterFirstDeposit23 copyWith({ + List? financialAssessment, + }) => + RequirementsAfterFirstDeposit23( + financialAssessment: financialAssessment ?? this.financialAssessment, + ); +} +/// Requirements compliance24 model class. +abstract class RequirementsCompliance24Model { + /// Initializes Requirements compliance24 model class . + const RequirementsCompliance24Model({ + this.mt5, + this.taxInformation, + }); + + /// Compliance MT5 requirements + final List? mt5; + + /// Compliance tax information requirements + final List? taxInformation; +} + +/// Requirements compliance24 class. +class RequirementsCompliance24 extends RequirementsCompliance24Model { + /// Initializes Requirements compliance24 class. + const RequirementsCompliance24({ + super.mt5, + super.taxInformation, + }); + + /// Creates an instance from JSON. + factory RequirementsCompliance24.fromJson(Map json) => + RequirementsCompliance24( + mt5: json['mt5'] == null + ? null + : List.from( + json['mt5']?.map( + (dynamic item) => item, + ), + ), + taxInformation: json['tax_information'] == null + ? null + : List.from( + json['tax_information']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (mt5 != null) { + resultMap['mt5'] = mt5! + .map( + (String item) => item, + ) + .toList(); + } + if (taxInformation != null) { + resultMap['tax_information'] = taxInformation! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + RequirementsCompliance24 copyWith({ + List? mt5, + List? taxInformation, + }) => + RequirementsCompliance24( + mt5: mt5 ?? this.mt5, + taxInformation: taxInformation ?? this.taxInformation, + ); +} +/// Mt all company model class. +abstract class MtAllCompanyModel { + /// Initializes Mt all company model class . + const MtAllCompanyModel({ + this.swapFree, + }); + + /// Landing Company for MT5 combined all Synthetic and financial + final SwapFree? swapFree; +} + +/// Mt all company class. +class MtAllCompany extends MtAllCompanyModel { + /// Initializes Mt all company class. + const MtAllCompany({ + super.swapFree, + }); + + /// Creates an instance from JSON. + factory MtAllCompany.fromJson(Map json) => MtAllCompany( + swapFree: json['swap_free'] == null + ? null + : SwapFree.fromJson(json['swap_free']), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (swapFree != null) { + resultMap['swap_free'] = swapFree!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + MtAllCompany copyWith({ + SwapFree? swapFree, + }) => + MtAllCompany( + swapFree: swapFree ?? this.swapFree, + ); +} +/// Swap free model class. +abstract class SwapFreeModel { + /// Initializes Swap free model class . + const SwapFreeModel({ + this.address, + this.changeableFields, + this.country, + this.currencyConfig, + this.hasRealityCheck, + this.legalAllowedContractCategories, + this.legalAllowedCurrencies, + this.legalAllowedMarkets, + this.legalDefaultCurrency, + this.name, + this.requirements, + this.shortcode, + this.supportProfessionalClient, + this.tinNotMandatory, + }); + + /// Landing Company address + final List? address; + + /// Special conditions for changing sensitive fields + final Map? changeableFields; + + /// Landing Company country of incorporation + final String? country; + + /// The configuration of each currency. + final Map? currencyConfig; + + /// Flag to indicate whether reality check is applicable for this Landing Company. `true`: applicable, `false`: not applicable. The Reality Check is a feature that gives a summary of the client's trades and account balances on a regular basis throughout his session, and is a regulatory requirement for certain Landing Companies. + final bool? hasRealityCheck; + + /// Allowed contract types + final List? legalAllowedContractCategories; + + /// Allowable currencies + final List? legalAllowedCurrencies; + + /// Allowable markets + final List? legalAllowedMarkets; + + /// Default account currency + final String? legalDefaultCurrency; + + /// Landing Company legal name + final String? name; + + /// Legal requirements for the Landing Company + final SwapFreeRequirements? requirements; + + /// Landing Company short code + final String? shortcode; + + /// Flag that indicates whether the landing company supports professional accounts or not + final bool? supportProfessionalClient; + + /// Flag that indicates whether tax identifier number is not mandatory for the current country and landing company. + final bool? tinNotMandatory; +} + +/// Swap free class. +class SwapFree extends SwapFreeModel { + /// Initializes Swap free class. + const SwapFree({ + super.address, + super.changeableFields, + super.country, + super.currencyConfig, + super.hasRealityCheck, + super.legalAllowedContractCategories, + super.legalAllowedCurrencies, + super.legalAllowedMarkets, + super.legalDefaultCurrency, + super.name, + super.requirements, + super.shortcode, + super.supportProfessionalClient, + super.tinNotMandatory, + }); /// Creates an instance from JSON. - factory GamingCompany.fromJson(Map json) => GamingCompany( + factory SwapFree.fromJson(Map json) => SwapFree( address: json['address'] == null ? null : List.from( @@ -2589,9 +3168,10 @@ class GamingCompany extends GamingCompanyModel { name: json['name'], requirements: json['requirements'] == null ? null - : GamingCompanyRequirements.fromJson(json['requirements']), + : SwapFreeRequirements.fromJson(json['requirements']), shortcode: json['shortcode'], supportProfessionalClient: getBool(json['support_professional_client']), + tinNotMandatory: getBool(json['tin_not_mandatory']), ); /// Converts an instance to JSON. @@ -2638,12 +3218,13 @@ class GamingCompany extends GamingCompanyModel { } resultMap['shortcode'] = shortcode; resultMap['support_professional_client'] = supportProfessionalClient; + resultMap['tin_not_mandatory'] = tinNotMandatory; return resultMap; } /// Creates a copy of instance with given parameters. - GamingCompany copyWith({ + SwapFree copyWith({ List? address, Map? changeableFields, String? country, @@ -2654,11 +3235,12 @@ class GamingCompany extends GamingCompanyModel { List? legalAllowedMarkets, String? legalDefaultCurrency, String? name, - GamingCompanyRequirements? requirements, + SwapFreeRequirements? requirements, String? shortcode, bool? supportProfessionalClient, + bool? tinNotMandatory, }) => - GamingCompany( + SwapFree( address: address ?? this.address, changeableFields: changeableFields ?? this.changeableFields, country: country ?? this.country, @@ -2675,13 +3257,13 @@ class GamingCompany extends GamingCompanyModel { shortcode: shortcode ?? this.shortcode, supportProfessionalClient: supportProfessionalClient ?? this.supportProfessionalClient, + tinNotMandatory: tinNotMandatory ?? this.tinNotMandatory, ); } - -/// Gaming company requirements model class. -abstract class GamingCompanyRequirementsModel { - /// Initializes Gaming company requirements model class . - const GamingCompanyRequirementsModel({ +/// Swap free requirements model class. +abstract class SwapFreeRequirementsModel { + /// Initializes Swap free requirements model class . + const SwapFreeRequirementsModel({ this.afterFirstDeposit, this.compliance, this.signup, @@ -2689,10 +3271,10 @@ abstract class GamingCompanyRequirementsModel { }); /// After first deposit requirements - final RequirementsAfterFirstDeposit2? afterFirstDeposit; + final RequirementsAfterFirstDeposit27? afterFirstDeposit; /// Compliance requirements - final RequirementsCompliance2? compliance; + final RequirementsCompliance28? compliance; /// Sign up requirements final List? signup; @@ -2701,31 +3283,26 @@ abstract class GamingCompanyRequirementsModel { final List? withdrawal; } -/// Gaming company requirements class. -class GamingCompanyRequirements extends GamingCompanyRequirementsModel { - /// Initializes Gaming company requirements class. - const GamingCompanyRequirements({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, - List? signup, - List? withdrawal, - }) : super( - afterFirstDeposit: afterFirstDeposit, - compliance: compliance, - signup: signup, - withdrawal: withdrawal, - ); +/// Swap free requirements class. +class SwapFreeRequirements extends SwapFreeRequirementsModel { + /// Initializes Swap free requirements class. + const SwapFreeRequirements({ + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); /// Creates an instance from JSON. - factory GamingCompanyRequirements.fromJson(Map json) => - GamingCompanyRequirements( + factory SwapFreeRequirements.fromJson(Map json) => + SwapFreeRequirements( afterFirstDeposit: json['after_first_deposit'] == null ? null - : RequirementsAfterFirstDeposit2.fromJson( + : RequirementsAfterFirstDeposit27.fromJson( json['after_first_deposit']), compliance: json['compliance'] == null ? null - : RequirementsCompliance2.fromJson(json['compliance']), + : RequirementsCompliance28.fromJson(json['compliance']), signup: json['signup'] == null ? null : List.from( @@ -2771,20 +3348,147 @@ class GamingCompanyRequirements extends GamingCompanyRequirementsModel { } /// Creates a copy of instance with given parameters. - GamingCompanyRequirements copyWith({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, + SwapFreeRequirements copyWith({ + RequirementsAfterFirstDeposit27? afterFirstDeposit, + RequirementsCompliance28? compliance, List? signup, List? withdrawal, }) => - GamingCompanyRequirements( + SwapFreeRequirements( afterFirstDeposit: afterFirstDeposit ?? this.afterFirstDeposit, compliance: compliance ?? this.compliance, signup: signup ?? this.signup, withdrawal: withdrawal ?? this.withdrawal, ); } +/// Requirements after first deposit27 model class. +abstract class RequirementsAfterFirstDeposit27Model { + /// Initializes Requirements after first deposit27 model class . + const RequirementsAfterFirstDeposit27Model({ + this.financialAssessment, + }); + + /// Financial assessment requirements + final List? financialAssessment; +} + +/// Requirements after first deposit27 class. +class RequirementsAfterFirstDeposit27 + extends RequirementsAfterFirstDeposit27Model { + /// Initializes Requirements after first deposit27 class. + const RequirementsAfterFirstDeposit27({ + super.financialAssessment, + }); + + /// Creates an instance from JSON. + factory RequirementsAfterFirstDeposit27.fromJson(Map json) => + RequirementsAfterFirstDeposit27( + financialAssessment: json['financial_assessment'] == null + ? null + : List.from( + json['financial_assessment']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (financialAssessment != null) { + resultMap['financial_assessment'] = financialAssessment! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + RequirementsAfterFirstDeposit27 copyWith({ + List? financialAssessment, + }) => + RequirementsAfterFirstDeposit27( + financialAssessment: financialAssessment ?? this.financialAssessment, + ); +} +/// Requirements compliance28 model class. +abstract class RequirementsCompliance28Model { + /// Initializes Requirements compliance28 model class . + const RequirementsCompliance28Model({ + this.mt5, + this.taxInformation, + }); + + /// Compliance MT5 requirements + final List? mt5; + + /// Compliance tax information requirements + final List? taxInformation; +} + +/// Requirements compliance28 class. +class RequirementsCompliance28 extends RequirementsCompliance28Model { + /// Initializes Requirements compliance28 class. + const RequirementsCompliance28({ + super.mt5, + super.taxInformation, + }); + + /// Creates an instance from JSON. + factory RequirementsCompliance28.fromJson(Map json) => + RequirementsCompliance28( + mt5: json['mt5'] == null + ? null + : List.from( + json['mt5']?.map( + (dynamic item) => item, + ), + ), + taxInformation: json['tax_information'] == null + ? null + : List.from( + json['tax_information']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (mt5 != null) { + resultMap['mt5'] = mt5! + .map( + (String item) => item, + ) + .toList(); + } + if (taxInformation != null) { + resultMap['tax_information'] = taxInformation! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + /// Creates a copy of instance with given parameters. + RequirementsCompliance28 copyWith({ + List? mt5, + List? taxInformation, + }) => + RequirementsCompliance28( + mt5: mt5 ?? this.mt5, + taxInformation: taxInformation ?? this.taxInformation, + ); +} /// Mt financial company model class. abstract class MtFinancialCompanyModel { /// Initializes Mt financial company model class . @@ -2804,12 +3508,9 @@ abstract class MtFinancialCompanyModel { class MtFinancialCompany extends MtFinancialCompanyModel { /// Initializes Mt financial company class. const MtFinancialCompany({ - Financial? financial, - FinancialStp? financialStp, - }) : super( - financial: financial, - financialStp: financialStp, - ); + super.financial, + super.financialStp, + }); /// Creates an instance from JSON. factory MtFinancialCompany.fromJson(Map json) => @@ -2846,7 +3547,6 @@ class MtFinancialCompany extends MtFinancialCompanyModel { financialStp: financialStp ?? this.financialStp, ); } - /// Financial model class. abstract class FinancialModel { /// Initializes Financial model class . @@ -2864,6 +3564,7 @@ abstract class FinancialModel { this.requirements, this.shortcode, this.supportProfessionalClient, + this.tinNotMandatory, }); /// Landing Company address @@ -2904,40 +3605,30 @@ abstract class FinancialModel { /// Flag that indicates whether the landing company supports professional accounts or not final bool? supportProfessionalClient; + + /// Flag that indicates whether tax identifier number is not mandatory for the current country and landing company. + final bool? tinNotMandatory; } /// Financial class. class Financial extends FinancialModel { /// Initializes Financial class. const Financial({ - List? address, - Map? changeableFields, - String? country, - Map? currencyConfig, - bool? hasRealityCheck, - List? legalAllowedContractCategories, - List? legalAllowedCurrencies, - List? legalAllowedMarkets, - String? legalDefaultCurrency, - String? name, - FinancialRequirements? requirements, - String? shortcode, - bool? supportProfessionalClient, - }) : super( - address: address, - changeableFields: changeableFields, - country: country, - currencyConfig: currencyConfig, - hasRealityCheck: hasRealityCheck, - legalAllowedContractCategories: legalAllowedContractCategories, - legalAllowedCurrencies: legalAllowedCurrencies, - legalAllowedMarkets: legalAllowedMarkets, - legalDefaultCurrency: legalDefaultCurrency, - name: name, - requirements: requirements, - shortcode: shortcode, - supportProfessionalClient: supportProfessionalClient, - ); + super.address, + super.changeableFields, + super.country, + super.currencyConfig, + super.hasRealityCheck, + super.legalAllowedContractCategories, + super.legalAllowedCurrencies, + super.legalAllowedMarkets, + super.legalDefaultCurrency, + super.name, + super.requirements, + super.shortcode, + super.supportProfessionalClient, + super.tinNotMandatory, + }); /// Creates an instance from JSON. factory Financial.fromJson(Map json) => Financial( @@ -2981,6 +3672,7 @@ class Financial extends FinancialModel { : FinancialRequirements.fromJson(json['requirements']), shortcode: json['shortcode'], supportProfessionalClient: getBool(json['support_professional_client']), + tinNotMandatory: getBool(json['tin_not_mandatory']), ); /// Converts an instance to JSON. @@ -3027,6 +3719,7 @@ class Financial extends FinancialModel { } resultMap['shortcode'] = shortcode; resultMap['support_professional_client'] = supportProfessionalClient; + resultMap['tin_not_mandatory'] = tinNotMandatory; return resultMap; } @@ -3046,6 +3739,7 @@ class Financial extends FinancialModel { FinancialRequirements? requirements, String? shortcode, bool? supportProfessionalClient, + bool? tinNotMandatory, }) => Financial( address: address ?? this.address, @@ -3064,9 +3758,9 @@ class Financial extends FinancialModel { shortcode: shortcode ?? this.shortcode, supportProfessionalClient: supportProfessionalClient ?? this.supportProfessionalClient, + tinNotMandatory: tinNotMandatory ?? this.tinNotMandatory, ); } - /// Financial requirements model class. abstract class FinancialRequirementsModel { /// Initializes Financial requirements model class . @@ -3078,10 +3772,10 @@ abstract class FinancialRequirementsModel { }); /// After first deposit requirements - final RequirementsAfterFirstDeposit2? afterFirstDeposit; + final RequirementsAfterFirstDeposit32? afterFirstDeposit; /// Compliance requirements - final RequirementsCompliance2? compliance; + final RequirementsCompliance33? compliance; /// Sign up requirements final List? signup; @@ -3094,27 +3788,22 @@ abstract class FinancialRequirementsModel { class FinancialRequirements extends FinancialRequirementsModel { /// Initializes Financial requirements class. const FinancialRequirements({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, - List? signup, - List? withdrawal, - }) : super( - afterFirstDeposit: afterFirstDeposit, - compliance: compliance, - signup: signup, - withdrawal: withdrawal, - ); + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); /// Creates an instance from JSON. factory FinancialRequirements.fromJson(Map json) => FinancialRequirements( afterFirstDeposit: json['after_first_deposit'] == null ? null - : RequirementsAfterFirstDeposit2.fromJson( + : RequirementsAfterFirstDeposit32.fromJson( json['after_first_deposit']), compliance: json['compliance'] == null ? null - : RequirementsCompliance2.fromJson(json['compliance']), + : RequirementsCompliance33.fromJson(json['compliance']), signup: json['signup'] == null ? null : List.from( @@ -3148,8 +3837,140 @@ class FinancialRequirements extends FinancialRequirementsModel { ) .toList(); } - if (withdrawal != null) { - resultMap['withdrawal'] = withdrawal! + if (withdrawal != null) { + resultMap['withdrawal'] = withdrawal! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + FinancialRequirements copyWith({ + RequirementsAfterFirstDeposit32? afterFirstDeposit, + RequirementsCompliance33? compliance, + List? signup, + List? withdrawal, + }) => + FinancialRequirements( + afterFirstDeposit: afterFirstDeposit ?? this.afterFirstDeposit, + compliance: compliance ?? this.compliance, + signup: signup ?? this.signup, + withdrawal: withdrawal ?? this.withdrawal, + ); +} +/// Requirements after first deposit32 model class. +abstract class RequirementsAfterFirstDeposit32Model { + /// Initializes Requirements after first deposit32 model class . + const RequirementsAfterFirstDeposit32Model({ + this.financialAssessment, + }); + + /// Financial assessment requirements + final List? financialAssessment; +} + +/// Requirements after first deposit32 class. +class RequirementsAfterFirstDeposit32 + extends RequirementsAfterFirstDeposit32Model { + /// Initializes Requirements after first deposit32 class. + const RequirementsAfterFirstDeposit32({ + super.financialAssessment, + }); + + /// Creates an instance from JSON. + factory RequirementsAfterFirstDeposit32.fromJson(Map json) => + RequirementsAfterFirstDeposit32( + financialAssessment: json['financial_assessment'] == null + ? null + : List.from( + json['financial_assessment']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (financialAssessment != null) { + resultMap['financial_assessment'] = financialAssessment! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + RequirementsAfterFirstDeposit32 copyWith({ + List? financialAssessment, + }) => + RequirementsAfterFirstDeposit32( + financialAssessment: financialAssessment ?? this.financialAssessment, + ); +} +/// Requirements compliance33 model class. +abstract class RequirementsCompliance33Model { + /// Initializes Requirements compliance33 model class . + const RequirementsCompliance33Model({ + this.mt5, + this.taxInformation, + }); + + /// Compliance MT5 requirements + final List? mt5; + + /// Compliance tax information requirements + final List? taxInformation; +} + +/// Requirements compliance33 class. +class RequirementsCompliance33 extends RequirementsCompliance33Model { + /// Initializes Requirements compliance33 class. + const RequirementsCompliance33({ + super.mt5, + super.taxInformation, + }); + + /// Creates an instance from JSON. + factory RequirementsCompliance33.fromJson(Map json) => + RequirementsCompliance33( + mt5: json['mt5'] == null + ? null + : List.from( + json['mt5']?.map( + (dynamic item) => item, + ), + ), + taxInformation: json['tax_information'] == null + ? null + : List.from( + json['tax_information']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (mt5 != null) { + resultMap['mt5'] = mt5! + .map( + (String item) => item, + ) + .toList(); + } + if (taxInformation != null) { + resultMap['tax_information'] = taxInformation! .map( (String item) => item, ) @@ -3160,20 +3981,15 @@ class FinancialRequirements extends FinancialRequirementsModel { } /// Creates a copy of instance with given parameters. - FinancialRequirements copyWith({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, - List? signup, - List? withdrawal, + RequirementsCompliance33 copyWith({ + List? mt5, + List? taxInformation, }) => - FinancialRequirements( - afterFirstDeposit: afterFirstDeposit ?? this.afterFirstDeposit, - compliance: compliance ?? this.compliance, - signup: signup ?? this.signup, - withdrawal: withdrawal ?? this.withdrawal, + RequirementsCompliance33( + mt5: mt5 ?? this.mt5, + taxInformation: taxInformation ?? this.taxInformation, ); } - /// Financial stp model class. abstract class FinancialStpModel { /// Initializes Financial stp model class . @@ -3191,6 +4007,7 @@ abstract class FinancialStpModel { this.requirements, this.shortcode, this.supportProfessionalClient, + this.tinNotMandatory, }); /// Landing Company address @@ -3231,40 +4048,30 @@ abstract class FinancialStpModel { /// Flag that indicates whether the landing company supports professional accounts or not final bool? supportProfessionalClient; + + /// Flag that indicates whether tax identifier number is not mandatory for the current country and landing company. + final bool? tinNotMandatory; } /// Financial stp class. class FinancialStp extends FinancialStpModel { /// Initializes Financial stp class. const FinancialStp({ - List? address, - Map? changeableFields, - String? country, - Map? currencyConfig, - bool? hasRealityCheck, - List? legalAllowedContractCategories, - List? legalAllowedCurrencies, - List? legalAllowedMarkets, - String? legalDefaultCurrency, - String? name, - FinancialStpRequirements? requirements, - String? shortcode, - bool? supportProfessionalClient, - }) : super( - address: address, - changeableFields: changeableFields, - country: country, - currencyConfig: currencyConfig, - hasRealityCheck: hasRealityCheck, - legalAllowedContractCategories: legalAllowedContractCategories, - legalAllowedCurrencies: legalAllowedCurrencies, - legalAllowedMarkets: legalAllowedMarkets, - legalDefaultCurrency: legalDefaultCurrency, - name: name, - requirements: requirements, - shortcode: shortcode, - supportProfessionalClient: supportProfessionalClient, - ); + super.address, + super.changeableFields, + super.country, + super.currencyConfig, + super.hasRealityCheck, + super.legalAllowedContractCategories, + super.legalAllowedCurrencies, + super.legalAllowedMarkets, + super.legalDefaultCurrency, + super.name, + super.requirements, + super.shortcode, + super.supportProfessionalClient, + super.tinNotMandatory, + }); /// Creates an instance from JSON. factory FinancialStp.fromJson(Map json) => FinancialStp( @@ -3308,6 +4115,7 @@ class FinancialStp extends FinancialStpModel { : FinancialStpRequirements.fromJson(json['requirements']), shortcode: json['shortcode'], supportProfessionalClient: getBool(json['support_professional_client']), + tinNotMandatory: getBool(json['tin_not_mandatory']), ); /// Converts an instance to JSON. @@ -3354,6 +4162,7 @@ class FinancialStp extends FinancialStpModel { } resultMap['shortcode'] = shortcode; resultMap['support_professional_client'] = supportProfessionalClient; + resultMap['tin_not_mandatory'] = tinNotMandatory; return resultMap; } @@ -3373,6 +4182,7 @@ class FinancialStp extends FinancialStpModel { FinancialStpRequirements? requirements, String? shortcode, bool? supportProfessionalClient, + bool? tinNotMandatory, }) => FinancialStp( address: address ?? this.address, @@ -3391,9 +4201,9 @@ class FinancialStp extends FinancialStpModel { shortcode: shortcode ?? this.shortcode, supportProfessionalClient: supportProfessionalClient ?? this.supportProfessionalClient, + tinNotMandatory: tinNotMandatory ?? this.tinNotMandatory, ); } - /// Financial stp requirements model class. abstract class FinancialStpRequirementsModel { /// Initializes Financial stp requirements model class . @@ -3405,10 +4215,10 @@ abstract class FinancialStpRequirementsModel { }); /// After first deposit requirements - final RequirementsAfterFirstDeposit2? afterFirstDeposit; + final RequirementsAfterFirstDeposit36? afterFirstDeposit; /// Compliance requirements - final RequirementsCompliance2? compliance; + final RequirementsCompliance37? compliance; /// Sign up requirements final List? signup; @@ -3421,27 +4231,22 @@ abstract class FinancialStpRequirementsModel { class FinancialStpRequirements extends FinancialStpRequirementsModel { /// Initializes Financial stp requirements class. const FinancialStpRequirements({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, - List? signup, - List? withdrawal, - }) : super( - afterFirstDeposit: afterFirstDeposit, - compliance: compliance, - signup: signup, - withdrawal: withdrawal, - ); + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); /// Creates an instance from JSON. factory FinancialStpRequirements.fromJson(Map json) => FinancialStpRequirements( afterFirstDeposit: json['after_first_deposit'] == null ? null - : RequirementsAfterFirstDeposit2.fromJson( + : RequirementsAfterFirstDeposit36.fromJson( json['after_first_deposit']), compliance: json['compliance'] == null ? null - : RequirementsCompliance2.fromJson(json['compliance']), + : RequirementsCompliance37.fromJson(json['compliance']), signup: json['signup'] == null ? null : List.from( @@ -3488,8 +4293,8 @@ class FinancialStpRequirements extends FinancialStpRequirementsModel { /// Creates a copy of instance with given parameters. FinancialStpRequirements copyWith({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, + RequirementsAfterFirstDeposit36? afterFirstDeposit, + RequirementsCompliance37? compliance, List? signup, List? withdrawal, }) => @@ -3500,7 +4305,134 @@ class FinancialStpRequirements extends FinancialStpRequirementsModel { withdrawal: withdrawal ?? this.withdrawal, ); } +/// Requirements after first deposit36 model class. +abstract class RequirementsAfterFirstDeposit36Model { + /// Initializes Requirements after first deposit36 model class . + const RequirementsAfterFirstDeposit36Model({ + this.financialAssessment, + }); + + /// Financial assessment requirements + final List? financialAssessment; +} + +/// Requirements after first deposit36 class. +class RequirementsAfterFirstDeposit36 + extends RequirementsAfterFirstDeposit36Model { + /// Initializes Requirements after first deposit36 class. + const RequirementsAfterFirstDeposit36({ + super.financialAssessment, + }); + + /// Creates an instance from JSON. + factory RequirementsAfterFirstDeposit36.fromJson(Map json) => + RequirementsAfterFirstDeposit36( + financialAssessment: json['financial_assessment'] == null + ? null + : List.from( + json['financial_assessment']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (financialAssessment != null) { + resultMap['financial_assessment'] = financialAssessment! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + RequirementsAfterFirstDeposit36 copyWith({ + List? financialAssessment, + }) => + RequirementsAfterFirstDeposit36( + financialAssessment: financialAssessment ?? this.financialAssessment, + ); +} +/// Requirements compliance37 model class. +abstract class RequirementsCompliance37Model { + /// Initializes Requirements compliance37 model class . + const RequirementsCompliance37Model({ + this.mt5, + this.taxInformation, + }); + + /// Compliance MT5 requirements + final List? mt5; + + /// Compliance tax information requirements + final List? taxInformation; +} + +/// Requirements compliance37 class. +class RequirementsCompliance37 extends RequirementsCompliance37Model { + /// Initializes Requirements compliance37 class. + const RequirementsCompliance37({ + super.mt5, + super.taxInformation, + }); + + /// Creates an instance from JSON. + factory RequirementsCompliance37.fromJson(Map json) => + RequirementsCompliance37( + mt5: json['mt5'] == null + ? null + : List.from( + json['mt5']?.map( + (dynamic item) => item, + ), + ), + taxInformation: json['tax_information'] == null + ? null + : List.from( + json['tax_information']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (mt5 != null) { + resultMap['mt5'] = mt5! + .map( + (String item) => item, + ) + .toList(); + } + if (taxInformation != null) { + resultMap['tax_information'] = taxInformation! + .map( + (String item) => item, + ) + .toList(); + } + return resultMap; + } + + /// Creates a copy of instance with given parameters. + RequirementsCompliance37 copyWith({ + List? mt5, + List? taxInformation, + }) => + RequirementsCompliance37( + mt5: mt5 ?? this.mt5, + taxInformation: taxInformation ?? this.taxInformation, + ); +} /// Mt gaming company model class. abstract class MtGamingCompanyModel { /// Initializes Mt gaming company model class . @@ -3516,10 +4448,8 @@ abstract class MtGamingCompanyModel { class MtGamingCompany extends MtGamingCompanyModel { /// Initializes Mt gaming company class. const MtGamingCompany({ - MtGamingCompanyFinancial? financial, - }) : super( - financial: financial, - ); + super.financial, + }); /// Creates an instance from JSON. factory MtGamingCompany.fromJson(Map json) => @@ -3548,7 +4478,6 @@ class MtGamingCompany extends MtGamingCompanyModel { financial: financial ?? this.financial, ); } - /// Mt gaming company financial model class. abstract class MtGamingCompanyFinancialModel { /// Initializes Mt gaming company financial model class . @@ -3566,6 +4495,7 @@ abstract class MtGamingCompanyFinancialModel { this.requirements, this.shortcode, this.supportProfessionalClient, + this.tinNotMandatory, }); /// Landing Company address @@ -3599,47 +4529,37 @@ abstract class MtGamingCompanyFinancialModel { final String? name; /// Legal requirements for the Landing Company - final FinancialRequirements2? requirements; + final FinancialRequirements43? requirements; /// Landing Company short code final String? shortcode; /// Flag that indicates whether the landing company supports professional accounts or not final bool? supportProfessionalClient; + + /// Flag that indicates whether tax identifier number is not mandatory for the current country and landing company. + final bool? tinNotMandatory; } /// Mt gaming company financial class. class MtGamingCompanyFinancial extends MtGamingCompanyFinancialModel { /// Initializes Mt gaming company financial class. const MtGamingCompanyFinancial({ - List? address, - Map? changeableFields, - String? country, - Map? currencyConfig, - bool? hasRealityCheck, - List? legalAllowedContractCategories, - List? legalAllowedCurrencies, - List? legalAllowedMarkets, - String? legalDefaultCurrency, - String? name, - FinancialRequirements2? requirements, - String? shortcode, - bool? supportProfessionalClient, - }) : super( - address: address, - changeableFields: changeableFields, - country: country, - currencyConfig: currencyConfig, - hasRealityCheck: hasRealityCheck, - legalAllowedContractCategories: legalAllowedContractCategories, - legalAllowedCurrencies: legalAllowedCurrencies, - legalAllowedMarkets: legalAllowedMarkets, - legalDefaultCurrency: legalDefaultCurrency, - name: name, - requirements: requirements, - shortcode: shortcode, - supportProfessionalClient: supportProfessionalClient, - ); + super.address, + super.changeableFields, + super.country, + super.currencyConfig, + super.hasRealityCheck, + super.legalAllowedContractCategories, + super.legalAllowedCurrencies, + super.legalAllowedMarkets, + super.legalDefaultCurrency, + super.name, + super.requirements, + super.shortcode, + super.supportProfessionalClient, + super.tinNotMandatory, + }); /// Creates an instance from JSON. factory MtGamingCompanyFinancial.fromJson(Map json) => @@ -3681,9 +4601,10 @@ class MtGamingCompanyFinancial extends MtGamingCompanyFinancialModel { name: json['name'], requirements: json['requirements'] == null ? null - : FinancialRequirements2.fromJson(json['requirements']), + : FinancialRequirements43.fromJson(json['requirements']), shortcode: json['shortcode'], supportProfessionalClient: getBool(json['support_professional_client']), + tinNotMandatory: getBool(json['tin_not_mandatory']), ); /// Converts an instance to JSON. @@ -3730,6 +4651,7 @@ class MtGamingCompanyFinancial extends MtGamingCompanyFinancialModel { } resultMap['shortcode'] = shortcode; resultMap['support_professional_client'] = supportProfessionalClient; + resultMap['tin_not_mandatory'] = tinNotMandatory; return resultMap; } @@ -3746,9 +4668,10 @@ class MtGamingCompanyFinancial extends MtGamingCompanyFinancialModel { List? legalAllowedMarkets, String? legalDefaultCurrency, String? name, - FinancialRequirements2? requirements, + FinancialRequirements43? requirements, String? shortcode, bool? supportProfessionalClient, + bool? tinNotMandatory, }) => MtGamingCompanyFinancial( address: address ?? this.address, @@ -3767,13 +4690,13 @@ class MtGamingCompanyFinancial extends MtGamingCompanyFinancialModel { shortcode: shortcode ?? this.shortcode, supportProfessionalClient: supportProfessionalClient ?? this.supportProfessionalClient, + tinNotMandatory: tinNotMandatory ?? this.tinNotMandatory, ); } - -/// Financial requirements2 model class. -abstract class FinancialRequirements2Model { - /// Initializes Financial requirements2 model class . - const FinancialRequirements2Model({ +/// Financial requirements43 model class. +abstract class FinancialRequirements43Model { + /// Initializes Financial requirements43 model class . + const FinancialRequirements43Model({ this.afterFirstDeposit, this.compliance, this.signup, @@ -3781,10 +4704,10 @@ abstract class FinancialRequirements2Model { }); /// After first deposit requirements - final RequirementsAfterFirstDeposit2? afterFirstDeposit; + final RequirementsAfterFirstDeposit41? afterFirstDeposit; /// Compliance requirements - final RequirementsCompliance2? compliance; + final RequirementsCompliance42? compliance; /// Sign up requirements final List? signup; @@ -3793,31 +4716,26 @@ abstract class FinancialRequirements2Model { final List? withdrawal; } -/// Financial requirements2 class. -class FinancialRequirements2 extends FinancialRequirements2Model { - /// Initializes Financial requirements2 class. - const FinancialRequirements2({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, - List? signup, - List? withdrawal, - }) : super( - afterFirstDeposit: afterFirstDeposit, - compliance: compliance, - signup: signup, - withdrawal: withdrawal, - ); +/// Financial requirements43 class. +class FinancialRequirements43 extends FinancialRequirements43Model { + /// Initializes Financial requirements43 class. + const FinancialRequirements43({ + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); /// Creates an instance from JSON. - factory FinancialRequirements2.fromJson(Map json) => - FinancialRequirements2( + factory FinancialRequirements43.fromJson(Map json) => + FinancialRequirements43( afterFirstDeposit: json['after_first_deposit'] == null ? null - : RequirementsAfterFirstDeposit2.fromJson( + : RequirementsAfterFirstDeposit41.fromJson( json['after_first_deposit']), compliance: json['compliance'] == null ? null - : RequirementsCompliance2.fromJson(json['compliance']), + : RequirementsCompliance42.fromJson(json['compliance']), signup: json['signup'] == null ? null : List.from( @@ -3863,16 +4781,144 @@ class FinancialRequirements2 extends FinancialRequirements2Model { } /// Creates a copy of instance with given parameters. - FinancialRequirements2 copyWith({ - RequirementsAfterFirstDeposit2? afterFirstDeposit, - RequirementsCompliance2? compliance, + FinancialRequirements43 copyWith({ + RequirementsAfterFirstDeposit41? afterFirstDeposit, + RequirementsCompliance42? compliance, List? signup, List? withdrawal, }) => - FinancialRequirements2( + FinancialRequirements43( afterFirstDeposit: afterFirstDeposit ?? this.afterFirstDeposit, compliance: compliance ?? this.compliance, signup: signup ?? this.signup, withdrawal: withdrawal ?? this.withdrawal, ); } +/// Requirements after first deposit41 model class. +abstract class RequirementsAfterFirstDeposit41Model { + /// Initializes Requirements after first deposit41 model class . + const RequirementsAfterFirstDeposit41Model({ + this.financialAssessment, + }); + + /// Financial assessment requirements + final List? financialAssessment; +} + +/// Requirements after first deposit41 class. +class RequirementsAfterFirstDeposit41 + extends RequirementsAfterFirstDeposit41Model { + /// Initializes Requirements after first deposit41 class. + const RequirementsAfterFirstDeposit41({ + super.financialAssessment, + }); + + /// Creates an instance from JSON. + factory RequirementsAfterFirstDeposit41.fromJson(Map json) => + RequirementsAfterFirstDeposit41( + financialAssessment: json['financial_assessment'] == null + ? null + : List.from( + json['financial_assessment']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (financialAssessment != null) { + resultMap['financial_assessment'] = financialAssessment! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + RequirementsAfterFirstDeposit41 copyWith({ + List? financialAssessment, + }) => + RequirementsAfterFirstDeposit41( + financialAssessment: financialAssessment ?? this.financialAssessment, + ); +} +/// Requirements compliance42 model class. +abstract class RequirementsCompliance42Model { + /// Initializes Requirements compliance42 model class . + const RequirementsCompliance42Model({ + this.mt5, + this.taxInformation, + }); + + /// Compliance MT5 requirements + final List? mt5; + + /// Compliance tax information requirements + final List? taxInformation; +} + +/// Requirements compliance42 class. +class RequirementsCompliance42 extends RequirementsCompliance42Model { + /// Initializes Requirements compliance42 class. + const RequirementsCompliance42({ + super.mt5, + super.taxInformation, + }); + + /// Creates an instance from JSON. + factory RequirementsCompliance42.fromJson(Map json) => + RequirementsCompliance42( + mt5: json['mt5'] == null + ? null + : List.from( + json['mt5']?.map( + (dynamic item) => item, + ), + ), + taxInformation: json['tax_information'] == null + ? null + : List.from( + json['tax_information']?.map( + (dynamic item) => item, + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (mt5 != null) { + resultMap['mt5'] = mt5! + .map( + (String item) => item, + ) + .toList(); + } + if (taxInformation != null) { + resultMap['tax_information'] = taxInformation! + .map( + (String item) => item, + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + RequirementsCompliance42 copyWith({ + List? mt5, + List? taxInformation, + }) => + RequirementsCompliance42( + mt5: mt5 ?? this.mt5, + taxInformation: taxInformation ?? this.taxInformation, + ); +} diff --git a/lib/api/response/link_wallet_response_result.dart b/lib/api/response/link_wallet_response_result.dart index 319d0737c3..2517470ee3 100644 --- a/lib/api/response/link_wallet_response_result.dart +++ b/lib/api/response/link_wallet_response_result.dart @@ -19,10 +19,8 @@ abstract class LinkWalletResponseModel { class LinkWalletResponse extends LinkWalletResponseModel { /// Initializes Link wallet response class. const LinkWalletResponse({ - int? linkWallet, - }) : super( - linkWallet: linkWallet, - ); + super.linkWallet, + }); /// Creates an instance from JSON. factory LinkWalletResponse.fromJson( diff --git a/lib/api/response/mt5_get_settings_response_result.dart b/lib/api/response/mt5_get_settings_response_result.dart index 0f4c73534d..5a2dc3d5ef 100644 --- a/lib/api/response/mt5_get_settings_response_result.dart +++ b/lib/api/response/mt5_get_settings_response_result.dart @@ -25,10 +25,8 @@ abstract class Mt5GetSettingsResponseModel { class Mt5GetSettingsResponse extends Mt5GetSettingsResponseModel { /// Initializes Mt5 get settings response class. const Mt5GetSettingsResponse({ - Mt5GetSettings? mt5GetSettings, - }) : super( - mt5GetSettings: mt5GetSettings, - ); + super.mt5GetSettings, + }); /// Creates an instance from JSON. factory Mt5GetSettingsResponse.fromJson( @@ -103,6 +101,7 @@ final Map landingCompanyShortEnumMapper = "labuan": LandingCompanyShortEnum.labuan, "malta": LandingCompanyShortEnum.malta, "maltainvest": LandingCompanyShortEnum.maltainvest, + "seychelles": LandingCompanyShortEnum.seychelles, "svg": LandingCompanyShortEnum.svg, "vanuatu": LandingCompanyShortEnum.vanuatu, }; @@ -121,6 +120,9 @@ enum LandingCompanyShortEnum { /// maltainvest. maltainvest, + /// seychelles. + seychelles, + /// svg. svg, @@ -131,12 +133,16 @@ enum LandingCompanyShortEnum { /// MarketTypeEnum mapper. final Map marketTypeEnumMapper = { + "all": MarketTypeEnum.all, "financial": MarketTypeEnum.financial, "synthetic": MarketTypeEnum.synthetic, }; /// MarketType Enum. enum MarketTypeEnum { + /// all. + all, + /// financial. financial, @@ -144,22 +150,81 @@ enum MarketTypeEnum { synthetic, } +/// EnvironmentEnum mapper. +final Map environmentEnumMapper = + { + "Deriv-Demo": EnvironmentEnum.derivDemo, + "Deriv-Server": EnvironmentEnum.derivServer, + "Deriv-Server-02": EnvironmentEnum.derivServer02, +}; + +/// Environment Enum. +enum EnvironmentEnum { + /// Deriv-Demo. + derivDemo, + + /// Deriv-Server. + derivServer, + + /// Deriv-Server-02. + derivServer02, +} + +/// SubAccountCategoryEnum mapper. +final Map subAccountCategoryEnumMapper = + { + "none": SubAccountCategoryEnum.none, + "ibt": SubAccountCategoryEnum.ibt, + "lim": SubAccountCategoryEnum.lim, + "stp": SubAccountCategoryEnum.stp, + "swap_free": SubAccountCategoryEnum.swapFree, + "swap_free_high_risk": SubAccountCategoryEnum.swapFreeHighRisk, +}; + +/// SubAccountCategory Enum. +enum SubAccountCategoryEnum { + /// none. + none, + + /// ibt. + ibt, + + /// lim. + lim, + + /// stp. + stp, + + /// swap_free. + swapFree, + + /// swap_free_high_risk. + swapFreeHighRisk, +} + /// SubAccountTypeEnum mapper. final Map subAccountTypeEnumMapper = { + "derivez": SubAccountTypeEnum.derivez, "financial": SubAccountTypeEnum.financial, "financial_stp": SubAccountTypeEnum.financialStp, + "standard": SubAccountTypeEnum.standard, }; /// SubAccountType Enum. enum SubAccountTypeEnum { + /// derivez. + derivez, + /// financial. financial, /// financial_stp. financialStp, -} + /// standard. + standard, +} /// Mt5 get settings model class. abstract class Mt5GetSettingsModel { /// Initializes Mt5 get settings model class . @@ -171,6 +236,7 @@ abstract class Mt5GetSettingsModel { this.company, this.country, this.currency, + this.displayBalance, this.email, this.group, this.landingCompanyShort, @@ -180,7 +246,10 @@ abstract class Mt5GetSettingsModel { this.name, this.phone, this.phonePassword, + this.server, + this.serverInfo, this.state, + this.subAccountCategory, this.subAccountType, this.zipCode, }); @@ -191,8 +260,8 @@ abstract class Mt5GetSettingsModel { /// The address of the user. The maximum length of the address is 128 characters. final String? address; - /// Account balance. - final String? balance; + /// Balance of the Trading account. + final double? balance; /// User's city of residence. final String? city; @@ -206,6 +275,9 @@ abstract class Mt5GetSettingsModel { /// MT5 account currency (`USD` or `EUR`) that depends on the MT5 company (`vanuatu`, `svg`, `malta`). final String? currency; + /// Account balance, formatted to appropriate decimal places. + final String? displayBalance; + /// Email address. final String? email; @@ -233,9 +305,18 @@ abstract class Mt5GetSettingsModel { /// The user's phone password. final String? phonePassword; + /// Trade server name of the MT5 account. + final String? server; + + /// Trade server information. + final ServerInfo? serverInfo; + /// User's state (region) of residence. final String? state; + /// Sub account category. + final SubAccountCategoryEnum? subAccountCategory; + /// Sub account type final SubAccountTypeEnum? subAccountType; @@ -247,46 +328,30 @@ abstract class Mt5GetSettingsModel { class Mt5GetSettings extends Mt5GetSettingsModel { /// Initializes Mt5 get settings class. const Mt5GetSettings({ - AccountTypeEnum? accountType, - String? address, - String? balance, - String? city, - String? company, - String? country, - String? currency, - String? email, - String? group, - LandingCompanyShortEnum? landingCompanyShort, - double? leverage, - String? login, - MarketTypeEnum? marketType, - String? name, - String? phone, - String? phonePassword, - String? state, - SubAccountTypeEnum? subAccountType, - String? zipCode, - }) : super( - accountType: accountType, - address: address, - balance: balance, - city: city, - company: company, - country: country, - currency: currency, - email: email, - group: group, - landingCompanyShort: landingCompanyShort, - leverage: leverage, - login: login, - marketType: marketType, - name: name, - phone: phone, - phonePassword: phonePassword, - state: state, - subAccountType: subAccountType, - zipCode: zipCode, - ); + super.accountType, + super.address, + super.balance, + super.city, + super.company, + super.country, + super.currency, + super.displayBalance, + super.email, + super.group, + super.landingCompanyShort, + super.leverage, + super.login, + super.marketType, + super.name, + super.phone, + super.phonePassword, + super.server, + super.serverInfo, + super.state, + super.subAccountCategory, + super.subAccountType, + super.zipCode, + }); /// Creates an instance from JSON. factory Mt5GetSettings.fromJson(Map json) => Mt5GetSettings( @@ -294,11 +359,12 @@ class Mt5GetSettings extends Mt5GetSettingsModel { ? null : accountTypeEnumMapper[json['account_type']], address: json['address'], - balance: json['balance'], + balance: getDouble(json['balance']), city: json['city'], company: json['company'], country: json['country'], currency: json['currency'], + displayBalance: json['display_balance'], email: json['email'], group: json['group'], landingCompanyShort: json['landing_company_short'] == null @@ -312,7 +378,14 @@ class Mt5GetSettings extends Mt5GetSettingsModel { name: json['name'], phone: json['phone'], phonePassword: json['phonePassword'], + server: json['server'], + serverInfo: json['server_info'] == null + ? null + : ServerInfo.fromJson(json['server_info']), state: json['state'], + subAccountCategory: json['sub_account_category'] == null + ? null + : subAccountCategoryEnumMapper[json['sub_account_category']], subAccountType: json['sub_account_type'] == null ? null : subAccountTypeEnumMapper[json['sub_account_type']], @@ -333,6 +406,7 @@ class Mt5GetSettings extends Mt5GetSettingsModel { resultMap['company'] = company; resultMap['country'] = country; resultMap['currency'] = currency; + resultMap['display_balance'] = displayBalance; resultMap['email'] = email; resultMap['group'] = group; resultMap['landing_company_short'] = landingCompanyShortEnumMapper.entries @@ -348,7 +422,15 @@ class Mt5GetSettings extends Mt5GetSettingsModel { resultMap['name'] = name; resultMap['phone'] = phone; resultMap['phonePassword'] = phonePassword; + resultMap['server'] = server; + if (serverInfo != null) { + resultMap['server_info'] = serverInfo!.toJson(); + } resultMap['state'] = state; + resultMap['sub_account_category'] = subAccountCategoryEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == subAccountCategory) + .key; resultMap['sub_account_type'] = subAccountTypeEnumMapper.entries .firstWhere((MapEntry entry) => entry.value == subAccountType) @@ -362,11 +444,12 @@ class Mt5GetSettings extends Mt5GetSettingsModel { Mt5GetSettings copyWith({ AccountTypeEnum? accountType, String? address, - String? balance, + double? balance, String? city, String? company, String? country, String? currency, + String? displayBalance, String? email, String? group, LandingCompanyShortEnum? landingCompanyShort, @@ -376,7 +459,10 @@ class Mt5GetSettings extends Mt5GetSettingsModel { String? name, String? phone, String? phonePassword, + String? server, + ServerInfo? serverInfo, String? state, + SubAccountCategoryEnum? subAccountCategory, SubAccountTypeEnum? subAccountType, String? zipCode, }) => @@ -388,6 +474,7 @@ class Mt5GetSettings extends Mt5GetSettingsModel { company: company ?? this.company, country: country ?? this.country, currency: currency ?? this.currency, + displayBalance: displayBalance ?? this.displayBalance, email: email ?? this.email, group: group ?? this.group, landingCompanyShort: landingCompanyShort ?? this.landingCompanyShort, @@ -397,8 +484,145 @@ class Mt5GetSettings extends Mt5GetSettingsModel { name: name ?? this.name, phone: phone ?? this.phone, phonePassword: phonePassword ?? this.phonePassword, + server: server ?? this.server, + serverInfo: serverInfo ?? this.serverInfo, state: state ?? this.state, + subAccountCategory: subAccountCategory ?? this.subAccountCategory, subAccountType: subAccountType ?? this.subAccountType, zipCode: zipCode ?? this.zipCode, ); } +/// Server info model class. +abstract class ServerInfoModel { + /// Initializes Server info model class . + const ServerInfoModel({ + this.environment, + this.geolocation, + this.id, + }); + + /// The environment. E.g. Deriv-Server. + final EnvironmentEnum? environment; + + /// Geographical location of the server. + final Geolocation? geolocation; + + /// Server id. + final String? id; +} + +/// Server info class. +class ServerInfo extends ServerInfoModel { + /// Initializes Server info class. + const ServerInfo({ + super.environment, + super.geolocation, + super.id, + }); + + /// Creates an instance from JSON. + factory ServerInfo.fromJson(Map json) => ServerInfo( + environment: json['environment'] == null + ? null + : environmentEnumMapper[json['environment']], + geolocation: json['geolocation'] == null + ? null + : Geolocation.fromJson(json['geolocation']), + id: json['id'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['environment'] = environmentEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == environment) + .key; + if (geolocation != null) { + resultMap['geolocation'] = geolocation!.toJson(); + } + resultMap['id'] = id; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + ServerInfo copyWith({ + EnvironmentEnum? environment, + Geolocation? geolocation, + String? id, + }) => + ServerInfo( + environment: environment ?? this.environment, + geolocation: geolocation ?? this.geolocation, + id: id ?? this.id, + ); +} +/// Geolocation model class. +abstract class GeolocationModel { + /// Initializes Geolocation model class . + const GeolocationModel({ + this.group, + this.location, + this.region, + this.sequence, + }); + + /// Internal server grouping. + final String? group; + + /// Server location. + final String? location; + + /// Server region. + final String? region; + + /// Server sequence. + final int? sequence; +} + +/// Geolocation class. +class Geolocation extends GeolocationModel { + /// Initializes Geolocation class. + const Geolocation({ + super.group, + super.location, + super.region, + super.sequence, + }); + + /// Creates an instance from JSON. + factory Geolocation.fromJson(Map json) => Geolocation( + group: json['group'], + location: json['location'], + region: json['region'], + sequence: json['sequence'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['group'] = group; + resultMap['location'] = location; + resultMap['region'] = region; + resultMap['sequence'] = sequence; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + Geolocation copyWith({ + String? group, + String? location, + String? region, + int? sequence, + }) => + Geolocation( + group: group ?? this.group, + location: location ?? this.location, + region: region ?? this.region, + sequence: sequence ?? this.sequence, + ); +} diff --git a/lib/api/response/new_account_wallet_response_extended.dart b/lib/api/response/new_account_wallet_response_extended.dart new file mode 100644 index 0000000000..0a4d1fb073 --- /dev/null +++ b/lib/api/response/new_account_wallet_response_extended.dart @@ -0,0 +1,28 @@ +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/basic_api/generated/api.dart'; +import 'package:flutter_deriv_api/helpers/helpers.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; + +import 'new_account_wallet_response_result.dart'; + +/// The extended version of the [NewAccountWalletResponse] class to implement +/// the API call methods. +class NewAccountWalletResponseExtended extends NewAccountWalletResponse { + static final BaseAPI _api = Injector()(); + + /// Creates a new wallet account. + static Future createNewWalletAccount({ + required NewAccountWalletRequest request, + }) async { + final NewAccountWalletReceive response = await _api.call(request: request); + + checkException( + response: response, + exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => + BaseAPIException(baseExceptionModel: baseExceptionModel), + ); + + return NewAccountWalletResponse.fromJson(response.newAccountWallet); + } +} diff --git a/lib/api/response/new_account_wallet_response_result.dart b/lib/api/response/new_account_wallet_response_result.dart index cffea611f3..bab5e442bb 100644 --- a/lib/api/response/new_account_wallet_response_result.dart +++ b/lib/api/response/new_account_wallet_response_result.dart @@ -19,10 +19,8 @@ abstract class NewAccountWalletResponseModel { class NewAccountWalletResponse extends NewAccountWalletResponseModel { /// Initializes New account wallet response class. const NewAccountWalletResponse({ - NewAccountWallet? newAccountWallet, - }) : super( - newAccountWallet: newAccountWallet, - ); + super.newAccountWallet, + }); /// Creates an instance from JSON. factory NewAccountWalletResponse.fromJson( @@ -88,20 +86,13 @@ abstract class NewAccountWalletModel { class NewAccountWallet extends NewAccountWalletModel { /// Initializes New account wallet class. const NewAccountWallet({ - required String clientId, - required String landingCompany, - required String oauthToken, - String? currency, - String? landingCompanyShort, - String? landingCompanyShortcode, - }) : super( - clientId: clientId, - landingCompany: landingCompany, - oauthToken: oauthToken, - currency: currency, - landingCompanyShort: landingCompanyShort, - landingCompanyShortcode: landingCompanyShortcode, - ); + required super.clientId, + required super.landingCompany, + required super.oauthToken, + super.currency, + super.landingCompanyShort, + super.landingCompanyShortcode, + }); /// Creates an instance from JSON. factory NewAccountWallet.fromJson(Map json) => diff --git a/lib/api/response/residence_list_response_result.dart b/lib/api/response/residence_list_response_result.dart index d581630799..81bd209701 100644 --- a/lib/api/response/residence_list_response_result.dart +++ b/lib/api/response/residence_list_response_result.dart @@ -25,10 +25,8 @@ abstract class ResidenceListResponseModel { class ResidenceListResponse extends ResidenceListResponseModel { /// Initializes Residence list response class. const ResidenceListResponse({ - List? residenceList, - }) : super( - residenceList: residenceList, - ); + super.residenceList, + }); /// Creates an instance from JSON. factory ResidenceListResponse.fromJson( @@ -88,7 +86,6 @@ class ResidenceListResponse extends ResidenceListResponseModel { residenceList: residenceList ?? this.residenceList, ); } - /// Residence list item model class. abstract class ResidenceListItemModel { /// Initializes Residence list item model class . @@ -128,22 +125,14 @@ abstract class ResidenceListItemModel { class ResidenceListItem extends ResidenceListItemModel { /// Initializes Residence list item class. const ResidenceListItem({ - String? disabled, - Identity? identity, - String? phoneIdd, - String? selected, - String? text, - List? tinFormat, - String? value, - }) : super( - disabled: disabled, - identity: identity, - phoneIdd: phoneIdd, - selected: selected, - text: text, - tinFormat: tinFormat, - value: value, - ); + super.disabled, + super.identity, + super.phoneIdd, + super.selected, + super.text, + super.tinFormat, + super.value, + }); /// Creates an instance from JSON. factory ResidenceListItem.fromJson(Map json) => @@ -208,7 +197,6 @@ class ResidenceListItem extends ResidenceListItemModel { value: value ?? this.value, ); } - /// Identity model class. abstract class IdentityModel { /// Initializes Identity model class . @@ -224,10 +212,8 @@ abstract class IdentityModel { class Identity extends IdentityModel { /// Initializes Identity class. const Identity({ - Services? services, - }) : super( - services: services, - ); + super.services, + }); /// Creates an instance from JSON. factory Identity.fromJson(Map json) => Identity( @@ -255,7 +241,6 @@ class Identity extends IdentityModel { services: services ?? this.services, ); } - /// Services model class. abstract class ServicesModel { /// Initializes Services model class . @@ -275,12 +260,9 @@ abstract class ServicesModel { class Services extends ServicesModel { /// Initializes Services class. const Services({ - Idv? idv, - Onfido? onfido, - }) : super( - idv: idv, - onfido: onfido, - ); + super.idv, + super.onfido, + }); /// Creates an instance from JSON. factory Services.fromJson(Map json) => Services( @@ -312,7 +294,6 @@ class Services extends ServicesModel { onfido: onfido ?? this.onfido, ); } - /// Idv model class. abstract class IdvModel { /// Initializes Idv model class . @@ -336,14 +317,10 @@ abstract class IdvModel { class Idv extends IdvModel { /// Initializes Idv class. const Idv({ - Map? documentsSupported, - bool? hasVisualSample, - bool? isCountrySupported, - }) : super( - documentsSupported: documentsSupported, - hasVisualSample: hasVisualSample, - isCountrySupported: isCountrySupported, - ); + super.documentsSupported, + super.hasVisualSample, + super.isCountrySupported, + }); /// Creates an instance from JSON. factory Idv.fromJson(Map json) => Idv( @@ -383,15 +360,18 @@ class Idv extends IdvModel { isCountrySupported: isCountrySupported ?? this.isCountrySupported, ); } - /// Documents supported property model class. abstract class DocumentsSupportedPropertyModel { /// Initializes Documents supported property model class . const DocumentsSupportedPropertyModel({ + this.additional, this.displayName, this.format, }); + /// [Optional] Additional input required from the user + final Additional? additional; + /// The localized display name final String? displayName; @@ -403,16 +383,17 @@ abstract class DocumentsSupportedPropertyModel { class DocumentsSupportedProperty extends DocumentsSupportedPropertyModel { /// Initializes Documents supported property class. const DocumentsSupportedProperty({ - String? displayName, - String? format, - }) : super( - displayName: displayName, - format: format, - ); + super.additional, + super.displayName, + super.format, + }); /// Creates an instance from JSON. factory DocumentsSupportedProperty.fromJson(Map json) => DocumentsSupportedProperty( + additional: json['additional'] == null + ? null + : Additional.fromJson(json['additional']), displayName: json['display_name'], format: json['format'], ); @@ -421,6 +402,9 @@ class DocumentsSupportedProperty extends DocumentsSupportedPropertyModel { Map toJson() { final Map resultMap = {}; + if (additional != null) { + resultMap['additional'] = additional!.toJson(); + } resultMap['display_name'] = displayName; resultMap['format'] = format; @@ -429,15 +413,65 @@ class DocumentsSupportedProperty extends DocumentsSupportedPropertyModel { /// Creates a copy of instance with given parameters. DocumentsSupportedProperty copyWith({ + Additional? additional, String? displayName, String? format, }) => DocumentsSupportedProperty( + additional: additional ?? this.additional, displayName: displayName ?? this.displayName, format: format ?? this.format, ); } +/// Additional model class. +abstract class AdditionalModel { + /// Initializes Additional model class . + const AdditionalModel({ + this.displayName, + this.format, + }); + /// The localized display name + final String? displayName; + + /// [Optional] Regex pattern to validate documents + final String? format; +} + +/// Additional class. +class Additional extends AdditionalModel { + /// Initializes Additional class. + const Additional({ + super.displayName, + super.format, + }); + + /// Creates an instance from JSON. + factory Additional.fromJson(Map json) => Additional( + displayName: json['display_name'], + format: json['format'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['display_name'] = displayName; + resultMap['format'] = format; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + Additional copyWith({ + String? displayName, + String? format, + }) => + Additional( + displayName: displayName ?? this.displayName, + format: format ?? this.format, + ); +} /// Onfido model class. abstract class OnfidoModel { /// Initializes Onfido model class . @@ -458,13 +492,9 @@ abstract class OnfidoModel { class Onfido extends OnfidoModel { /// Initializes Onfido class. const Onfido({ - Map? - documentsSupported, - bool? isCountrySupported, - }) : super( - documentsSupported: documentsSupported, - isCountrySupported: isCountrySupported, - ); + super.documentsSupported, + super.isCountrySupported, + }); /// Creates an instance from JSON. factory Onfido.fromJson(Map json) => Onfido( @@ -503,7 +533,6 @@ class Onfido extends OnfidoModel { isCountrySupported: isCountrySupported ?? this.isCountrySupported, ); } - /// Documents supported documents supported property model class. abstract class DocumentsSupportedDocumentsSupportedPropertyModel { /// Initializes Documents supported documents supported property model class . @@ -524,12 +553,9 @@ class DocumentsSupportedDocumentsSupportedProperty extends DocumentsSupportedDocumentsSupportedPropertyModel { /// Initializes Documents supported documents supported property class. const DocumentsSupportedDocumentsSupportedProperty({ - String? displayName, - String? format, - }) : super( - displayName: displayName, - format: format, - ); + super.displayName, + super.format, + }); /// Creates an instance from JSON. factory DocumentsSupportedDocumentsSupportedProperty.fromJson( diff --git a/lib/api/response/service_token_response_result.dart b/lib/api/response/service_token_response_result.dart index d11b839196..89450d7139 100644 --- a/lib/api/response/service_token_response_result.dart +++ b/lib/api/response/service_token_response_result.dart @@ -26,10 +26,8 @@ abstract class ServiceTokenResponseModel { class ServiceTokenResponse extends ServiceTokenResponseModel { /// Initializes Service token response class. const ServiceTokenResponse({ - ServiceToken? serviceToken, - }) : super( - serviceToken: serviceToken, - ); + super.serviceToken, + }); /// Creates an instance from JSON. factory ServiceTokenResponse.fromJson( @@ -94,12 +92,12 @@ class ServiceTokenResponse extends ServiceTokenResponseModel { serviceToken: serviceToken ?? this.serviceToken, ); } - /// Service token model class. abstract class ServiceTokenModel { /// Initializes Service token model class . const ServiceTokenModel({ this.banxa, + this.ctrader, this.dxtrade, this.onfido, this.pandats, @@ -110,13 +108,16 @@ abstract class ServiceTokenModel { /// Banxa order data. final Banxa? banxa; + /// CTrader data. + final Ctrader? ctrader; + /// Deriv X data. final Dxtrade? dxtrade; /// Onfido data. final Onfido? onfido; - /// pandats data. + /// Deriv EZ data. final Pandats? pandats; /// Sendbird data. @@ -130,24 +131,20 @@ abstract class ServiceTokenModel { class ServiceToken extends ServiceTokenModel { /// Initializes Service token class. const ServiceToken({ - Banxa? banxa, - Dxtrade? dxtrade, - Onfido? onfido, - Pandats? pandats, - Sendbird? sendbird, - Wyre? wyre, - }) : super( - banxa: banxa, - dxtrade: dxtrade, - onfido: onfido, - pandats: pandats, - sendbird: sendbird, - wyre: wyre, - ); + super.banxa, + super.ctrader, + super.dxtrade, + super.onfido, + super.pandats, + super.sendbird, + super.wyre, + }); /// Creates an instance from JSON. factory ServiceToken.fromJson(Map json) => ServiceToken( banxa: json['banxa'] == null ? null : Banxa.fromJson(json['banxa']), + ctrader: + json['ctrader'] == null ? null : Ctrader.fromJson(json['ctrader']), dxtrade: json['dxtrade'] == null ? null : Dxtrade.fromJson(json['dxtrade']), onfido: json['onfido'] == null ? null : Onfido.fromJson(json['onfido']), @@ -166,6 +163,9 @@ class ServiceToken extends ServiceTokenModel { if (banxa != null) { resultMap['banxa'] = banxa!.toJson(); } + if (ctrader != null) { + resultMap['ctrader'] = ctrader!.toJson(); + } if (dxtrade != null) { resultMap['dxtrade'] = dxtrade!.toJson(); } @@ -188,6 +188,7 @@ class ServiceToken extends ServiceTokenModel { /// Creates a copy of instance with given parameters. ServiceToken copyWith({ Banxa? banxa, + Ctrader? ctrader, Dxtrade? dxtrade, Onfido? onfido, Pandats? pandats, @@ -196,6 +197,7 @@ class ServiceToken extends ServiceTokenModel { }) => ServiceToken( banxa: banxa ?? this.banxa, + ctrader: ctrader ?? this.ctrader, dxtrade: dxtrade ?? this.dxtrade, onfido: onfido ?? this.onfido, pandats: pandats ?? this.pandats, @@ -203,7 +205,6 @@ class ServiceToken extends ServiceTokenModel { wyre: wyre ?? this.wyre, ); } - /// Banxa model class. abstract class BanxaModel { /// Initializes Banxa model class . @@ -227,14 +228,10 @@ abstract class BanxaModel { class Banxa extends BanxaModel { /// Initializes Banxa class. const Banxa({ - String? token, - String? url, - String? urlIframe, - }) : super( - token: token, - url: url, - urlIframe: urlIframe, - ); + super.token, + super.url, + super.urlIframe, + }); /// Creates an instance from JSON. factory Banxa.fromJson(Map json) => Banxa( @@ -266,7 +263,46 @@ class Banxa extends BanxaModel { urlIframe: urlIframe ?? this.urlIframe, ); } +/// Ctrader model class. +abstract class CtraderModel { + /// Initializes Ctrader model class . + const CtraderModel({ + this.token, + }); + + /// CTrader One Time token + final String? token; +} + +/// Ctrader class. +class Ctrader extends CtraderModel { + /// Initializes Ctrader class. + const Ctrader({ + super.token, + }); + + /// Creates an instance from JSON. + factory Ctrader.fromJson(Map json) => Ctrader( + token: json['token'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['token'] = token; + return resultMap; + } + + /// Creates a copy of instance with given parameters. + Ctrader copyWith({ + String? token, + }) => + Ctrader( + token: token ?? this.token, + ); +} /// Dxtrade model class. abstract class DxtradeModel { /// Initializes Dxtrade model class . @@ -282,10 +318,8 @@ abstract class DxtradeModel { class Dxtrade extends DxtradeModel { /// Initializes Dxtrade class. const Dxtrade({ - String? token, - }) : super( - token: token, - ); + super.token, + }); /// Creates an instance from JSON. factory Dxtrade.fromJson(Map json) => Dxtrade( @@ -309,7 +343,6 @@ class Dxtrade extends DxtradeModel { token: token ?? this.token, ); } - /// Onfido model class. abstract class OnfidoModel { /// Initializes Onfido model class . @@ -325,10 +358,8 @@ abstract class OnfidoModel { class Onfido extends OnfidoModel { /// Initializes Onfido class. const Onfido({ - String? token, - }) : super( - token: token, - ); + super.token, + }); /// Creates an instance from JSON. factory Onfido.fromJson(Map json) => Onfido( @@ -352,7 +383,6 @@ class Onfido extends OnfidoModel { token: token ?? this.token, ); } - /// Pandats model class. abstract class PandatsModel { /// Initializes Pandats model class . @@ -360,7 +390,7 @@ abstract class PandatsModel { this.token, }); - /// Pandats token. + /// Deriv EZ SSO token final String? token; } @@ -368,10 +398,8 @@ abstract class PandatsModel { class Pandats extends PandatsModel { /// Initializes Pandats class. const Pandats({ - String? token, - }) : super( - token: token, - ); + super.token, + }); /// Creates an instance from JSON. factory Pandats.fromJson(Map json) => Pandats( @@ -395,7 +423,6 @@ class Pandats extends PandatsModel { token: token ?? this.token, ); } - /// Sendbird model class. abstract class SendbirdModel { /// Initializes Sendbird model class . @@ -419,14 +446,10 @@ abstract class SendbirdModel { class Sendbird extends SendbirdModel { /// Initializes Sendbird class. const Sendbird({ - String? appId, - DateTime? expiryTime, - String? token, - }) : super( - appId: appId, - expiryTime: expiryTime, - token: token, - ); + super.appId, + super.expiryTime, + super.token, + }); /// Creates an instance from JSON. factory Sendbird.fromJson(Map json) => Sendbird( @@ -458,7 +481,6 @@ class Sendbird extends SendbirdModel { token: token ?? this.token, ); } - /// Wyre model class. abstract class WyreModel { /// Initializes Wyre model class . @@ -478,12 +500,9 @@ abstract class WyreModel { class Wyre extends WyreModel { /// Initializes Wyre class. const Wyre({ - String? token, - String? url, - }) : super( - token: token, - url: url, - ); + super.token, + super.url, + }); /// Creates an instance from JSON. factory Wyre.fromJson(Map json) => Wyre( diff --git a/lib/api/response/trading_platform_accounts_response_result.dart b/lib/api/response/trading_platform_accounts_response_result.dart index 806ddd905c..a73ddb45c2 100644 --- a/lib/api/response/trading_platform_accounts_response_result.dart +++ b/lib/api/response/trading_platform_accounts_response_result.dart @@ -24,10 +24,8 @@ class TradingPlatformAccountsResponse extends TradingPlatformAccountsResponseModel { /// Initializes Trading platform accounts response class. const TradingPlatformAccountsResponse({ - List? tradingPlatformAccounts, - }) : super( - tradingPlatformAccounts: tradingPlatformAccounts, - ); + super.tradingPlatformAccounts, + }); /// Creates an instance from JSON. factory TradingPlatformAccountsResponse.fromJson( @@ -168,6 +166,7 @@ enum MarketTypeEnum { final Map platformEnumMapper = { "dxtrade": PlatformEnum.dxtrade, "mt5": PlatformEnum.mt5, + "ctrader": PlatformEnum.ctrader, }; /// Platform Enum. @@ -177,6 +176,9 @@ enum PlatformEnum { /// mt5. mt5, + + /// ctrader. + ctrader, } /// EnvironmentEnum mapper. @@ -204,6 +206,7 @@ final Map subAccountTypeEnumMapper = { "financial": SubAccountTypeEnum.financial, "financial_stp": SubAccountTypeEnum.financialStp, + "swap_free": SubAccountTypeEnum.swapFree, }; /// SubAccountType Enum. @@ -213,8 +216,10 @@ enum SubAccountTypeEnum { /// financial_stp. financialStp, -} + /// swap_free. + swapFree, +} /// Trading platform accounts item model class. abstract class TradingPlatformAccountsItemModel { /// Initializes Trading platform accounts item model class . @@ -298,44 +303,25 @@ abstract class TradingPlatformAccountsItemModel { class TradingPlatformAccountsItem extends TradingPlatformAccountsItemModel { /// Initializes Trading platform accounts item class. const TradingPlatformAccountsItem({ - String? accountId, - AccountTypeEnum? accountType, - double? balance, - String? country, - String? currency, - String? displayBalance, - String? email, - int? enabled, - String? group, - LandingCompanyShortEnum? landingCompanyShort, - double? leverage, - String? login, - MarketTypeEnum? marketType, - String? name, - PlatformEnum? platform, - String? server, - ServerInfo? serverInfo, - SubAccountTypeEnum? subAccountType, - }) : super( - accountId: accountId, - accountType: accountType, - balance: balance, - country: country, - currency: currency, - displayBalance: displayBalance, - email: email, - enabled: enabled, - group: group, - landingCompanyShort: landingCompanyShort, - leverage: leverage, - login: login, - marketType: marketType, - name: name, - platform: platform, - server: server, - serverInfo: serverInfo, - subAccountType: subAccountType, - ); + super.accountId, + super.accountType, + super.balance, + super.country, + super.currency, + super.displayBalance, + super.email, + super.enabled, + super.group, + super.landingCompanyShort, + super.leverage, + super.login, + super.marketType, + super.name, + super.platform, + super.server, + super.serverInfo, + super.subAccountType, + }); /// Creates an instance from JSON. factory TradingPlatformAccountsItem.fromJson(Map json) => @@ -457,7 +443,6 @@ class TradingPlatformAccountsItem extends TradingPlatformAccountsItemModel { subAccountType: subAccountType ?? this.subAccountType, ); } - /// Server info model class. abstract class ServerInfoModel { /// Initializes Server info model class . @@ -481,14 +466,10 @@ abstract class ServerInfoModel { class ServerInfo extends ServerInfoModel { /// Initializes Server info class. const ServerInfo({ - EnvironmentEnum? environment, - Geolocation? geolocation, - String? id, - }) : super( - environment: environment, - geolocation: geolocation, - id: id, - ); + super.environment, + super.geolocation, + super.id, + }); /// Creates an instance from JSON. factory ServerInfo.fromJson(Map json) => ServerInfo( @@ -529,7 +510,6 @@ class ServerInfo extends ServerInfoModel { id: id ?? this.id, ); } - /// Geolocation model class. abstract class GeolocationModel { /// Initializes Geolocation model class . @@ -543,13 +523,13 @@ abstract class GeolocationModel { /// Internal server grouping. final String? group; - /// Sever location. + /// Server location. final String? location; - /// Sever region. + /// Server region. final String? region; - /// Sever sequence. + /// Server sequence. final int? sequence; } @@ -557,16 +537,11 @@ abstract class GeolocationModel { class Geolocation extends GeolocationModel { /// Initializes Geolocation class. const Geolocation({ - String? group, - String? location, - String? region, - int? sequence, - }) : super( - group: group, - location: location, - region: region, - sequence: sequence, - ); + super.group, + super.location, + super.region, + super.sequence, + }); /// Creates an instance from JSON. factory Geolocation.fromJson(Map json) => Geolocation( diff --git a/lib/api/response/trading_platform_asset_listing_response_result.dart b/lib/api/response/trading_platform_asset_listing_response_result.dart new file mode 100644 index 0000000000..2f5f36c8cd --- /dev/null +++ b/lib/api/response/trading_platform_asset_listing_response_result.dart @@ -0,0 +1,274 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Trading platform asset listing response model class. +abstract class TradingPlatformAssetListingResponseModel { + /// Initializes Trading platform asset listing response model class . + const TradingPlatformAssetListingResponseModel({ + this.tradingPlatformAssetListing, + this.subscription, + }); + + /// Containing Trading asset objects. + final Map? + tradingPlatformAssetListing; + + /// For subscription requests only. + final Subscription? subscription; +} + +/// Trading platform asset listing response class. +class TradingPlatformAssetListingResponse + extends TradingPlatformAssetListingResponseModel { + /// Initializes Trading platform asset listing response class. + const TradingPlatformAssetListingResponse({ + super.tradingPlatformAssetListing, + super.subscription, + }); + + /// Creates an instance from JSON. + factory TradingPlatformAssetListingResponse.fromJson( + dynamic tradingPlatformAssetListingJson, + dynamic subscriptionJson, + ) => + TradingPlatformAssetListingResponse( + tradingPlatformAssetListing: tradingPlatformAssetListingJson == null + ? null + : Map.fromEntries( + tradingPlatformAssetListingJson.entries.map< + MapEntry>( + (MapEntry entry) => + MapEntry( + entry.key, + TradingPlatformAssetListingProperty.fromJson( + entry.value)))), + subscription: subscriptionJson == null + ? null + : Subscription.fromJson(subscriptionJson), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['trading_platform_asset_listing'] = tradingPlatformAssetListing; + if (subscription != null) { + resultMap['subscription'] = subscription!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + TradingPlatformAssetListingResponse copyWith({ + Map? + tradingPlatformAssetListing, + Subscription? subscription, + }) => + TradingPlatformAssetListingResponse( + tradingPlatformAssetListing: + tradingPlatformAssetListing ?? this.tradingPlatformAssetListing, + subscription: subscription ?? this.subscription, + ); +} +/// Trading platform asset listing property model class. +abstract class TradingPlatformAssetListingPropertyModel { + /// Initializes Trading platform asset listing property model class . + const TradingPlatformAssetListingPropertyModel({ + this.assets, + }); + + /// MT5 assets. + final List? assets; +} + +/// Trading platform asset listing property class. +class TradingPlatformAssetListingProperty + extends TradingPlatformAssetListingPropertyModel { + /// Initializes Trading platform asset listing property class. + const TradingPlatformAssetListingProperty({ + super.assets, + }); + + /// Creates an instance from JSON. + factory TradingPlatformAssetListingProperty.fromJson( + Map json) => + TradingPlatformAssetListingProperty( + assets: json['assets'] == null + ? null + : List.from( + json['assets']?.map( + (dynamic item) => AssetsItem.fromJson(item), + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (assets != null) { + resultMap['assets'] = assets! + .map( + (AssetsItem item) => item.toJson(), + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + TradingPlatformAssetListingProperty copyWith({ + List? assets, + }) => + TradingPlatformAssetListingProperty( + assets: assets ?? this.assets, + ); +} +/// Assets item model class. +abstract class AssetsItemModel { + /// Initializes Assets item model class . + const AssetsItemModel({ + this.ask, + this.bid, + this.dayPercentageChange, + this.displayOrder, + this.market, + this.shortcode, + this.spread, + this.symbol, + }); + + /// Ask price of asset. + final double? ask; + + /// Bid price of asset. + final double? bid; + + /// 1 day percentage change of price. + final String? dayPercentageChange; + + /// Display order of asset. + final double? displayOrder; + + /// Market type of asset. + final String? market; + + /// The asset shortcode. + final String? shortcode; + + /// Spread of asset. + final double? spread; + + /// Asset symbol. + final String? symbol; +} + +/// Assets item class. +class AssetsItem extends AssetsItemModel { + /// Initializes Assets item class. + const AssetsItem({ + super.ask, + super.bid, + super.dayPercentageChange, + super.displayOrder, + super.market, + super.shortcode, + super.spread, + super.symbol, + }); + + /// Creates an instance from JSON. + factory AssetsItem.fromJson(Map json) => AssetsItem( + ask: getDouble(json['ask']), + bid: getDouble(json['bid']), + dayPercentageChange: json['day_percentage_change'], + displayOrder: getDouble(json['display_order']), + market: json['market'], + shortcode: json['shortcode'], + spread: getDouble(json['spread']), + symbol: json['symbol'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['ask'] = ask; + resultMap['bid'] = bid; + resultMap['day_percentage_change'] = dayPercentageChange; + resultMap['display_order'] = displayOrder; + resultMap['market'] = market; + resultMap['shortcode'] = shortcode; + resultMap['spread'] = spread; + resultMap['symbol'] = symbol; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + AssetsItem copyWith({ + double? ask, + double? bid, + String? dayPercentageChange, + double? displayOrder, + String? market, + String? shortcode, + double? spread, + String? symbol, + }) => + AssetsItem( + ask: ask ?? this.ask, + bid: bid ?? this.bid, + dayPercentageChange: dayPercentageChange ?? this.dayPercentageChange, + displayOrder: displayOrder ?? this.displayOrder, + market: market ?? this.market, + shortcode: shortcode ?? this.shortcode, + spread: spread ?? this.spread, + symbol: symbol ?? this.symbol, + ); +} +/// Subscription model class. +abstract class SubscriptionModel { + /// Initializes Subscription model class . + const SubscriptionModel({ + required this.id, + }); + + /// A per-connection unique identifier. Can be passed to the `forget` API call to unsubscribe. + final String id; +} + +/// Subscription class. +class Subscription extends SubscriptionModel { + /// Initializes Subscription class. + const Subscription({ + required super.id, + }); + + /// Creates an instance from JSON. + factory Subscription.fromJson(Map json) => Subscription( + id: json['id'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['id'] = id; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + Subscription copyWith({ + String? id, + }) => + Subscription( + id: id ?? this.id, + ); +} diff --git a/lib/api/response/trading_platform_available_accounts_response_result.dart b/lib/api/response/trading_platform_available_accounts_response_result.dart index a1a4afc9f2..57817492b9 100644 --- a/lib/api/response/trading_platform_available_accounts_response_result.dart +++ b/lib/api/response/trading_platform_available_accounts_response_result.dart @@ -21,11 +21,8 @@ class TradingPlatformAvailableAccountsResponse extends TradingPlatformAvailableAccountsResponseModel { /// Initializes Trading platform available accounts response class. const TradingPlatformAvailableAccountsResponse({ - List? - tradingPlatformAvailableAccounts, - }) : super( - tradingPlatformAvailableAccounts: tradingPlatformAvailableAccounts, - ); + super.tradingPlatformAvailableAccounts, + }); /// Creates an instance from JSON. factory TradingPlatformAvailableAccountsResponse.fromJson( @@ -70,11 +67,30 @@ class TradingPlatformAvailableAccountsResponse ); } +/// LinkableLandingCompaniesItemEnum mapper. +final Map + linkableLandingCompaniesItemEnumMapper = + { + "svg": LinkableLandingCompaniesItemEnum.svg, + "maltainvest": LinkableLandingCompaniesItemEnum.maltainvest, +}; + +/// LinkableLandingCompaniesItem Enum. +enum LinkableLandingCompaniesItemEnum { + /// svg. + svg, + + /// maltainvest. + maltainvest, +} + /// MarketTypeEnum mapper. final Map marketTypeEnumMapper = { "financial": MarketTypeEnum.financial, + "synthetic": MarketTypeEnum.synthetic, "gaming": MarketTypeEnum.gaming, + "all": MarketTypeEnum.all, }; /// MarketType Enum. @@ -82,14 +98,21 @@ enum MarketTypeEnum { /// financial. financial, + /// synthetic. + synthetic, + /// gaming. gaming, + + /// all. + all, } /// SubAccountTypeEnum mapper. final Map subAccountTypeEnumMapper = { "standard": SubAccountTypeEnum.standard, + "swap_free": SubAccountTypeEnum.swapFree, "stp": SubAccountTypeEnum.stp, }; @@ -98,6 +121,9 @@ enum SubAccountTypeEnum { /// standard. standard, + /// swap_free. + swapFree, + /// stp. stp, } @@ -105,6 +131,7 @@ enum SubAccountTypeEnum { abstract class TradingPlatformAvailableAccountsItemModel { /// Initializes Trading platform available accounts item model class . const TradingPlatformAvailableAccountsItemModel({ + this.linkableLandingCompanies, this.marketType, this.name, this.requirements, @@ -112,6 +139,9 @@ abstract class TradingPlatformAvailableAccountsItemModel { this.subAccountType, }); + /// A list of Deriv landing companies that can work with this account type + final List? linkableLandingCompanies; + /// The type of market tradable by this account final MarketTypeEnum? marketType; @@ -133,23 +163,27 @@ class TradingPlatformAvailableAccountsItem extends TradingPlatformAvailableAccountsItemModel { /// Initializes Trading platform available accounts item class. const TradingPlatformAvailableAccountsItem({ - MarketTypeEnum? marketType, - String? name, - Requirements? requirements, - String? shortcode, - SubAccountTypeEnum? subAccountType, - }) : super( - marketType: marketType, - name: name, - requirements: requirements, - shortcode: shortcode, - subAccountType: subAccountType, - ); + super.linkableLandingCompanies, + super.marketType, + super.name, + super.requirements, + super.shortcode, + super.subAccountType, + }); /// Creates an instance from JSON. factory TradingPlatformAvailableAccountsItem.fromJson( Map json) => TradingPlatformAvailableAccountsItem( + linkableLandingCompanies: json['linkable_landing_companies'] == null + ? null + : List.from( + json['linkable_landing_companies']?.map( + (dynamic item) => item == null + ? null + : linkableLandingCompaniesItemEnumMapper[item], + ), + ), marketType: json['market_type'] == null ? null : marketTypeEnumMapper[json['market_type']], @@ -167,6 +201,19 @@ class TradingPlatformAvailableAccountsItem Map toJson() { final Map resultMap = {}; + if (linkableLandingCompanies != null) { + resultMap['linkable_landing_companies'] = linkableLandingCompanies! + .map( + (LinkableLandingCompaniesItemEnum item) => + linkableLandingCompaniesItemEnumMapper.entries + .firstWhere( + (MapEntry + entry) => + entry.value == item) + .key, + ) + .toList(); + } resultMap['market_type'] = marketTypeEnumMapper.entries .firstWhere((MapEntry entry) => entry.value == marketType) @@ -186,6 +233,7 @@ class TradingPlatformAvailableAccountsItem /// Creates a copy of instance with given parameters. TradingPlatformAvailableAccountsItem copyWith({ + List? linkableLandingCompanies, MarketTypeEnum? marketType, String? name, Requirements? requirements, @@ -193,6 +241,8 @@ class TradingPlatformAvailableAccountsItem SubAccountTypeEnum? subAccountType, }) => TradingPlatformAvailableAccountsItem( + linkableLandingCompanies: + linkableLandingCompanies ?? this.linkableLandingCompanies, marketType: marketType ?? this.marketType, name: name ?? this.name, requirements: requirements ?? this.requirements, @@ -227,16 +277,11 @@ abstract class RequirementsModel { class Requirements extends RequirementsModel { /// Initializes Requirements class. const Requirements({ - AfterFirstDeposit? afterFirstDeposit, - Compliance? compliance, - List? signup, - List? withdrawal, - }) : super( - afterFirstDeposit: afterFirstDeposit, - compliance: compliance, - signup: signup, - withdrawal: withdrawal, - ); + super.afterFirstDeposit, + super.compliance, + super.signup, + super.withdrawal, + }); /// Creates an instance from JSON. factory Requirements.fromJson(Map json) => Requirements( @@ -319,10 +364,8 @@ abstract class AfterFirstDepositModel { class AfterFirstDeposit extends AfterFirstDepositModel { /// Initializes After first deposit class. const AfterFirstDeposit({ - List? financialAssessment, - }) : super( - financialAssessment: financialAssessment, - ); + super.financialAssessment, + }); /// Creates an instance from JSON. factory AfterFirstDeposit.fromJson(Map json) => @@ -378,12 +421,9 @@ abstract class ComplianceModel { class Compliance extends ComplianceModel { /// Initializes Compliance class. const Compliance({ - List? mt5, - List? taxInformation, - }) : super( - mt5: mt5, - taxInformation: taxInformation, - ); + super.mt5, + super.taxInformation, + }); /// Creates an instance from JSON. factory Compliance.fromJson(Map json) => Compliance( diff --git a/lib/api/response/trading_platform_deposit_response_result.dart b/lib/api/response/trading_platform_deposit_response_result.dart index f01ad48e0d..685817be5c 100644 --- a/lib/api/response/trading_platform_deposit_response_result.dart +++ b/lib/api/response/trading_platform_deposit_response_result.dart @@ -16,7 +16,7 @@ abstract class TradingPlatformDepositResponseModel { }); /// Information about deposit transaction, or status of demo account top up. - final dynamic tradingPlatformDeposit; + final Map? tradingPlatformDeposit; } /// Trading platform deposit response class. @@ -24,10 +24,8 @@ class TradingPlatformDepositResponse extends TradingPlatformDepositResponseModel { /// Initializes Trading platform deposit response class. const TradingPlatformDepositResponse({ - dynamic tradingPlatformDeposit, - }) : super( - tradingPlatformDeposit: tradingPlatformDeposit, - ); + super.tradingPlatformDeposit, + }); /// Creates an instance from JSON. factory TradingPlatformDepositResponse.fromJson( @@ -72,7 +70,7 @@ class TradingPlatformDepositResponse /// Creates a copy of instance with given parameters. TradingPlatformDepositResponse copyWith({ - dynamic tradingPlatformDeposit, + Map? tradingPlatformDeposit, }) => TradingPlatformDepositResponse( tradingPlatformDeposit: diff --git a/lib/api/response/trading_platform_new_account_response_result.dart b/lib/api/response/trading_platform_new_account_response_result.dart index f6fa27712a..2d3702e739 100644 --- a/lib/api/response/trading_platform_new_account_response_result.dart +++ b/lib/api/response/trading_platform_new_account_response_result.dart @@ -24,10 +24,8 @@ class TradingPlatformNewAccountResponse extends TradingPlatformNewAccountResponseModel { /// Initializes Trading platform new account response class. const TradingPlatformNewAccountResponse({ - TradingPlatformNewAccount? tradingPlatformNewAccount, - }) : super( - tradingPlatformNewAccount: tradingPlatformNewAccount, - ); + super.tradingPlatformNewAccount, + }); /// Creates an instance from JSON. factory TradingPlatformNewAccountResponse.fromJson( @@ -57,7 +55,7 @@ class TradingPlatformNewAccountResponse /// /// This call creates new Trading account, either demo or real money. /// For parameters information refer to [TradingPlatformNewAccountRequest]. - /// Throws a [BaseAPIException] if API response contains an error + /// Throws a [BaseAPIException] if API response contains an error. static Future create( TradingPlatformNewAccountRequest request, ) async { @@ -165,6 +163,7 @@ enum MarketTypeEnum { final Map platformEnumMapper = { "dxtrade": PlatformEnum.dxtrade, "derivez": PlatformEnum.derivez, + "ctrader": PlatformEnum.ctrader, }; /// Platform Enum. @@ -174,6 +173,9 @@ enum PlatformEnum { /// derivez. derivez, + + /// ctrader. + ctrader, } /// SubAccountTypeEnum mapper. @@ -181,6 +183,7 @@ final Map subAccountTypeEnumMapper = { "financial": SubAccountTypeEnum.financial, "financial_stp": SubAccountTypeEnum.financialStp, + "swap_free": SubAccountTypeEnum.swapFree, }; /// SubAccountType Enum. @@ -190,8 +193,10 @@ enum SubAccountTypeEnum { /// financial_stp. financialStp, -} + /// swap_free. + swapFree, +} /// Trading platform new account model class. abstract class TradingPlatformNewAccountModel { /// Initializes Trading platform new account model class . @@ -251,32 +256,19 @@ abstract class TradingPlatformNewAccountModel { class TradingPlatformNewAccount extends TradingPlatformNewAccountModel { /// Initializes Trading platform new account class. const TradingPlatformNewAccount({ - String? accountId, - AccountTypeEnum? accountType, - String? agent, - double? balance, - String? currency, - String? displayBalance, - int? enabled, - LandingCompanyShortEnum? landingCompanyShort, - String? login, - MarketTypeEnum? marketType, - PlatformEnum? platform, - SubAccountTypeEnum? subAccountType, - }) : super( - accountId: accountId, - accountType: accountType, - agent: agent, - balance: balance, - currency: currency, - displayBalance: displayBalance, - enabled: enabled, - landingCompanyShort: landingCompanyShort, - login: login, - marketType: marketType, - platform: platform, - subAccountType: subAccountType, - ); + super.accountId, + super.accountType, + super.agent, + super.balance, + super.currency, + super.displayBalance, + super.enabled, + super.landingCompanyShort, + super.login, + super.marketType, + super.platform, + super.subAccountType, + }); /// Creates an instance from JSON. factory TradingPlatformNewAccount.fromJson(Map json) => diff --git a/lib/api/response/trading_platform_password_change_response_result.dart b/lib/api/response/trading_platform_password_change_response_result.dart index 5009db48f4..e5fb229501 100644 --- a/lib/api/response/trading_platform_password_change_response_result.dart +++ b/lib/api/response/trading_platform_password_change_response_result.dart @@ -20,10 +20,8 @@ class TradingPlatformPasswordChangeResponse extends TradingPlatformPasswordChangeResponseModel { /// Initializes Trading platform password change response class. const TradingPlatformPasswordChangeResponse({ - bool? tradingPlatformPasswordChange, - }) : super( - tradingPlatformPasswordChange: tradingPlatformPasswordChange, - ); + super.tradingPlatformPasswordChange, + }); /// Creates an instance from JSON. factory TradingPlatformPasswordChangeResponse.fromJson( diff --git a/lib/api/response/trading_platform_password_reset_response_result.dart b/lib/api/response/trading_platform_password_reset_response_result.dart index e825b072a7..192f020abf 100644 --- a/lib/api/response/trading_platform_password_reset_response_result.dart +++ b/lib/api/response/trading_platform_password_reset_response_result.dart @@ -19,10 +19,8 @@ class TradingPlatformPasswordResetResponse extends TradingPlatformPasswordResetResponseModel { /// Initializes Trading platform password reset response class. const TradingPlatformPasswordResetResponse({ - bool? tradingPlatformPasswordReset, - }) : super( - tradingPlatformPasswordReset: tradingPlatformPasswordReset, - ); + super.tradingPlatformPasswordReset, + }); /// Creates an instance from JSON. factory TradingPlatformPasswordResetResponse.fromJson( diff --git a/lib/api/response/trading_platform_product_listing_response_result.dart b/lib/api/response/trading_platform_product_listing_response_result.dart index ad32b872ec..c3a202e1f4 100644 --- a/lib/api/response/trading_platform_product_listing_response_result.dart +++ b/lib/api/response/trading_platform_product_listing_response_result.dart @@ -21,11 +21,8 @@ class TradingPlatformProductListingResponse extends TradingPlatformProductListingResponseModel { /// Initializes Trading platform product listing response class. const TradingPlatformProductListingResponse({ - Map? - tradingPlatformProductListing, - }) : super( - tradingPlatformProductListing: tradingPlatformProductListing, - ); + super.tradingPlatformProductListing, + }); /// Creates an instance from JSON. factory TradingPlatformProductListingResponse.fromJson( @@ -92,16 +89,11 @@ class TradingPlatformProductListingProperty extends TradingPlatformProductListingPropertyModel { /// Initializes Trading platform product listing property class. const TradingPlatformProductListingProperty({ - List? availableMarkets, - List? availableTradeTypes, - String? name, - List? productList, - }) : super( - availableMarkets: availableMarkets, - availableTradeTypes: availableTradeTypes, - name: name, - productList: productList, - ); + super.availableMarkets, + super.availableTradeTypes, + super.name, + super.productList, + }); /// Creates an instance from JSON. factory TradingPlatformProductListingProperty.fromJson( @@ -206,18 +198,12 @@ abstract class ProductListItemModel { class ProductListItem extends ProductListItemModel { /// Initializes Product list item class. const ProductListItem({ - List? availableAccountTypes, - List? availableTradeTypes, - Market? market, - Submarket? submarket, - Symbol? symbol, - }) : super( - availableAccountTypes: availableAccountTypes, - availableTradeTypes: availableTradeTypes, - market: market, - submarket: submarket, - symbol: symbol, - ); + super.availableAccountTypes, + super.availableTradeTypes, + super.market, + super.submarket, + super.symbol, + }); /// Creates an instance from JSON. factory ProductListItem.fromJson(Map json) => @@ -310,12 +296,9 @@ abstract class MarketModel { class Market extends MarketModel { /// Initializes Market class. const Market({ - String? displayName, - String? name, - }) : super( - displayName: displayName, - name: name, - ); + super.displayName, + super.name, + }); /// Creates an instance from JSON. factory Market.fromJson(Map json) => Market( @@ -362,12 +345,9 @@ abstract class SubmarketModel { class Submarket extends SubmarketModel { /// Initializes Submarket class. const Submarket({ - String? displayName, - String? name, - }) : super( - displayName: displayName, - name: name, - ); + super.displayName, + super.name, + }); /// Creates an instance from JSON. factory Submarket.fromJson(Map json) => Submarket( @@ -414,12 +394,9 @@ abstract class SymbolModel { class Symbol extends SymbolModel { /// Initializes Symbol class. const Symbol({ - String? displayName, - String? name, - }) : super( - displayName: displayName, - name: name, - ); + super.displayName, + super.name, + }); /// Creates an instance from JSON. factory Symbol.fromJson(Map json) => Symbol( diff --git a/lib/api/response/trading_platform_withdrawal_response_result.dart b/lib/api/response/trading_platform_withdrawal_response_result.dart index 7afc588b40..e15ca38b05 100644 --- a/lib/api/response/trading_platform_withdrawal_response_result.dart +++ b/lib/api/response/trading_platform_withdrawal_response_result.dart @@ -20,10 +20,8 @@ class TradingPlatformWithdrawalResponse extends TradingPlatformWithdrawalResponseModel { /// Initializes Trading platform withdrawal response class. const TradingPlatformWithdrawalResponse({ - TradingPlatformWithdrawal? tradingPlatformWithdrawal, - }) : super( - tradingPlatformWithdrawal: tradingPlatformWithdrawal, - ); + super.tradingPlatformWithdrawal, + }); /// Creates an instance from JSON. factory TradingPlatformWithdrawalResponse.fromJson( @@ -71,10 +69,8 @@ abstract class TradingPlatformWithdrawalModel { class TradingPlatformWithdrawal extends TradingPlatformWithdrawalModel { /// Initializes Trading platform withdrawal class. const TradingPlatformWithdrawal({ - int? transactionId, - }) : super( - transactionId: transactionId, - ); + super.transactionId, + }); /// Creates an instance from JSON. factory TradingPlatformWithdrawal.fromJson(Map json) => diff --git a/lib/api/response/transfer_between_accounts_response_result.dart b/lib/api/response/transfer_between_accounts_response_result.dart index 393049fcc7..301a58247e 100644 --- a/lib/api/response/transfer_between_accounts_response_result.dart +++ b/lib/api/response/transfer_between_accounts_response_result.dart @@ -42,18 +42,12 @@ class TransferBetweenAccountsResponse extends TransferBetweenAccountsResponseModel { /// Initializes Transfer between accounts response class. const TransferBetweenAccountsResponse({ - bool? transferBetweenAccounts, - List? accounts, - String? clientToFullName, - String? clientToLoginid, - int? transactionId, - }) : super( - transferBetweenAccounts: transferBetweenAccounts, - accounts: accounts, - clientToFullName: clientToFullName, - clientToLoginid: clientToLoginid, - transactionId: transactionId, - ); + super.transferBetweenAccounts, + super.accounts, + super.clientToFullName, + super.clientToLoginid, + super.transactionId, + }); /// Creates an instance from JSON. factory TransferBetweenAccountsResponse.fromJson( @@ -151,6 +145,7 @@ final Map accountTypeEnumMapper = "dxtrade": AccountTypeEnum.dxtrade, "derivez": AccountTypeEnum.derivez, "binary": AccountTypeEnum.binary, + "ctrader": AccountTypeEnum.ctrader, }; /// AccountType Enum. @@ -172,6 +167,9 @@ enum AccountTypeEnum { /// binary. binary, + + /// ctrader. + ctrader, } /// MarketTypeEnum mapper. @@ -193,7 +191,6 @@ enum MarketTypeEnum { /// all. all, } - /// Accounts item model class. abstract class AccountsItemModel { /// Initializes Accounts item model class . @@ -241,26 +238,16 @@ abstract class AccountsItemModel { class AccountsItem extends AccountsItemModel { /// Initializes Accounts item class. const AccountsItem({ - AccountTypeEnum? accountType, - String? balance, - String? currency, - bool? demoAccount, - String? derivezGroup, - String? loginid, - MarketTypeEnum? marketType, - String? mt5Group, - String? status, - }) : super( - accountType: accountType, - balance: balance, - currency: currency, - demoAccount: demoAccount, - derivezGroup: derivezGroup, - loginid: loginid, - marketType: marketType, - mt5Group: mt5Group, - status: status, - ); + super.accountType, + super.balance, + super.currency, + super.demoAccount, + super.derivezGroup, + super.loginid, + super.marketType, + super.mt5Group, + super.status, + }); /// Creates an instance from JSON. factory AccountsItem.fromJson(Map json) => AccountsItem( diff --git a/lib/api/response/wallet_migration_response_extended.dart b/lib/api/response/wallet_migration_response_extended.dart new file mode 100644 index 0000000000..28b1aa2203 --- /dev/null +++ b/lib/api/response/wallet_migration_response_extended.dart @@ -0,0 +1,57 @@ +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/basic_api/generated/wallet_migration_receive.dart'; +import 'package:flutter_deriv_api/basic_api/generated/wallet_migration_send.dart'; +import 'package:flutter_deriv_api/helpers/helpers.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; + +import 'wallet_migration_response_result.dart'; + +/// The extended version of the [WalletMigrationResponse] class to implement +/// the API call methods. +class WalletMigrationResponseExtended extends WalletMigrationResponse { + static final BaseAPI _api = Injector()(); + + /// Initiates the migration process to wallet. can also check the status of + /// the migration or reset it if it has failed for any reason. + /// + /// [request] is the request object. For its `walletMigration` field, you can + /// set the following values: + /// - `start` to initiate the migration process. + /// - `state` to check the status of the migration. + /// - `reset` to reset the migration process. + static Future fetchWalletMigration({ + required WalletMigrationRequest request, + }) async { + final WalletMigrationReceive response = await _api.call(request: request); + + checkException( + response: response, + exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => + BaseAPIException(baseExceptionModel: baseExceptionModel), + ); + + return WalletMigrationResponse.fromJson(response.walletMigration); + } + + /// Starts the user's migration process to wallet. + static Future startMigration() => fetchWalletMigration( + request: const WalletMigrationRequest( + walletMigration: 'start', + ), + ); + + /// Resets the user's migration process to wallet. + static Future resetMigration() => fetchWalletMigration( + request: const WalletMigrationRequest( + walletMigration: 'reset', + ), + ); + + /// Checks the status of the user's migration process to wallet. + static Future checkStatus() => fetchWalletMigration( + request: const WalletMigrationRequest( + walletMigration: 'state', + ), + ); +} diff --git a/lib/api/response/wallet_migration_response_result.dart b/lib/api/response/wallet_migration_response_result.dart new file mode 100644 index 0000000000..ebe3e04e10 --- /dev/null +++ b/lib/api/response/wallet_migration_response_result.dart @@ -0,0 +1,417 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Wallet migration response model class. +abstract class WalletMigrationResponseModel { + /// Initializes Wallet migration response model class . + const WalletMigrationResponseModel({ + this.walletMigration, + }); + + /// The information regarding wallet migration state + final WalletMigration? walletMigration; +} + +/// Wallet migration response class. +class WalletMigrationResponse extends WalletMigrationResponseModel { + /// Initializes Wallet migration response class. + const WalletMigrationResponse({ + super.walletMigration, + }); + + /// Creates an instance from JSON. + factory WalletMigrationResponse.fromJson( + dynamic walletMigrationJson, + ) => + WalletMigrationResponse( + walletMigration: walletMigrationJson == null + ? null + : WalletMigration.fromJson(walletMigrationJson), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (walletMigration != null) { + resultMap['wallet_migration'] = walletMigration!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + WalletMigrationResponse copyWith({ + WalletMigration? walletMigration, + }) => + WalletMigrationResponse( + walletMigration: walletMigration ?? this.walletMigration, + ); +} + +/// AccountCategoryEnum mapper. +final Map accountCategoryEnumMapper = + { + "wallet": AccountCategoryEnum.wallet, +}; + +/// AccountCategory Enum. +enum AccountCategoryEnum { + /// wallet. + wallet, +} + +/// LinkAccountsItemAccountCategoryEnum mapper. +final Map + linkAccountsItemAccountCategoryEnumMapper = + { + "trading": LinkAccountsItemAccountCategoryEnum.trading, +}; + +/// AccountCategory Enum. +enum LinkAccountsItemAccountCategoryEnum { + /// trading. + trading, +} + +/// AccountTypeEnum mapper. +final Map accountTypeEnumMapper = + { + "standard": AccountTypeEnum.standard, + "mt5": AccountTypeEnum.mt5, + "dxtrade": AccountTypeEnum.dxtrade, + "derivez": AccountTypeEnum.derivez, + "ctrader": AccountTypeEnum.ctrader, +}; + +/// AccountType Enum. +enum AccountTypeEnum { + /// standard. + standard, + + /// mt5. + mt5, + + /// dxtrade. + dxtrade, + + /// derivez. + derivez, + + /// ctrader. + ctrader, +} + +/// PlatformEnum mapper. +final Map platformEnumMapper = { + "dtrade": PlatformEnum.dtrade, + "mt5": PlatformEnum.mt5, + "dxtrade": PlatformEnum.dxtrade, + "derivez": PlatformEnum.derivez, + "ctrader": PlatformEnum.ctrader, +}; + +/// Platform Enum. +enum PlatformEnum { + /// dtrade. + dtrade, + + /// mt5. + mt5, + + /// dxtrade. + dxtrade, + + /// derivez. + derivez, + + /// ctrader. + ctrader, +} + +/// AccountListItemPlatformEnum mapper. +final Map + accountListItemPlatformEnumMapper = { + "dwallet": AccountListItemPlatformEnum.dwallet, +}; + +/// Platform Enum. +enum AccountListItemPlatformEnum { + /// dwallet. + dwallet, +} + +/// StateEnum mapper. +final Map stateEnumMapper = { + "ineligible": StateEnum.ineligible, + "eligible": StateEnum.eligible, + "in_progress": StateEnum.inProgress, + "migrated": StateEnum.migrated, + "failed": StateEnum.failed, +}; + +/// State Enum. +enum StateEnum { + /// ineligible. + ineligible, + + /// eligible. + eligible, + + /// in_progress. + inProgress, + + /// migrated. + migrated, + + /// failed. + failed, +} +/// Wallet migration model class. +abstract class WalletMigrationModel { + /// Initializes Wallet migration model class . + const WalletMigrationModel({ + required this.state, + this.accountList, + }); + + /// Current state of migration process + final StateEnum state; + + /// [Optional] This field is only presented when state is eligible. It contains a list of accounts that are eligible for migration and provide information what wallets are going to be created + final List? accountList; +} + +/// Wallet migration class. +class WalletMigration extends WalletMigrationModel { + /// Initializes Wallet migration class. + const WalletMigration({ + required super.state, + super.accountList, + }); + + /// Creates an instance from JSON. + factory WalletMigration.fromJson(Map json) => + WalletMigration( + state: stateEnumMapper[json['state']]!, + accountList: json['account_list'] == null + ? null + : List.from( + json['account_list']?.map( + (dynamic item) => AccountListItem.fromJson(item), + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['state'] = stateEnumMapper.entries + .firstWhere((MapEntry entry) => entry.value == state) + .key; + if (accountList != null) { + resultMap['account_list'] = accountList! + .map( + (AccountListItem item) => item.toJson(), + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + WalletMigration copyWith({ + StateEnum? state, + List? accountList, + }) => + WalletMigration( + state: state ?? this.state, + accountList: accountList ?? this.accountList, + ); +} +/// Account list item model class. +abstract class AccountListItemModel { + /// Initializes Account list item model class . + const AccountListItemModel({ + required this.platform, + required this.linkAccounts, + required this.landingCompanyShort, + required this.currency, + required this.accountType, + required this.accountCategory, + }); + + /// The platform of the account + final AccountListItemPlatformEnum platform; + + /// The list of accounts that will be linked to this wallet account + final List linkAccounts; + + /// The landing company short code of the account + final String landingCompanyShort; + + /// The currency of the account + final String currency; + + /// The type of the account + final String accountType; + + /// The category of the account + final AccountCategoryEnum accountCategory; +} + +/// Account list item class. +class AccountListItem extends AccountListItemModel { + /// Initializes Account list item class. + const AccountListItem({ + required super.accountCategory, + required super.accountType, + required super.currency, + required super.landingCompanyShort, + required super.linkAccounts, + required super.platform, + }); + + /// Creates an instance from JSON. + factory AccountListItem.fromJson(Map json) => + AccountListItem( + accountCategory: accountCategoryEnumMapper[json['account_category']]!, + accountType: json['account_type'], + currency: json['currency'], + landingCompanyShort: json['landing_company_short'], + linkAccounts: List.from( + json['link_accounts'].map( + (dynamic item) => LinkAccountsItem.fromJson(item), + ), + ), + platform: accountListItemPlatformEnumMapper[json['platform']]!, + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['account_category'] = accountCategoryEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == accountCategory) + .key; + resultMap['account_type'] = accountType; + resultMap['currency'] = currency; + resultMap['landing_company_short'] = landingCompanyShort; + resultMap['link_accounts'] = linkAccounts + .map( + (LinkAccountsItem item) => item.toJson(), + ) + .toList(); + + resultMap['platform'] = accountListItemPlatformEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == platform) + .key; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + AccountListItem copyWith({ + AccountCategoryEnum? accountCategory, + String? accountType, + String? currency, + String? landingCompanyShort, + List? linkAccounts, + AccountListItemPlatformEnum? platform, + }) => + AccountListItem( + accountCategory: accountCategory ?? this.accountCategory, + accountType: accountType ?? this.accountType, + currency: currency ?? this.currency, + landingCompanyShort: landingCompanyShort ?? this.landingCompanyShort, + linkAccounts: linkAccounts ?? this.linkAccounts, + platform: platform ?? this.platform, + ); +} +/// Link accounts item model class. +abstract class LinkAccountsItemModel { + /// Initializes Link accounts item model class . + const LinkAccountsItemModel({ + required this.platform, + required this.loginid, + required this.accountType, + required this.accountCategory, + }); + + /// The platform of the account + final PlatformEnum platform; + + /// The loginid of the account + final String loginid; + + /// The type of the account + final AccountTypeEnum accountType; + + /// The category of the account + final LinkAccountsItemAccountCategoryEnum accountCategory; +} + +/// Link accounts item class. +class LinkAccountsItem extends LinkAccountsItemModel { + /// Initializes Link accounts item class. + const LinkAccountsItem({ + required super.accountCategory, + required super.accountType, + required super.loginid, + required super.platform, + }); + + /// Creates an instance from JSON. + factory LinkAccountsItem.fromJson(Map json) => + LinkAccountsItem( + accountCategory: linkAccountsItemAccountCategoryEnumMapper[ + json['account_category']]!, + accountType: accountTypeEnumMapper[json['account_type']]!, + loginid: json['loginid'], + platform: platformEnumMapper[json['platform']]!, + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['account_category'] = linkAccountsItemAccountCategoryEnumMapper + .entries + .firstWhere( + (MapEntry entry) => + entry.value == accountCategory) + .key; + resultMap['account_type'] = accountTypeEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == accountType) + .key; + resultMap['loginid'] = loginid; + resultMap['platform'] = platformEnumMapper.entries + .firstWhere( + (MapEntry entry) => entry.value == platform) + .key; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + LinkAccountsItem copyWith({ + LinkAccountsItemAccountCategoryEnum? accountCategory, + AccountTypeEnum? accountType, + String? loginid, + PlatformEnum? platform, + }) => + LinkAccountsItem( + accountCategory: accountCategory ?? this.accountCategory, + accountType: accountType ?? this.accountType, + loginid: loginid ?? this.loginid, + platform: platform ?? this.platform, + ); +} diff --git a/lib/api/response/website_status_response_result.dart b/lib/api/response/website_status_response_result.dart index 058b5a26ac..9b30d661b8 100644 --- a/lib/api/response/website_status_response_result.dart +++ b/lib/api/response/website_status_response_result.dart @@ -36,12 +36,9 @@ abstract class WebsiteStatusResponseModel { class WebsiteStatusResponse extends WebsiteStatusResponseModel { /// Initializes Website status response class. const WebsiteStatusResponse({ - WebsiteStatus? websiteStatus, - Subscription? subscription, - }) : super( - websiteStatus: websiteStatus, - subscription: subscription, - ); + super.websiteStatus, + super.subscription, + }); /// Creates an instance from JSON. factory WebsiteStatusResponse.fromJson( @@ -284,13 +281,13 @@ enum SiteStatusEnum { /// updating. updating, } - /// Website status model class. abstract class WebsiteStatusModel { /// Initializes Website status model class . const WebsiteStatusModel({ required this.currenciesConfig, required this.apiCallLimits, + this.brokerCodes, this.clientsCountry, this.dxtradeStatus, this.message, @@ -308,6 +305,9 @@ abstract class WebsiteStatusModel { /// Maximum number of API calls during specified period of time. final ApiCallLimits apiCallLimits; + /// List of all available broker codes. + final List? brokerCodes; + /// Country code of connected IP final String? clientsCountry; @@ -340,30 +340,19 @@ abstract class WebsiteStatusModel { class WebsiteStatus extends WebsiteStatusModel { /// Initializes Website status class. const WebsiteStatus({ - required ApiCallLimits apiCallLimits, - required Map currenciesConfig, - String? clientsCountry, - DxtradeStatus? dxtradeStatus, - String? message, - Mt5Status? mt5Status, - P2pConfig? p2pConfig, - PaymentAgents? paymentAgents, - SiteStatusEnum? siteStatus, - List? supportedLanguages, - String? termsConditionsVersion, - }) : super( - apiCallLimits: apiCallLimits, - currenciesConfig: currenciesConfig, - clientsCountry: clientsCountry, - dxtradeStatus: dxtradeStatus, - message: message, - mt5Status: mt5Status, - p2pConfig: p2pConfig, - paymentAgents: paymentAgents, - siteStatus: siteStatus, - supportedLanguages: supportedLanguages, - termsConditionsVersion: termsConditionsVersion, - ); + required super.apiCallLimits, + required super.currenciesConfig, + super.brokerCodes, + super.clientsCountry, + super.dxtradeStatus, + super.message, + super.mt5Status, + super.p2pConfig, + super.paymentAgents, + super.siteStatus, + super.supportedLanguages, + super.termsConditionsVersion, + }); /// Creates an instance from JSON. factory WebsiteStatus.fromJson(Map json) => WebsiteStatus( @@ -375,6 +364,13 @@ class WebsiteStatus extends WebsiteStatusModel { (MapEntry entry) => MapEntry(entry.key, CurrenciesConfigProperty.fromJson(entry.value)))), + brokerCodes: json['broker_codes'] == null + ? null + : List.from( + json['broker_codes']?.map( + (dynamic item) => item, + ), + ), clientsCountry: json['clients_country'], dxtradeStatus: json['dxtrade_status'] == null ? null @@ -409,6 +405,13 @@ class WebsiteStatus extends WebsiteStatusModel { resultMap['api_call_limits'] = apiCallLimits.toJson(); resultMap['currencies_config'] = currenciesConfig; + if (brokerCodes != null) { + resultMap['broker_codes'] = brokerCodes! + .map( + (String item) => item, + ) + .toList(); + } resultMap['clients_country'] = clientsCountry; if (dxtradeStatus != null) { resultMap['dxtrade_status'] = dxtradeStatus!.toJson(); @@ -443,6 +446,7 @@ class WebsiteStatus extends WebsiteStatusModel { WebsiteStatus copyWith({ ApiCallLimits? apiCallLimits, Map? currenciesConfig, + List? brokerCodes, String? clientsCountry, DxtradeStatus? dxtradeStatus, String? message, @@ -456,6 +460,7 @@ class WebsiteStatus extends WebsiteStatusModel { WebsiteStatus( apiCallLimits: apiCallLimits ?? this.apiCallLimits, currenciesConfig: currenciesConfig ?? this.currenciesConfig, + brokerCodes: brokerCodes ?? this.brokerCodes, clientsCountry: clientsCountry ?? this.clientsCountry, dxtradeStatus: dxtradeStatus ?? this.dxtradeStatus, message: message ?? this.message, @@ -468,7 +473,6 @@ class WebsiteStatus extends WebsiteStatusModel { termsConditionsVersion ?? this.termsConditionsVersion, ); } - /// Api call limits model class. abstract class ApiCallLimitsModel { /// Initializes Api call limits model class . @@ -496,16 +500,11 @@ abstract class ApiCallLimitsModel { class ApiCallLimits extends ApiCallLimitsModel { /// Initializes Api call limits class. const ApiCallLimits({ - required MaxProposalSubscription maxProposalSubscription, - required MaxRequestesGeneral maxRequestesGeneral, - required MaxRequestsOutcome maxRequestsOutcome, - required MaxRequestsPricing maxRequestsPricing, - }) : super( - maxProposalSubscription: maxProposalSubscription, - maxRequestesGeneral: maxRequestesGeneral, - maxRequestsOutcome: maxRequestsOutcome, - maxRequestsPricing: maxRequestsPricing, - ); + required super.maxProposalSubscription, + required super.maxRequestesGeneral, + required super.maxRequestsOutcome, + required super.maxRequestsPricing, + }); /// Creates an instance from JSON. factory ApiCallLimits.fromJson(Map json) => ApiCallLimits( @@ -549,7 +548,6 @@ class ApiCallLimits extends ApiCallLimitsModel { maxRequestsPricing: maxRequestsPricing ?? this.maxRequestsPricing, ); } - /// Max proposal subscription model class. abstract class MaxProposalSubscriptionModel { /// Initializes Max proposal subscription model class . @@ -569,12 +567,9 @@ abstract class MaxProposalSubscriptionModel { class MaxProposalSubscription extends MaxProposalSubscriptionModel { /// Initializes Max proposal subscription class. const MaxProposalSubscription({ - required String appliesTo, - required double max, - }) : super( - appliesTo: appliesTo, - max: max, - ); + required super.appliesTo, + required super.max, + }); /// Creates an instance from JSON. factory MaxProposalSubscription.fromJson(Map json) => @@ -603,7 +598,6 @@ class MaxProposalSubscription extends MaxProposalSubscriptionModel { max: max ?? this.max, ); } - /// Max requestes general model class. abstract class MaxRequestesGeneralModel { /// Initializes Max requestes general model class . @@ -627,14 +621,10 @@ abstract class MaxRequestesGeneralModel { class MaxRequestesGeneral extends MaxRequestesGeneralModel { /// Initializes Max requestes general class. const MaxRequestesGeneral({ - required String appliesTo, - required double hourly, - required double minutely, - }) : super( - appliesTo: appliesTo, - hourly: hourly, - minutely: minutely, - ); + required super.appliesTo, + required super.hourly, + required super.minutely, + }); /// Creates an instance from JSON. factory MaxRequestesGeneral.fromJson(Map json) => @@ -667,7 +657,6 @@ class MaxRequestesGeneral extends MaxRequestesGeneralModel { minutely: minutely ?? this.minutely, ); } - /// Max requests outcome model class. abstract class MaxRequestsOutcomeModel { /// Initializes Max requests outcome model class . @@ -691,14 +680,10 @@ abstract class MaxRequestsOutcomeModel { class MaxRequestsOutcome extends MaxRequestsOutcomeModel { /// Initializes Max requests outcome class. const MaxRequestsOutcome({ - required String appliesTo, - required double hourly, - required double minutely, - }) : super( - appliesTo: appliesTo, - hourly: hourly, - minutely: minutely, - ); + required super.appliesTo, + required super.hourly, + required super.minutely, + }); /// Creates an instance from JSON. factory MaxRequestsOutcome.fromJson(Map json) => @@ -731,7 +716,6 @@ class MaxRequestsOutcome extends MaxRequestsOutcomeModel { minutely: minutely ?? this.minutely, ); } - /// Max requests pricing model class. abstract class MaxRequestsPricingModel { /// Initializes Max requests pricing model class . @@ -755,14 +739,10 @@ abstract class MaxRequestsPricingModel { class MaxRequestsPricing extends MaxRequestsPricingModel { /// Initializes Max requests pricing class. const MaxRequestsPricing({ - required String appliesTo, - required double hourly, - required double minutely, - }) : super( - appliesTo: appliesTo, - hourly: hourly, - minutely: minutely, - ); + required super.appliesTo, + required super.hourly, + required super.minutely, + }); /// Creates an instance from JSON. factory MaxRequestsPricing.fromJson(Map json) => @@ -795,7 +775,6 @@ class MaxRequestsPricing extends MaxRequestsPricingModel { minutely: minutely ?? this.minutely, ); } - /// Currencies config property model class. abstract class CurrenciesConfigPropertyModel { /// Initializes Currencies config property model class . @@ -839,24 +818,15 @@ abstract class CurrenciesConfigPropertyModel { class CurrenciesConfigProperty extends CurrenciesConfigPropertyModel { /// Initializes Currencies config property class. const CurrenciesConfigProperty({ - required double fractionalDigits, - required double isDepositSuspended, - required double isSuspended, - required double isWithdrawalSuspended, - required double stakeDefault, - required TransferBetweenAccounts transferBetweenAccounts, - required TypeEnum type, - String? name, - }) : super( - fractionalDigits: fractionalDigits, - isDepositSuspended: isDepositSuspended, - isSuspended: isSuspended, - isWithdrawalSuspended: isWithdrawalSuspended, - stakeDefault: stakeDefault, - transferBetweenAccounts: transferBetweenAccounts, - type: type, - name: name, - ); + required super.fractionalDigits, + required super.isDepositSuspended, + required super.isSuspended, + required super.isWithdrawalSuspended, + required super.stakeDefault, + required super.transferBetweenAccounts, + required super.type, + super.name, + }); /// Creates an instance from JSON. factory CurrenciesConfigProperty.fromJson(Map json) => @@ -915,13 +885,13 @@ class CurrenciesConfigProperty extends CurrenciesConfigPropertyModel { name: name ?? this.name, ); } - /// Transfer between accounts model class. abstract class TransferBetweenAccountsModel { /// Initializes Transfer between accounts model class . const TransferBetweenAccountsModel({ required this.limits, required this.fees, + this.limitsCtrader, this.limitsDerivez, this.limitsDxtrade, this.limitsMt5, @@ -933,6 +903,9 @@ abstract class TransferBetweenAccountsModel { /// The fee that applies for transfer between accounts with different types of currencies. final Map fees; + /// Range of allowed amount for transfer between ctrader accounts. + final Map? limitsCtrader; + /// Range of allowed amount for transfer between derivez accounts. final Map? limitsDerivez; @@ -947,18 +920,13 @@ abstract class TransferBetweenAccountsModel { class TransferBetweenAccounts extends TransferBetweenAccountsModel { /// Initializes Transfer between accounts class. const TransferBetweenAccounts({ - required Map fees, - required Limits limits, - Map? limitsDerivez, - Map? limitsDxtrade, - Map? limitsMt5, - }) : super( - fees: fees, - limits: limits, - limitsDerivez: limitsDerivez, - limitsDxtrade: limitsDxtrade, - limitsMt5: limitsMt5, - ); + required super.fees, + required super.limits, + super.limitsCtrader, + super.limitsDerivez, + super.limitsDxtrade, + super.limitsMt5, + }); /// Creates an instance from JSON. factory TransferBetweenAccounts.fromJson(Map json) => @@ -968,6 +936,7 @@ class TransferBetweenAccounts extends TransferBetweenAccountsModel { .map>((MapEntry entry) => MapEntry(entry.key, getDouble(entry.value)!))), limits: Limits.fromJson(json['limits']), + limitsCtrader: json['limits_ctrader'], limitsDerivez: json['limits_derivez'], limitsDxtrade: json['limits_dxtrade'], limitsMt5: json['limits_mt5'], @@ -980,6 +949,7 @@ class TransferBetweenAccounts extends TransferBetweenAccountsModel { resultMap['fees'] = fees; resultMap['limits'] = limits.toJson(); + resultMap['limits_ctrader'] = limitsCtrader; resultMap['limits_derivez'] = limitsDerivez; resultMap['limits_dxtrade'] = limitsDxtrade; resultMap['limits_mt5'] = limitsMt5; @@ -991,6 +961,7 @@ class TransferBetweenAccounts extends TransferBetweenAccountsModel { TransferBetweenAccounts copyWith({ Map? fees, Limits? limits, + Map? limitsCtrader, Map? limitsDerivez, Map? limitsDxtrade, Map? limitsMt5, @@ -998,12 +969,12 @@ class TransferBetweenAccounts extends TransferBetweenAccountsModel { TransferBetweenAccounts( fees: fees ?? this.fees, limits: limits ?? this.limits, + limitsCtrader: limitsCtrader ?? this.limitsCtrader, limitsDerivez: limitsDerivez ?? this.limitsDerivez, limitsDxtrade: limitsDxtrade ?? this.limitsDxtrade, limitsMt5: limitsMt5 ?? this.limitsMt5, ); } - /// Limits model class. abstract class LimitsModel { /// Initializes Limits model class . @@ -1023,12 +994,9 @@ abstract class LimitsModel { class Limits extends LimitsModel { /// Initializes Limits class. const Limits({ - required double min, - double? max, - }) : super( - min: min, - max: max, - ); + required super.min, + super.max, + }); /// Creates an instance from JSON. factory Limits.fromJson(Map json) => Limits( @@ -1056,7 +1024,6 @@ class Limits extends LimitsModel { max: max ?? this.max, ); } - /// Dxtrade status model class. abstract class DxtradeStatusModel { /// Initializes Dxtrade status model class . @@ -1080,14 +1047,10 @@ abstract class DxtradeStatusModel { class DxtradeStatus extends DxtradeStatusModel { /// Initializes Dxtrade status class. const DxtradeStatus({ - int? all, - int? demo, - int? real, - }) : super( - all: all, - demo: demo, - real: real, - ); + super.all, + super.demo, + super.real, + }); /// Creates an instance from JSON. factory DxtradeStatus.fromJson(Map json) => DxtradeStatus( @@ -1119,7 +1082,6 @@ class DxtradeStatus extends DxtradeStatusModel { real: real ?? this.real, ); } - /// Mt5 status model class. abstract class Mt5StatusModel { /// Initializes Mt5 status model class . @@ -1139,12 +1101,9 @@ abstract class Mt5StatusModel { class Mt5Status extends Mt5StatusModel { /// Initializes Mt5 status class. const Mt5Status({ - List? demo, - List? real, - }) : super( - demo: demo, - real: real, - ); + super.demo, + super.real, + }); /// Creates an instance from JSON. factory Mt5Status.fromJson(Map json) => Mt5Status( @@ -1196,7 +1155,6 @@ class Mt5Status extends Mt5StatusModel { real: real ?? this.real, ); } - /// P2p config model class. abstract class P2pConfigModel { /// Initializes P2p config model class . @@ -1214,10 +1172,12 @@ abstract class P2pConfigModel { required this.fixedRateAdverts, required this.featureLevel, required this.disabled, + required this.crossBorderAdsEnabled, required this.cancellationLimit, required this.cancellationGracePeriod, required this.cancellationCountPeriod, required this.cancellationBlockDuration, + required this.blockTrade, required this.advertsActiveLimit, this.advertsArchivePeriod, this.fixedRateAdvertsEndDate, @@ -1263,6 +1223,9 @@ abstract class P2pConfigModel { /// When `true`, the P2P service is unavailable. final bool disabled; + /// When `false`, only exchanges in local currency are allowed for P2P advertiser. + final bool crossBorderAdsEnabled; + /// A buyer will be temporarily barred after marking this number of cancellations within cancellation_period. final int cancellationLimit; @@ -1275,6 +1238,9 @@ abstract class P2pConfigModel { /// A buyer will be blocked for this duration after exceeding the cancellation limit, in hours. final int cancellationBlockDuration; + /// Block trading settings + final BlockTrade blockTrade; + /// Maximum number of active ads allowed by an advertiser per currency pair and advert type (buy or sell). final int advertsActiveLimit; @@ -1292,58 +1258,40 @@ abstract class P2pConfigModel { class P2pConfig extends P2pConfigModel { /// Initializes P2p config class. const P2pConfig({ - required int advertsActiveLimit, - required int cancellationBlockDuration, - required int cancellationCountPeriod, - required int cancellationGracePeriod, - required int cancellationLimit, - required bool disabled, - required int featureLevel, - required FixedRateAdvertsEnum fixedRateAdverts, - required FloatRateAdvertsEnum floatRateAdverts, - required double floatRateOffsetLimit, - required List localCurrencies, - required double maximumAdvertAmount, - required double maximumOrderAmount, - required int orderDailyLimit, - required int orderPaymentPeriod, - required bool paymentMethodsEnabled, - required double reviewPeriod, - required List supportedCurrencies, - int? advertsArchivePeriod, - String? fixedRateAdvertsEndDate, - String? overrideExchangeRate, - }) : super( - advertsActiveLimit: advertsActiveLimit, - cancellationBlockDuration: cancellationBlockDuration, - cancellationCountPeriod: cancellationCountPeriod, - cancellationGracePeriod: cancellationGracePeriod, - cancellationLimit: cancellationLimit, - disabled: disabled, - featureLevel: featureLevel, - fixedRateAdverts: fixedRateAdverts, - floatRateAdverts: floatRateAdverts, - floatRateOffsetLimit: floatRateOffsetLimit, - localCurrencies: localCurrencies, - maximumAdvertAmount: maximumAdvertAmount, - maximumOrderAmount: maximumOrderAmount, - orderDailyLimit: orderDailyLimit, - orderPaymentPeriod: orderPaymentPeriod, - paymentMethodsEnabled: paymentMethodsEnabled, - reviewPeriod: reviewPeriod, - supportedCurrencies: supportedCurrencies, - advertsArchivePeriod: advertsArchivePeriod, - fixedRateAdvertsEndDate: fixedRateAdvertsEndDate, - overrideExchangeRate: overrideExchangeRate, - ); + required super.advertsActiveLimit, + required super.blockTrade, + required super.cancellationBlockDuration, + required super.cancellationCountPeriod, + required super.cancellationGracePeriod, + required super.cancellationLimit, + required super.crossBorderAdsEnabled, + required super.disabled, + required super.featureLevel, + required super.fixedRateAdverts, + required super.floatRateAdverts, + required super.floatRateOffsetLimit, + required super.localCurrencies, + required super.maximumAdvertAmount, + required super.maximumOrderAmount, + required super.orderDailyLimit, + required super.orderPaymentPeriod, + required super.paymentMethodsEnabled, + required super.reviewPeriod, + required super.supportedCurrencies, + super.advertsArchivePeriod, + super.fixedRateAdvertsEndDate, + super.overrideExchangeRate, + }); /// Creates an instance from JSON. factory P2pConfig.fromJson(Map json) => P2pConfig( advertsActiveLimit: json['adverts_active_limit'], + blockTrade: BlockTrade.fromJson(json['block_trade']), cancellationBlockDuration: json['cancellation_block_duration'], cancellationCountPeriod: json['cancellation_count_period'], cancellationGracePeriod: json['cancellation_grace_period'], cancellationLimit: json['cancellation_limit'], + crossBorderAdsEnabled: getBool(json['cross_border_ads_enabled'])!, disabled: getBool(json['disabled'])!, featureLevel: json['feature_level'], fixedRateAdverts: @@ -1377,10 +1325,13 @@ class P2pConfig extends P2pConfigModel { final Map resultMap = {}; resultMap['adverts_active_limit'] = advertsActiveLimit; + resultMap['block_trade'] = blockTrade.toJson(); + resultMap['cancellation_block_duration'] = cancellationBlockDuration; resultMap['cancellation_count_period'] = cancellationCountPeriod; resultMap['cancellation_grace_period'] = cancellationGracePeriod; resultMap['cancellation_limit'] = cancellationLimit; + resultMap['cross_border_ads_enabled'] = crossBorderAdsEnabled; resultMap['disabled'] = disabled; resultMap['feature_level'] = featureLevel; resultMap['fixed_rate_adverts'] = fixedRateAdvertsEnumMapper.entries @@ -1420,10 +1371,12 @@ class P2pConfig extends P2pConfigModel { /// Creates a copy of instance with given parameters. P2pConfig copyWith({ int? advertsActiveLimit, + BlockTrade? blockTrade, int? cancellationBlockDuration, int? cancellationCountPeriod, int? cancellationGracePeriod, int? cancellationLimit, + bool? crossBorderAdsEnabled, bool? disabled, int? featureLevel, FixedRateAdvertsEnum? fixedRateAdverts, @@ -1443,6 +1396,7 @@ class P2pConfig extends P2pConfigModel { }) => P2pConfig( advertsActiveLimit: advertsActiveLimit ?? this.advertsActiveLimit, + blockTrade: blockTrade ?? this.blockTrade, cancellationBlockDuration: cancellationBlockDuration ?? this.cancellationBlockDuration, cancellationCountPeriod: @@ -1450,6 +1404,8 @@ class P2pConfig extends P2pConfigModel { cancellationGracePeriod: cancellationGracePeriod ?? this.cancellationGracePeriod, cancellationLimit: cancellationLimit ?? this.cancellationLimit, + crossBorderAdsEnabled: + crossBorderAdsEnabled ?? this.crossBorderAdsEnabled, disabled: disabled ?? this.disabled, featureLevel: featureLevel ?? this.featureLevel, fixedRateAdverts: fixedRateAdverts ?? this.fixedRateAdverts, @@ -1470,7 +1426,55 @@ class P2pConfig extends P2pConfigModel { overrideExchangeRate: overrideExchangeRate ?? this.overrideExchangeRate, ); } +/// Block trade model class. +abstract class BlockTradeModel { + /// Initializes Block trade model class . + const BlockTradeModel({ + this.disabled, + this.maximumAdvertAmount, + }); + + /// When `true`, Block trading is unavailable. + final bool? disabled; + + /// Maximum amount of a block trade advert, in USD. + final double? maximumAdvertAmount; +} + +/// Block trade class. +class BlockTrade extends BlockTradeModel { + /// Initializes Block trade class. + const BlockTrade({ + super.disabled, + super.maximumAdvertAmount, + }); + + /// Creates an instance from JSON. + factory BlockTrade.fromJson(Map json) => BlockTrade( + disabled: getBool(json['disabled']), + maximumAdvertAmount: getDouble(json['maximum_advert_amount']), + ); + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['disabled'] = disabled; + resultMap['maximum_advert_amount'] = maximumAdvertAmount; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + BlockTrade copyWith({ + bool? disabled, + double? maximumAdvertAmount, + }) => + BlockTrade( + disabled: disabled ?? this.disabled, + maximumAdvertAmount: maximumAdvertAmount ?? this.maximumAdvertAmount, + ); +} /// Local currencies item model class. abstract class LocalCurrenciesItemModel { /// Initializes Local currencies item model class . @@ -1498,16 +1502,11 @@ abstract class LocalCurrenciesItemModel { class LocalCurrenciesItem extends LocalCurrenciesItemModel { /// Initializes Local currencies item class. const LocalCurrenciesItem({ - required String displayName, - required bool hasAdverts, - required String symbol, - int? isDefault, - }) : super( - displayName: displayName, - hasAdverts: hasAdverts, - symbol: symbol, - isDefault: isDefault, - ); + required super.displayName, + required super.hasAdverts, + required super.symbol, + super.isDefault, + }); /// Creates an instance from JSON. factory LocalCurrenciesItem.fromJson(Map json) => @@ -1544,7 +1543,6 @@ class LocalCurrenciesItem extends LocalCurrenciesItemModel { isDefault: isDefault ?? this.isDefault, ); } - /// Payment agents model class. abstract class PaymentAgentsModel { /// Initializes Payment agents model class . @@ -1560,10 +1558,8 @@ abstract class PaymentAgentsModel { class PaymentAgents extends PaymentAgentsModel { /// Initializes Payment agents class. const PaymentAgents({ - required Map initialDepositPerCountry, - }) : super( - initialDepositPerCountry: initialDepositPerCountry, - ); + required super.initialDepositPerCountry, + }); /// Creates an instance from JSON. factory PaymentAgents.fromJson(Map json) => PaymentAgents( @@ -1592,7 +1588,6 @@ class PaymentAgents extends PaymentAgentsModel { initialDepositPerCountry ?? this.initialDepositPerCountry, ); } - /// Subscription model class. abstract class SubscriptionModel { /// Initializes Subscription model class . @@ -1608,10 +1603,8 @@ abstract class SubscriptionModel { class Subscription extends SubscriptionModel { /// Initializes Subscription class. const Subscription({ - required String id, - }) : super( - id: id, - ); + required super.id, + }); /// Creates an instance from JSON. factory Subscription.fromJson(Map json) => Subscription( diff --git a/lib/basic_api/generated/authorize_receive.dart b/lib/basic_api/generated/authorize_receive.dart index b40f4887df..6a2dea5963 100644 --- a/lib/basic_api/generated/authorize_receive.dart +++ b/lib/basic_api/generated/authorize_receive.dart @@ -9,16 +9,11 @@ class AuthorizeReceive extends Response { /// Initialize AuthorizeReceive. const AuthorizeReceive({ this.authorize, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory AuthorizeReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/authorize_send.dart b/lib/basic_api/generated/authorize_send.dart index 31ecf87105..15c237dbd3 100644 --- a/lib/basic_api/generated/authorize_send.dart +++ b/lib/basic_api/generated/authorize_send.dart @@ -10,13 +10,10 @@ class AuthorizeRequest extends Request { const AuthorizeRequest({ this.addToLoginHistory, required this.authorize, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'authorize', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'authorize', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory AuthorizeRequest.fromJson(Map json) => diff --git a/lib/basic_api/generated/get_account_types_receive.dart b/lib/basic_api/generated/get_account_types_receive.dart index 3cded5047b..2542422c26 100644 --- a/lib/basic_api/generated/get_account_types_receive.dart +++ b/lib/basic_api/generated/get_account_types_receive.dart @@ -9,16 +9,11 @@ class GetAccountTypesReceive extends Response { /// Initialize GetAccountTypesReceive. const GetAccountTypesReceive({ this.getAccountTypes, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory GetAccountTypesReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/get_account_types_send.dart b/lib/basic_api/generated/get_account_types_send.dart index ec218b33b8..3697fec157 100644 --- a/lib/basic_api/generated/get_account_types_send.dart +++ b/lib/basic_api/generated/get_account_types_send.dart @@ -8,18 +8,17 @@ import '../request.dart'; class GetAccountTypesRequest extends Request { /// Initialize GetAccountTypesRequest. const GetAccountTypesRequest({ + this.company, this.getAccountTypes = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'get_account_types', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'get_account_types', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory GetAccountTypesRequest.fromJson(Map json) => GetAccountTypesRequest( + company: json['company'] as String?, getAccountTypes: json['get_account_types'] == null ? null : json['get_account_types'] == 1, @@ -27,12 +26,16 @@ class GetAccountTypesRequest extends Request { reqId: json['req_id'] as int?, ); + /// [Optional] Set to landing company to get relevant account types. If not set, this defaults to current account landing company + final String? company; + /// Must be `true` final bool? getAccountTypes; /// Converts this instance to JSON @override Map toJson() => { + 'company': company, 'get_account_types': getAccountTypes == null ? null : getAccountTypes! @@ -45,11 +48,13 @@ class GetAccountTypesRequest extends Request { /// Creates a copy of instance with given parameters @override GetAccountTypesRequest copyWith({ + String? company, bool? getAccountTypes, Map? passthrough, int? reqId, }) => GetAccountTypesRequest( + company: company ?? this.company, getAccountTypes: getAccountTypes ?? this.getAccountTypes, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/get_settings_receive.dart b/lib/basic_api/generated/get_settings_receive.dart index 4822730a8d..9cac4c85ae 100644 --- a/lib/basic_api/generated/get_settings_receive.dart +++ b/lib/basic_api/generated/get_settings_receive.dart @@ -9,16 +9,11 @@ class GetSettingsReceive extends Response { /// Initialize GetSettingsReceive. const GetSettingsReceive({ this.getSettings, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory GetSettingsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/get_settings_send.dart b/lib/basic_api/generated/get_settings_send.dart index 3983af76ae..2f8605934c 100644 --- a/lib/basic_api/generated/get_settings_send.dart +++ b/lib/basic_api/generated/get_settings_send.dart @@ -9,13 +9,10 @@ class GetSettingsRequest extends Request { /// Initialize GetSettingsRequest. const GetSettingsRequest({ this.getSettings = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'get_settings', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'get_settings', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory GetSettingsRequest.fromJson(Map json) => diff --git a/lib/basic_api/generated/landing_company_details_send.dart b/lib/basic_api/generated/landing_company_details_send.dart index ad8785a79c..32f70337f5 100644 --- a/lib/basic_api/generated/landing_company_details_send.dart +++ b/lib/basic_api/generated/landing_company_details_send.dart @@ -8,29 +8,32 @@ import '../request.dart'; class LandingCompanyDetailsRequest extends Request { /// Initialize LandingCompanyDetailsRequest. const LandingCompanyDetailsRequest({ + this.country, required this.landingCompanyDetails, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'landing_company_details', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'landing_company_details', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory LandingCompanyDetailsRequest.fromJson(Map json) => LandingCompanyDetailsRequest( + country: json['country'] as String?, landingCompanyDetails: json['landing_company_details'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); + /// [Optional] Will return an extra field `tin_not_mandatory` indicating if the landing company does not require tax identification number for the provided country. + final String? country; + /// Landing company shortcode. final String? landingCompanyDetails; /// Converts this instance to JSON @override Map toJson() => { + 'country': country, 'landing_company_details': landingCompanyDetails, 'passthrough': passthrough, 'req_id': reqId, @@ -39,11 +42,13 @@ class LandingCompanyDetailsRequest extends Request { /// Creates a copy of instance with given parameters @override LandingCompanyDetailsRequest copyWith({ + String? country, String? landingCompanyDetails, Map? passthrough, int? reqId, }) => LandingCompanyDetailsRequest( + country: country ?? this.country, landingCompanyDetails: landingCompanyDetails ?? this.landingCompanyDetails, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/landing_company_send.dart b/lib/basic_api/generated/landing_company_send.dart index daf7f217f6..df52cef8b9 100644 --- a/lib/basic_api/generated/landing_company_send.dart +++ b/lib/basic_api/generated/landing_company_send.dart @@ -9,13 +9,10 @@ class LandingCompanyRequest extends Request { /// Initialize LandingCompanyRequest. const LandingCompanyRequest({ required this.landingCompany, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'landing_company', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'landing_company', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory LandingCompanyRequest.fromJson(Map json) => diff --git a/lib/basic_api/generated/link_wallet_receive.dart b/lib/basic_api/generated/link_wallet_receive.dart index c811464302..ecdb3c82c9 100644 --- a/lib/basic_api/generated/link_wallet_receive.dart +++ b/lib/basic_api/generated/link_wallet_receive.dart @@ -9,16 +9,11 @@ class LinkWalletReceive extends Response { /// Initialize LinkWalletReceive. const LinkWalletReceive({ this.linkWallet, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory LinkWalletReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/link_wallet_send.dart b/lib/basic_api/generated/link_wallet_send.dart index 5a188dedca..295ac456e9 100644 --- a/lib/basic_api/generated/link_wallet_send.dart +++ b/lib/basic_api/generated/link_wallet_send.dart @@ -11,13 +11,10 @@ class LinkWalletRequest extends Request { required this.clientId, this.linkWallet = true, required this.walletId, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'link_wallet', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'link_wallet', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory LinkWalletRequest.fromJson(Map json) => diff --git a/lib/basic_api/generated/methods/trading_platform_asset_listing_receive_methods.json b/lib/basic_api/generated/methods/trading_platform_asset_listing_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/trading_platform_asset_listing_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/methods/wallet_migration_receive_methods.json b/lib/basic_api/generated/methods/wallet_migration_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/wallet_migration_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/mt5_new_account_receive.dart b/lib/basic_api/generated/mt5_new_account_receive.dart index 1a035485f0..8a081d4e7d 100644 --- a/lib/basic_api/generated/mt5_new_account_receive.dart +++ b/lib/basic_api/generated/mt5_new_account_receive.dart @@ -9,16 +9,11 @@ class Mt5NewAccountReceive extends Response { /// Initialize Mt5NewAccountReceive. const Mt5NewAccountReceive({ this.mt5NewAccount, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory Mt5NewAccountReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/mt5_new_account_send.dart b/lib/basic_api/generated/mt5_new_account_send.dart index ada5e003fe..cf50ed0c55 100644 --- a/lib/basic_api/generated/mt5_new_account_send.dart +++ b/lib/basic_api/generated/mt5_new_account_send.dart @@ -27,14 +27,12 @@ class Mt5NewAccountRequest extends Request { this.phonePassword, this.server, this.state, + this.subAccountCategory, this.zipCode, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'mt5_new_account', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'mt5_new_account', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory Mt5NewAccountRequest.fromJson(Map json) => @@ -60,6 +58,7 @@ class Mt5NewAccountRequest extends Request { phonePassword: json['phonePassword'] as String?, server: json['server'] as String?, state: json['state'] as String?, + subAccountCategory: json['sub_account_category'] as String?, zipCode: json['zipCode'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, @@ -98,7 +97,7 @@ class Mt5NewAccountRequest extends Request { /// The master password of the account. For validation (Accepts any printable ASCII character. Must be within 8-25 characters, and include numbers, lowercase and uppercase letters. Must not be the same as the user's email address). This field is required. final String? mainPassword; - /// [Optional] To choose whether account is conventional or not. Unavailable for financial_stp MT5_account_type + /// [Optional] To choose whether account is conventional or swap_free. Unavailable for financial_stp MT5_account_type final String? mt5AccountCategory; /// [Optional] Financial: Variable spreads, High leverage. Financial STP: Variable spreads, Medium Leverage, more products. If 'account_type' set to 'financial', setting 'mt5_account_type' is also required. @@ -122,6 +121,9 @@ class Mt5NewAccountRequest extends Request { /// [Optional] User's state (region) of residence. final String? state; + /// [Optional] Indicate the sub account category that we have in the cfd group naming convention. + final String? subAccountCategory; + /// [Optional] User's zip code. final String? zipCode; @@ -155,6 +157,7 @@ class Mt5NewAccountRequest extends Request { 'phonePassword': phonePassword, 'server': server, 'state': state, + 'sub_account_category': subAccountCategory, 'zipCode': zipCode, 'passthrough': passthrough, 'req_id': reqId, @@ -182,6 +185,7 @@ class Mt5NewAccountRequest extends Request { String? phonePassword, String? server, String? state, + String? subAccountCategory, String? zipCode, Map? passthrough, int? reqId, @@ -206,6 +210,7 @@ class Mt5NewAccountRequest extends Request { phonePassword: phonePassword ?? this.phonePassword, server: server ?? this.server, state: state ?? this.state, + subAccountCategory: subAccountCategory ?? this.subAccountCategory, zipCode: zipCode ?? this.zipCode, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/mt5_password_change_receive.dart b/lib/basic_api/generated/mt5_password_change_receive.dart index 7aaeed5bf5..20e1a5209e 100644 --- a/lib/basic_api/generated/mt5_password_change_receive.dart +++ b/lib/basic_api/generated/mt5_password_change_receive.dart @@ -9,16 +9,11 @@ class Mt5PasswordChangeReceive extends Response { /// Initialize Mt5PasswordChangeReceive. const Mt5PasswordChangeReceive({ this.mt5PasswordChange, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory Mt5PasswordChangeReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/new_account_maltainvest_send.dart b/lib/basic_api/generated/new_account_maltainvest_send.dart index 4ba6436f32..5a3d3b65da 100644 --- a/lib/basic_api/generated/new_account_maltainvest_send.dart +++ b/lib/basic_api/generated/new_account_maltainvest_send.dart @@ -17,45 +17,44 @@ class NewAccountMaltainvestRequest extends Request { this.addressPostcode, this.addressState, this.affiliateToken, - this.binaryOptionsTradingExperience, - this.binaryOptionsTradingFrequency, - this.cfdTradingExperience, - this.cfdTradingFrequency, + required this.cfdExperience, + required this.cfdFrequency, + required this.cfdTradingDefinition, this.citizen, this.clientType, this.currency, required this.dateOfBirth, required this.educationLevel, required this.employmentIndustry, - this.employmentStatus, + required this.employmentStatus, required this.estimatedWorth, required this.firstName, - this.forexTradingExperience, - this.forexTradingFrequency, required this.incomeSource, required this.lastName, + required this.leverageImpactTrading, + required this.leverageTradingHighRiskStopLoss, required this.netIncome, this.newAccountMaltainvest = true, this.nonPepDeclaration, required this.occupation, - this.otherInstrumentsTradingExperience, - this.otherInstrumentsTradingFrequency, this.phone, this.placeOfBirth, + required this.requiredInitialMargin, required this.residence, + required this.riskTolerance, required this.salutation, this.secretAnswer, this.secretQuestion, + required this.sourceOfExperience, this.sourceOfWealth, required this.taxIdentificationNumber, required this.taxResidence, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'new_account_maltainvest', - passthrough: passthrough, - reqId: reqId, - ); + required this.tradingExperienceFinancialInstruments, + required this.tradingFrequencyFinancialInstruments, + super.msgType = 'new_account_maltainvest', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory NewAccountMaltainvestRequest.fromJson(Map json) => @@ -70,12 +69,9 @@ class NewAccountMaltainvestRequest extends Request { addressPostcode: json['address_postcode'] as String?, addressState: json['address_state'] as String?, affiliateToken: json['affiliate_token'] as String?, - binaryOptionsTradingExperience: - json['binary_options_trading_experience'] as String?, - binaryOptionsTradingFrequency: - json['binary_options_trading_frequency'] as String?, - cfdTradingExperience: json['cfd_trading_experience'] as String?, - cfdTradingFrequency: json['cfd_trading_frequency'] as String?, + cfdExperience: json['cfd_experience'] as String?, + cfdFrequency: json['cfd_frequency'] as String?, + cfdTradingDefinition: json['cfd_trading_definition'] as String?, citizen: json['citizen'] as String?, clientType: json['client_type'] as String?, currency: json['currency'] as String?, @@ -85,29 +81,33 @@ class NewAccountMaltainvestRequest extends Request { employmentStatus: json['employment_status'] as String?, estimatedWorth: json['estimated_worth'] as String?, firstName: json['first_name'] as String?, - forexTradingExperience: json['forex_trading_experience'] as String?, - forexTradingFrequency: json['forex_trading_frequency'] as String?, incomeSource: json['income_source'] as String?, lastName: json['last_name'] as String?, + leverageImpactTrading: json['leverage_impact_trading'] as String?, + leverageTradingHighRiskStopLoss: + json['leverage_trading_high_risk_stop_loss'] as String?, netIncome: json['net_income'] as String?, newAccountMaltainvest: json['new_account_maltainvest'] == null ? null : json['new_account_maltainvest'] == 1, nonPepDeclaration: json['non_pep_declaration'] as int?, occupation: json['occupation'] as String?, - otherInstrumentsTradingExperience: - json['other_instruments_trading_experience'] as String?, - otherInstrumentsTradingFrequency: - json['other_instruments_trading_frequency'] as String?, phone: json['phone'] as String?, placeOfBirth: json['place_of_birth'] as String?, + requiredInitialMargin: json['required_initial_margin'] as String?, residence: json['residence'] as String?, + riskTolerance: json['risk_tolerance'] as String?, salutation: json['salutation'] as String?, secretAnswer: json['secret_answer'] as String?, secretQuestion: json['secret_question'] as String?, + sourceOfExperience: json['source_of_experience'] as String?, sourceOfWealth: json['source_of_wealth'] as String?, taxIdentificationNumber: json['tax_identification_number'] as String?, taxResidence: json['tax_residence'] as String?, + tradingExperienceFinancialInstruments: + json['trading_experience_financial_instruments'] as String?, + tradingFrequencyFinancialInstruments: + json['trading_frequency_financial_instruments'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -139,17 +139,14 @@ class NewAccountMaltainvestRequest extends Request { /// [Optional] Affiliate token, within 32 characters. final String? affiliateToken; - /// [Optional] Binary options trading experience. - final String? binaryOptionsTradingExperience; + /// How much experience do you have in CFD trading? + final String? cfdExperience; - /// [Optional] Binary options trading frequency. - final String? binaryOptionsTradingFrequency; + /// How many CFD trades have you placed in the past 12 months? + final String? cfdFrequency; - /// [Optional] CFDs trading experience. - final String? cfdTradingExperience; - - /// [Optional] CFDs trading frequency. - final String? cfdTradingFrequency; + /// In your understanding, CFD trading allows you to: + final String? cfdTradingDefinition; /// [Optional] Country of legal citizenship, 2-letter country code. Possible value receive from `residence_list` call. final String? citizen; @@ -169,7 +166,7 @@ class NewAccountMaltainvestRequest extends Request { /// Industry of Employment. final String? employmentIndustry; - /// [Optional] Employment Status. + /// Employment Status. final String? employmentStatus; /// Estimated Net Worth. @@ -178,18 +175,18 @@ class NewAccountMaltainvestRequest extends Request { /// Within 2-50 characters, use only letters, spaces, hyphens, full-stops or apostrophes. final String? firstName; - /// [Optional] Forex trading experience. - final String? forexTradingExperience; - - /// [Optional] Forex trading frequency. - final String? forexTradingFrequency; - /// Income Source. final String? incomeSource; /// Within 2-50 characters, use only letters, spaces, hyphens, full-stops or apostrophes. final String? lastName; + /// How does leverage affect CFD trading? + final String? leverageImpactTrading; + + /// Leverage trading is high-risk, so it's a good idea to use risk management features such as stop loss. Stop loss allows you to + final String? leverageTradingHighRiskStopLoss; + /// Net Annual Income. final String? netIncome; @@ -202,21 +199,21 @@ class NewAccountMaltainvestRequest extends Request { /// Occupation. final String? occupation; - /// [Optional] Trading experience in other financial instruments. - final String? otherInstrumentsTradingExperience; - - /// [Optional] Trading frequency in other financial instruments. - final String? otherInstrumentsTradingFrequency; - /// [Optional] Starting with `+` followed by 9-35 digits, hyphens or space. final String? phone; /// [Optional] Place of birth, 2-letter country code. final String? placeOfBirth; + /// When would you be required to pay an initial margin? + final String? requiredInitialMargin; + /// 2-letter country code, possible value receive from `residence_list` call. final String? residence; + /// Do you understand that you could potentially lose 100% of the money you use to trade? + final String? riskTolerance; + /// Accept any value in enum list. final String? salutation; @@ -226,6 +223,9 @@ class NewAccountMaltainvestRequest extends Request { /// [Optional] Accept any value in enum list. final String? secretQuestion; + /// How much knowledge and experience do you have in relation to online trading? + final String? sourceOfExperience; + /// [Optional] Source of wealth. final String? sourceOfWealth; @@ -235,6 +235,12 @@ class NewAccountMaltainvestRequest extends Request { /// Residence for tax purpose. Comma separated iso country code if multiple jurisdictions. Only applicable for real money account. Required for `maltainvest` landing company. final String? taxResidence; + /// How much experience do you have with other financial instruments? + final String? tradingExperienceFinancialInstruments; + + /// How many trades have you placed with other financial instruments in the past 12 months? + final String? tradingFrequencyFinancialInstruments; + /// Converts this instance to JSON @override Map toJson() => { @@ -251,10 +257,9 @@ class NewAccountMaltainvestRequest extends Request { 'address_postcode': addressPostcode, 'address_state': addressState, 'affiliate_token': affiliateToken, - 'binary_options_trading_experience': binaryOptionsTradingExperience, - 'binary_options_trading_frequency': binaryOptionsTradingFrequency, - 'cfd_trading_experience': cfdTradingExperience, - 'cfd_trading_frequency': cfdTradingFrequency, + 'cfd_experience': cfdExperience, + 'cfd_frequency': cfdFrequency, + 'cfd_trading_definition': cfdTradingDefinition, 'citizen': citizen, 'client_type': clientType, 'currency': currency, @@ -264,10 +269,10 @@ class NewAccountMaltainvestRequest extends Request { 'employment_status': employmentStatus, 'estimated_worth': estimatedWorth, 'first_name': firstName, - 'forex_trading_experience': forexTradingExperience, - 'forex_trading_frequency': forexTradingFrequency, 'income_source': incomeSource, 'last_name': lastName, + 'leverage_impact_trading': leverageImpactTrading, + 'leverage_trading_high_risk_stop_loss': leverageTradingHighRiskStopLoss, 'net_income': netIncome, 'new_account_maltainvest': newAccountMaltainvest == null ? null @@ -276,18 +281,22 @@ class NewAccountMaltainvestRequest extends Request { : 0, 'non_pep_declaration': nonPepDeclaration, 'occupation': occupation, - 'other_instruments_trading_experience': - otherInstrumentsTradingExperience, - 'other_instruments_trading_frequency': otherInstrumentsTradingFrequency, 'phone': phone, 'place_of_birth': placeOfBirth, + 'required_initial_margin': requiredInitialMargin, 'residence': residence, + 'risk_tolerance': riskTolerance, 'salutation': salutation, 'secret_answer': secretAnswer, 'secret_question': secretQuestion, + 'source_of_experience': sourceOfExperience, 'source_of_wealth': sourceOfWealth, 'tax_identification_number': taxIdentificationNumber, 'tax_residence': taxResidence, + 'trading_experience_financial_instruments': + tradingExperienceFinancialInstruments, + 'trading_frequency_financial_instruments': + tradingFrequencyFinancialInstruments, 'passthrough': passthrough, 'req_id': reqId, }; @@ -304,10 +313,9 @@ class NewAccountMaltainvestRequest extends Request { String? addressPostcode, String? addressState, String? affiliateToken, - String? binaryOptionsTradingExperience, - String? binaryOptionsTradingFrequency, - String? cfdTradingExperience, - String? cfdTradingFrequency, + String? cfdExperience, + String? cfdFrequency, + String? cfdTradingDefinition, String? citizen, String? clientType, String? currency, @@ -317,25 +325,28 @@ class NewAccountMaltainvestRequest extends Request { String? employmentStatus, String? estimatedWorth, String? firstName, - String? forexTradingExperience, - String? forexTradingFrequency, String? incomeSource, String? lastName, + String? leverageImpactTrading, + String? leverageTradingHighRiskStopLoss, String? netIncome, bool? newAccountMaltainvest, int? nonPepDeclaration, String? occupation, - String? otherInstrumentsTradingExperience, - String? otherInstrumentsTradingFrequency, String? phone, String? placeOfBirth, + String? requiredInitialMargin, String? residence, + String? riskTolerance, String? salutation, String? secretAnswer, String? secretQuestion, + String? sourceOfExperience, String? sourceOfWealth, String? taxIdentificationNumber, String? taxResidence, + String? tradingExperienceFinancialInstruments, + String? tradingFrequencyFinancialInstruments, Map? passthrough, int? reqId, }) => @@ -349,12 +360,9 @@ class NewAccountMaltainvestRequest extends Request { addressPostcode: addressPostcode ?? this.addressPostcode, addressState: addressState ?? this.addressState, affiliateToken: affiliateToken ?? this.affiliateToken, - binaryOptionsTradingExperience: binaryOptionsTradingExperience ?? - this.binaryOptionsTradingExperience, - binaryOptionsTradingFrequency: - binaryOptionsTradingFrequency ?? this.binaryOptionsTradingFrequency, - cfdTradingExperience: cfdTradingExperience ?? this.cfdTradingExperience, - cfdTradingFrequency: cfdTradingFrequency ?? this.cfdTradingFrequency, + cfdExperience: cfdExperience ?? this.cfdExperience, + cfdFrequency: cfdFrequency ?? this.cfdFrequency, + cfdTradingDefinition: cfdTradingDefinition ?? this.cfdTradingDefinition, citizen: citizen ?? this.citizen, clientType: clientType ?? this.clientType, currency: currency ?? this.currency, @@ -364,31 +372,37 @@ class NewAccountMaltainvestRequest extends Request { employmentStatus: employmentStatus ?? this.employmentStatus, estimatedWorth: estimatedWorth ?? this.estimatedWorth, firstName: firstName ?? this.firstName, - forexTradingExperience: - forexTradingExperience ?? this.forexTradingExperience, - forexTradingFrequency: - forexTradingFrequency ?? this.forexTradingFrequency, incomeSource: incomeSource ?? this.incomeSource, lastName: lastName ?? this.lastName, + leverageImpactTrading: + leverageImpactTrading ?? this.leverageImpactTrading, + leverageTradingHighRiskStopLoss: leverageTradingHighRiskStopLoss ?? + this.leverageTradingHighRiskStopLoss, netIncome: netIncome ?? this.netIncome, newAccountMaltainvest: newAccountMaltainvest ?? this.newAccountMaltainvest, nonPepDeclaration: nonPepDeclaration ?? this.nonPepDeclaration, occupation: occupation ?? this.occupation, - otherInstrumentsTradingExperience: otherInstrumentsTradingExperience ?? - this.otherInstrumentsTradingExperience, - otherInstrumentsTradingFrequency: otherInstrumentsTradingFrequency ?? - this.otherInstrumentsTradingFrequency, phone: phone ?? this.phone, placeOfBirth: placeOfBirth ?? this.placeOfBirth, + requiredInitialMargin: + requiredInitialMargin ?? this.requiredInitialMargin, residence: residence ?? this.residence, + riskTolerance: riskTolerance ?? this.riskTolerance, salutation: salutation ?? this.salutation, secretAnswer: secretAnswer ?? this.secretAnswer, secretQuestion: secretQuestion ?? this.secretQuestion, + sourceOfExperience: sourceOfExperience ?? this.sourceOfExperience, sourceOfWealth: sourceOfWealth ?? this.sourceOfWealth, taxIdentificationNumber: taxIdentificationNumber ?? this.taxIdentificationNumber, taxResidence: taxResidence ?? this.taxResidence, + tradingExperienceFinancialInstruments: + tradingExperienceFinancialInstruments ?? + this.tradingExperienceFinancialInstruments, + tradingFrequencyFinancialInstruments: + tradingFrequencyFinancialInstruments ?? + this.tradingFrequencyFinancialInstruments, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/new_account_real_receive.dart b/lib/basic_api/generated/new_account_real_receive.dart index 17b42b70c8..d45426248e 100644 --- a/lib/basic_api/generated/new_account_real_receive.dart +++ b/lib/basic_api/generated/new_account_real_receive.dart @@ -9,16 +9,11 @@ class NewAccountRealReceive extends Response { /// Initialize NewAccountRealReceive. const NewAccountRealReceive({ this.newAccountReal, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory NewAccountRealReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/new_account_real_send.dart b/lib/basic_api/generated/new_account_real_send.dart index b5a3907a2f..80dd7ac8f6 100644 --- a/lib/basic_api/generated/new_account_real_send.dart +++ b/lib/basic_api/generated/new_account_real_send.dart @@ -11,7 +11,7 @@ class NewAccountRealRequest extends Request { this.accountOpeningReason, this.accountTurnover, this.addressCity, - required this.addressLine1, + this.addressLine1, this.addressLine2, this.addressPostcode, this.addressState, @@ -19,26 +19,23 @@ class NewAccountRealRequest extends Request { this.citizen, this.clientType, this.currency, - required this.dateOfBirth, - required this.firstName, - required this.lastName, + this.dateOfBirth, + this.firstName, + this.lastName, this.newAccountReal = true, this.nonPepDeclaration, this.phone, this.placeOfBirth, - required this.residence, + this.residence, this.salutation, this.secretAnswer, this.secretQuestion, this.taxIdentificationNumber, this.taxResidence, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'new_account_real', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'new_account_real', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory NewAccountRealRequest.fromJson(Map json) => diff --git a/lib/basic_api/generated/new_account_virtual_receive.dart b/lib/basic_api/generated/new_account_virtual_receive.dart index 9edd1cb4f3..6ea7ffd2c5 100644 --- a/lib/basic_api/generated/new_account_virtual_receive.dart +++ b/lib/basic_api/generated/new_account_virtual_receive.dart @@ -9,16 +9,11 @@ class NewAccountVirtualReceive extends Response { /// Initialize NewAccountVirtualReceive. const NewAccountVirtualReceive({ this.newAccountVirtual, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory NewAccountVirtualReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/new_account_virtual_send.dart b/lib/basic_api/generated/new_account_virtual_send.dart index fa783d27a5..3a54d5c1bb 100644 --- a/lib/basic_api/generated/new_account_virtual_send.dart +++ b/lib/basic_api/generated/new_account_virtual_send.dart @@ -30,13 +30,10 @@ class NewAccountVirtualRequest extends Request { this.utmSource, this.utmTerm, required this.verificationCode, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'new_account_virtual', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'new_account_virtual', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory NewAccountVirtualRequest.fromJson(Map json) => diff --git a/lib/basic_api/generated/new_account_wallet_receive.dart b/lib/basic_api/generated/new_account_wallet_receive.dart index 1e85f91e99..2bc0d8a35d 100644 --- a/lib/basic_api/generated/new_account_wallet_receive.dart +++ b/lib/basic_api/generated/new_account_wallet_receive.dart @@ -9,16 +9,11 @@ class NewAccountWalletReceive extends Response { /// Initialize NewAccountWalletReceive. const NewAccountWalletReceive({ this.newAccountWallet, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory NewAccountWalletReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/new_account_wallet_send.dart b/lib/basic_api/generated/new_account_wallet_send.dart index c900792269..d252ab36cb 100644 --- a/lib/basic_api/generated/new_account_wallet_send.dart +++ b/lib/basic_api/generated/new_account_wallet_send.dart @@ -8,49 +8,75 @@ import '../request.dart'; class NewAccountWalletRequest extends Request { /// Initialize NewAccountWalletRequest. const NewAccountWalletRequest({ + this.acceptRisk, + this.accountOpeningReason, + required this.accountType, this.addressCity, this.addressLine1, this.addressLine2, this.addressPostcode, this.addressState, + this.citizen, + this.clientType, required this.currency, this.dateOfBirth, + this.financialAssessment, this.firstName, + this.landingCompanyShort, this.lastName, this.newAccountWallet = true, this.nonPepDeclaration, - required this.paymentMethod, this.phone, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'new_account_wallet', - passthrough: passthrough, - reqId: reqId, - ); + this.salutation, + this.taxIdentificationNumber, + this.taxResidence, + super.msgType = 'new_account_wallet', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory NewAccountWalletRequest.fromJson(Map json) => NewAccountWalletRequest( + acceptRisk: + json['accept_risk'] == null ? null : json['accept_risk'] == 1, + accountOpeningReason: json['account_opening_reason'] as String?, + accountType: json['account_type'] as String?, addressCity: json['address_city'] as String?, addressLine1: json['address_line_1'] as String?, addressLine2: json['address_line_2'] as String?, addressPostcode: json['address_postcode'] as String?, addressState: json['address_state'] as String?, + citizen: json['citizen'] as String?, + clientType: json['client_type'] as String?, currency: json['currency'] as String?, dateOfBirth: json['date_of_birth'] as String?, + financialAssessment: + json['financial_assessment'] as Map?, firstName: json['first_name'] as String?, + landingCompanyShort: json['landing_company_short'] as String?, lastName: json['last_name'] as String?, newAccountWallet: json['new_account_wallet'] == null ? null : json['new_account_wallet'] == 1, nonPepDeclaration: json['non_pep_declaration'] as int?, - paymentMethod: json['payment_method'] as String?, phone: json['phone'] as String?, + salutation: json['salutation'] as String?, + taxIdentificationNumber: json['tax_identification_number'] as String?, + taxResidence: json['tax_residence'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); + /// Show whether client has accepted risk disclaimer. + final bool? acceptRisk; + + /// [Optional] Purpose and reason for requesting the account opening. + final String? accountOpeningReason; + + /// To set the wallets type - only doughflow and crptyo wallets are allowed for initial phase, other types will be added later + final String? accountType; + /// [Optional] Within 35 characters. final String? addressCity; @@ -66,15 +92,27 @@ class NewAccountWalletRequest extends Request { /// [Optional] Possible value receive from `states_list` call. final String? addressState; + /// [Optional] Country of legal citizenship, 2-letter country code. Possible value receive from `residence_list` call. + final String? citizen; + + /// [Optional] Indicates whether this is for a client requesting an account with professional status. + final String? clientType; + /// To set currency of the account. List of supported currencies can be acquired with `payout_currencies` call. final String? currency; /// [Optional] Date of birth format: `yyyy-mm-dd`. final String? dateOfBirth; + /// Required for maltainvest + final Map? financialAssessment; + /// [Optional] Within 2-50 characters, use only letters, spaces, hyphens, full-stops or apostrophes. final String? firstName; + /// [Optional] Set the landing company of the wallet. Default value is 'svg' if company not provided + final String? landingCompanyShort; + /// [Optional] Within 2-50 characters, use only letters, spaces, hyphens, full-stops or apostrophes. final String? lastName; @@ -84,23 +122,40 @@ class NewAccountWalletRequest extends Request { /// [Optional] Indicates client's self-declaration of not being a PEP/RCA (Politically Exposed Person/Relatives and Close Associates). final int? nonPepDeclaration; - /// To set method which is used to transfer to/from wallet. - final String? paymentMethod; - /// [Optional] Starting with `+` followed by 8-35 digits, allowing hyphens or space. final String? phone; + /// Accept any value in enum list. + final String? salutation; + + /// Tax identification number. Only applicable for real money account. Required for `maltainvest` landing company. + final String? taxIdentificationNumber; + + /// Residence for tax purpose. Comma separated iso country code if multiple jurisdictions. Only applicable for real money account. Required for `maltainvest` landing company. + final String? taxResidence; + /// Converts this instance to JSON @override Map toJson() => { + 'accept_risk': acceptRisk == null + ? null + : acceptRisk! + ? 1 + : 0, + 'account_opening_reason': accountOpeningReason, + 'account_type': accountType, 'address_city': addressCity, 'address_line_1': addressLine1, 'address_line_2': addressLine2, 'address_postcode': addressPostcode, 'address_state': addressState, + 'citizen': citizen, + 'client_type': clientType, 'currency': currency, 'date_of_birth': dateOfBirth, + 'financial_assessment': financialAssessment, 'first_name': firstName, + 'landing_company_short': landingCompanyShort, 'last_name': lastName, 'new_account_wallet': newAccountWallet == null ? null @@ -108,8 +163,10 @@ class NewAccountWalletRequest extends Request { ? 1 : 0, 'non_pep_declaration': nonPepDeclaration, - 'payment_method': paymentMethod, 'phone': phone, + 'salutation': salutation, + 'tax_identification_number': taxIdentificationNumber, + 'tax_residence': taxResidence, 'passthrough': passthrough, 'req_id': reqId, }; @@ -117,36 +174,55 @@ class NewAccountWalletRequest extends Request { /// Creates a copy of instance with given parameters @override NewAccountWalletRequest copyWith({ + bool? acceptRisk, + String? accountOpeningReason, + String? accountType, String? addressCity, String? addressLine1, String? addressLine2, String? addressPostcode, String? addressState, + String? citizen, + String? clientType, String? currency, String? dateOfBirth, + Map? financialAssessment, String? firstName, + String? landingCompanyShort, String? lastName, bool? newAccountWallet, int? nonPepDeclaration, - String? paymentMethod, String? phone, + String? salutation, + String? taxIdentificationNumber, + String? taxResidence, Map? passthrough, int? reqId, }) => NewAccountWalletRequest( + acceptRisk: acceptRisk ?? this.acceptRisk, + accountOpeningReason: accountOpeningReason ?? this.accountOpeningReason, + accountType: accountType ?? this.accountType, addressCity: addressCity ?? this.addressCity, addressLine1: addressLine1 ?? this.addressLine1, addressLine2: addressLine2 ?? this.addressLine2, addressPostcode: addressPostcode ?? this.addressPostcode, addressState: addressState ?? this.addressState, + citizen: citizen ?? this.citizen, + clientType: clientType ?? this.clientType, currency: currency ?? this.currency, dateOfBirth: dateOfBirth ?? this.dateOfBirth, + financialAssessment: financialAssessment ?? this.financialAssessment, firstName: firstName ?? this.firstName, + landingCompanyShort: landingCompanyShort ?? this.landingCompanyShort, lastName: lastName ?? this.lastName, newAccountWallet: newAccountWallet ?? this.newAccountWallet, nonPepDeclaration: nonPepDeclaration ?? this.nonPepDeclaration, - paymentMethod: paymentMethod ?? this.paymentMethod, phone: phone ?? this.phone, + salutation: salutation ?? this.salutation, + taxIdentificationNumber: + taxIdentificationNumber ?? this.taxIdentificationNumber, + taxResidence: taxResidence ?? this.taxResidence, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/profit_table_send.dart b/lib/basic_api/generated/profit_table_send.dart index fca57bf712..320c128fde 100644 --- a/lib/basic_api/generated/profit_table_send.dart +++ b/lib/basic_api/generated/profit_table_send.dart @@ -16,13 +16,10 @@ class ProfitTableRequest extends Request { this.offset, this.profitTable = true, this.sort, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'profit_table', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'profit_table', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory ProfitTableRequest.fromJson(Map json) => @@ -35,7 +32,7 @@ class ProfitTableRequest extends Request { description: json['description'] == null ? null : json['description'] == 1, limit: json['limit'] as num?, - offset: json['offset'] as num?, + offset: json['offset'] as int?, profitTable: json['profit_table'] == null ? null : json['profit_table'] == 1, sort: json['sort'] as String?, @@ -59,7 +56,7 @@ class ProfitTableRequest extends Request { final num? limit; /// [Optional] Number of transactions to skip. - final num? offset; + final int? offset; /// Must be `true` final bool? profitTable; @@ -98,7 +95,7 @@ class ProfitTableRequest extends Request { String? dateTo, bool? description, num? limit, - num? offset, + int? offset, bool? profitTable, String? sort, Map? passthrough, diff --git a/lib/basic_api/generated/set_settings_receive.dart b/lib/basic_api/generated/set_settings_receive.dart index 7b939e22c4..4cb252c9ad 100644 --- a/lib/basic_api/generated/set_settings_receive.dart +++ b/lib/basic_api/generated/set_settings_receive.dart @@ -9,16 +9,11 @@ class SetSettingsReceive extends Response { /// Initialize SetSettingsReceive. const SetSettingsReceive({ this.setSettings, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory SetSettingsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/set_settings_send.dart b/lib/basic_api/generated/set_settings_send.dart index 443e116b46..80a8e2fad9 100644 --- a/lib/basic_api/generated/set_settings_send.dart +++ b/lib/basic_api/generated/set_settings_send.dart @@ -17,7 +17,9 @@ class SetSettingsRequest extends Request { this.allowCopiers, this.citizen, this.dateOfBirth, + this.dxtradeUserException, this.emailConsent, + this.employmentStatus, this.featureFlag, this.firstName, this.lastName, @@ -34,13 +36,10 @@ class SetSettingsRequest extends Request { this.taxIdentificationNumber, this.taxResidence, this.tradingHub, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'set_settings', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'set_settings', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory SetSettingsRequest.fromJson(Map json) => @@ -55,8 +54,12 @@ class SetSettingsRequest extends Request { json['allow_copiers'] == null ? null : json['allow_copiers'] == 1, citizen: json['citizen'] as String?, dateOfBirth: json['date_of_birth'] as String?, + dxtradeUserException: json['dxtrade_user_exception'] == null + ? null + : json['dxtrade_user_exception'] == 1, emailConsent: json['email_consent'] == null ? null : json['email_consent'] == 1, + employmentStatus: json['employment_status'] as String?, featureFlag: json['feature_flag'] as Map?, firstName: json['first_name'] as String?, lastName: json['last_name'] as String?, @@ -106,9 +109,15 @@ class SetSettingsRequest extends Request { /// [Optional] Date of birth format: yyyy-mm-dd (can only be changed on unauthenticated svg accounts). final String? dateOfBirth; + /// Boolean value `true` or `false`, indicating if user email belong to dxtrade exception list. + final bool? dxtradeUserException; + /// [Optional] Boolean value `true` or `false`, indicating permission to use email address for any contact which may include marketing final bool? emailConsent; + /// [Optional] Employment Status. + final String? employmentStatus; + /// [Optional] Enable or disable one or multiple features. final Map? featureFlag; @@ -173,11 +182,17 @@ class SetSettingsRequest extends Request { : 0, 'citizen': citizen, 'date_of_birth': dateOfBirth, + 'dxtrade_user_exception': dxtradeUserException == null + ? null + : dxtradeUserException! + ? 1 + : 0, 'email_consent': emailConsent == null ? null : emailConsent! ? 1 : 0, + 'employment_status': employmentStatus, 'feature_flag': featureFlag, 'first_name': firstName, 'last_name': lastName, @@ -218,7 +233,9 @@ class SetSettingsRequest extends Request { bool? allowCopiers, String? citizen, String? dateOfBirth, + bool? dxtradeUserException, bool? emailConsent, + String? employmentStatus, Map? featureFlag, String? firstName, String? lastName, @@ -248,7 +265,9 @@ class SetSettingsRequest extends Request { allowCopiers: allowCopiers ?? this.allowCopiers, citizen: citizen ?? this.citizen, dateOfBirth: dateOfBirth ?? this.dateOfBirth, + dxtradeUserException: dxtradeUserException ?? this.dxtradeUserException, emailConsent: emailConsent ?? this.emailConsent, + employmentStatus: employmentStatus ?? this.employmentStatus, featureFlag: featureFlag ?? this.featureFlag, firstName: firstName ?? this.firstName, lastName: lastName ?? this.lastName, diff --git a/lib/basic_api/generated/statement_receive.dart b/lib/basic_api/generated/statement_receive.dart index 27cc65f1ea..6dffaab987 100644 --- a/lib/basic_api/generated/statement_receive.dart +++ b/lib/basic_api/generated/statement_receive.dart @@ -9,16 +9,11 @@ class StatementReceive extends Response { /// Initialize StatementReceive. const StatementReceive({ this.statement, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory StatementReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/statement_send.dart b/lib/basic_api/generated/statement_send.dart index c721380ae6..55b84bbef6 100644 --- a/lib/basic_api/generated/statement_send.dart +++ b/lib/basic_api/generated/statement_send.dart @@ -15,13 +15,10 @@ class StatementRequest extends Request { this.limit, this.offset, this.statement = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'statement', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'statement', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory StatementRequest.fromJson(Map json) => @@ -32,7 +29,7 @@ class StatementRequest extends Request { description: json['description'] == null ? null : json['description'] == 1, limit: json['limit'] as num?, - offset: json['offset'] as num?, + offset: json['offset'] as int?, statement: json['statement'] == null ? null : json['statement'] == 1, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, @@ -54,7 +51,7 @@ class StatementRequest extends Request { final num? limit; /// [Optional] Number of transactions to skip. - final num? offset; + final int? offset; /// Must be `true` final bool? statement; @@ -89,7 +86,7 @@ class StatementRequest extends Request { int? dateTo, bool? description, num? limit, - num? offset, + int? offset, bool? statement, Map? passthrough, int? reqId, diff --git a/lib/basic_api/generated/trading_durations_receive.dart b/lib/basic_api/generated/trading_durations_receive.dart index 68ce77835d..eed0afb069 100644 --- a/lib/basic_api/generated/trading_durations_receive.dart +++ b/lib/basic_api/generated/trading_durations_receive.dart @@ -9,16 +9,11 @@ class TradingDurationsReceive extends Response { /// Initialize TradingDurationsReceive. const TradingDurationsReceive({ this.tradingDurations, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TradingDurationsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/trading_durations_send.dart b/lib/basic_api/generated/trading_durations_send.dart index bd9d6d5fb3..2d6fe41186 100644 --- a/lib/basic_api/generated/trading_durations_send.dart +++ b/lib/basic_api/generated/trading_durations_send.dart @@ -8,20 +8,19 @@ import '../request.dart'; class TradingDurationsRequest extends Request { /// Initialize TradingDurationsRequest. const TradingDurationsRequest({ - this.landingCompany, + required this.landingCompany, + this.landingCompanyShort, this.tradingDurations = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'trading_durations', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'trading_durations', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TradingDurationsRequest.fromJson(Map json) => TradingDurationsRequest( landingCompany: json['landing_company'] as String?, + landingCompanyShort: json['landing_company_short'] as String?, tradingDurations: json['trading_durations'] == null ? null : json['trading_durations'] == 1, @@ -29,9 +28,12 @@ class TradingDurationsRequest extends Request { reqId: json['req_id'] as int?, ); - /// [Optional] If specified, will return only the underlyings for the specified landing company. + /// Deprecated - Replaced by landing_company_short. final String? landingCompany; + /// [Optional] If specified, will return only the underlyings for the specified landing company. + final String? landingCompanyShort; + /// Must be `true` final bool? tradingDurations; @@ -39,6 +41,7 @@ class TradingDurationsRequest extends Request { @override Map toJson() => { 'landing_company': landingCompany, + 'landing_company_short': landingCompanyShort, 'trading_durations': tradingDurations == null ? null : tradingDurations! @@ -52,12 +55,14 @@ class TradingDurationsRequest extends Request { @override TradingDurationsRequest copyWith({ String? landingCompany, + String? landingCompanyShort, bool? tradingDurations, Map? passthrough, int? reqId, }) => TradingDurationsRequest( landingCompany: landingCompany ?? this.landingCompany, + landingCompanyShort: landingCompanyShort ?? this.landingCompanyShort, tradingDurations: tradingDurations ?? this.tradingDurations, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/trading_platform_asset_listing_receive.dart b/lib/basic_api/generated/trading_platform_asset_listing_receive.dart new file mode 100644 index 0000000000..281a61aacb --- /dev/null +++ b/lib/basic_api/generated/trading_platform_asset_listing_receive.dart @@ -0,0 +1,72 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/trading_platform_asset_listing_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Trading platform asset listing receive class. +class TradingPlatformAssetListingReceive extends Response { + /// Initialize TradingPlatformAssetListingReceive. + const TradingPlatformAssetListingReceive({ + this.subscription, + this.tradingPlatformAssetListing, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory TradingPlatformAssetListingReceive.fromJson( + Map json) => + TradingPlatformAssetListingReceive( + subscription: json['subscription'] as Map?, + tradingPlatformAssetListing: + json['trading_platform_asset_listing'] as Map?, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// For subscription requests only. + final Map? subscription; + + /// Containing Trading asset objects. + final Map? tradingPlatformAssetListing; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'subscription': subscription, + 'trading_platform_asset_listing': tradingPlatformAssetListing, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + TradingPlatformAssetListingReceive copyWith({ + Map? subscription, + Map? tradingPlatformAssetListing, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + TradingPlatformAssetListingReceive( + subscription: subscription ?? this.subscription, + tradingPlatformAssetListing: + tradingPlatformAssetListing ?? this.tradingPlatformAssetListing, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/trading_platform_asset_listing_send.dart b/lib/basic_api/generated/trading_platform_asset_listing_send.dart new file mode 100644 index 0000000000..36d781b2b8 --- /dev/null +++ b/lib/basic_api/generated/trading_platform_asset_listing_send.dart @@ -0,0 +1,97 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/trading_platform_asset_listing_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Trading platform asset listing request class. +class TradingPlatformAssetListingRequest extends Request { + /// Initialize TradingPlatformAssetListingRequest. + const TradingPlatformAssetListingRequest({ + required this.platform, + required this.region, + this.subscribe, + this.tradingPlatformAssetListing = true, + required this.type, + super.msgType = 'trading_platform_asset_listing', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory TradingPlatformAssetListingRequest.fromJson( + Map json) => + TradingPlatformAssetListingRequest( + platform: json['platform'] as String?, + region: json['region'] as String?, + subscribe: json['subscribe'] == null ? null : json['subscribe'] == 1, + tradingPlatformAssetListing: + json['trading_platform_asset_listing'] == null + ? null + : json['trading_platform_asset_listing'] == 1, + type: json['type'] as String?, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// Trading platform name + final String? platform; + + /// Region be either 'eu' or 'row'. + final String? region; + + /// [Optional] If set to `true`, will send updates whenever asset listing is updated. + final bool? subscribe; + + /// Must be `true` + final bool? tradingPlatformAssetListing; + + /// Can be either 'brief' or 'full'. + final String? type; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'platform': platform, + 'region': region, + 'subscribe': subscribe == null + ? null + : subscribe! + ? 1 + : 0, + 'trading_platform_asset_listing': tradingPlatformAssetListing == null + ? null + : tradingPlatformAssetListing! + ? 1 + : 0, + 'type': type, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + TradingPlatformAssetListingRequest copyWith({ + String? platform, + String? region, + bool? subscribe, + bool? tradingPlatformAssetListing, + String? type, + Map? passthrough, + int? reqId, + }) => + TradingPlatformAssetListingRequest( + platform: platform ?? this.platform, + region: region ?? this.region, + subscribe: subscribe ?? this.subscribe, + tradingPlatformAssetListing: + tradingPlatformAssetListing ?? this.tradingPlatformAssetListing, + type: type ?? this.type, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/trading_platform_investor_password_change_send.dart b/lib/basic_api/generated/trading_platform_investor_password_change_send.dart index a3c650ac02..758f7349ab 100644 --- a/lib/basic_api/generated/trading_platform_investor_password_change_send.dart +++ b/lib/basic_api/generated/trading_platform_investor_password_change_send.dart @@ -13,13 +13,10 @@ class TradingPlatformInvestorPasswordChangeRequest extends Request { required this.oldPassword, required this.platform, this.tradingPlatformInvestorPasswordChange = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'trading_platform_investor_password_change', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'trading_platform_investor_password_change', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformInvestorPasswordChangeRequest.fromJson( diff --git a/lib/basic_api/generated/trading_platform_new_account_receive.dart b/lib/basic_api/generated/trading_platform_new_account_receive.dart index a4b0ebd1d6..3748c05479 100644 --- a/lib/basic_api/generated/trading_platform_new_account_receive.dart +++ b/lib/basic_api/generated/trading_platform_new_account_receive.dart @@ -9,16 +9,11 @@ class TradingPlatformNewAccountReceive extends Response { /// Initialize TradingPlatformNewAccountReceive. const TradingPlatformNewAccountReceive({ this.tradingPlatformNewAccount, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformNewAccountReceive.fromJson( diff --git a/lib/basic_api/generated/trading_platform_new_account_send.dart b/lib/basic_api/generated/trading_platform_new_account_send.dart index 26159a3750..bdd7904c45 100644 --- a/lib/basic_api/generated/trading_platform_new_account_send.dart +++ b/lib/basic_api/generated/trading_platform_new_account_send.dart @@ -17,13 +17,10 @@ class TradingPlatformNewAccountRequest extends Request { required this.platform, this.subAccountType, this.tradingPlatformNewAccount = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'trading_platform_new_account', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'trading_platform_new_account', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformNewAccountRequest.fromJson( @@ -59,7 +56,7 @@ class TradingPlatformNewAccountRequest extends Request { /// Market type final String? marketType; - /// The master password of the account. For validation (Accepts any printable ASCII character. Must be within 8-25 characters, and include numbers, lowercase and uppercase letters. Must not be the same as the user's email address). This field is required. + /// The master password of the account. For validation (Accepts any printable ASCII character. Must be within 8-25 characters, and include numbers, lowercase and uppercase letters. Must not be the same as the user's email address). Only for DXTrade. final String? password; /// Name of trading platform. diff --git a/lib/basic_api/generated/wallet_migration_receive.dart b/lib/basic_api/generated/wallet_migration_receive.dart new file mode 100644 index 0000000000..7f088e5999 --- /dev/null +++ b/lib/basic_api/generated/wallet_migration_receive.dart @@ -0,0 +1,61 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/wallet_migration_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Wallet migration receive class. +class WalletMigrationReceive extends Response { + /// Initialize WalletMigrationReceive. + const WalletMigrationReceive({ + this.walletMigration, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory WalletMigrationReceive.fromJson(Map json) => + WalletMigrationReceive( + walletMigration: json['wallet_migration'] as Map?, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// The information regarding wallet migration state + final Map? walletMigration; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'wallet_migration': walletMigration, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + WalletMigrationReceive copyWith({ + Map? walletMigration, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + WalletMigrationReceive( + walletMigration: walletMigration ?? this.walletMigration, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/wallet_migration_send.dart b/lib/basic_api/generated/wallet_migration_send.dart new file mode 100644 index 0000000000..4216d2b22f --- /dev/null +++ b/lib/basic_api/generated/wallet_migration_send.dart @@ -0,0 +1,52 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/wallet_migration_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Wallet migration request class. +class WalletMigrationRequest extends Request { + /// Initialize WalletMigrationRequest. + const WalletMigrationRequest({ + required this.walletMigration, + super.msgType = 'wallet_migration', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory WalletMigrationRequest.fromJson(Map json) => + WalletMigrationRequest( + walletMigration: json['wallet_migration'] as String?, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// Wallet migration action. + final String? walletMigration; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'wallet_migration': walletMigration, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + WalletMigrationRequest copyWith({ + String? walletMigration, + Map? passthrough, + int? reqId, + }) => + WalletMigrationRequest( + walletMigration: walletMigration ?? this.walletMigration, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/helper/response_mapper.helper.dart b/lib/basic_api/helper/response_mapper.helper.dart index 956431bc53..88237bceb5 100644 --- a/lib/basic_api/helper/response_mapper.helper.dart +++ b/lib/basic_api/helper/response_mapper.helper.dart @@ -7,7 +7,6 @@ import '../generated/account_closure_receive.dart'; import '../generated/account_security_receive.dart'; import '../generated/account_statistics_receive.dart'; import '../generated/active_symbols_receive.dart'; -import '../generated/affiliate_account_add_receive.dart'; import '../generated/api_token_receive.dart'; import '../generated/app_delete_receive.dart'; import '../generated/app_get_receive.dart'; @@ -122,6 +121,7 @@ import '../generated/tnc_approval_receive.dart'; import '../generated/topup_virtual_receive.dart'; import '../generated/trading_durations_receive.dart'; import '../generated/trading_platform_accounts_receive.dart'; +import '../generated/trading_platform_asset_listing_receive.dart'; import '../generated/trading_platform_available_accounts_receive.dart'; import '../generated/trading_platform_deposit_receive.dart'; import '../generated/trading_platform_investor_password_change_receive.dart'; @@ -138,6 +138,7 @@ import '../generated/transfer_between_accounts_receive.dart'; import '../generated/unsubscribe_email_receive.dart'; import '../generated/verify_email_cellxpert_receive.dart'; import '../generated/verify_email_receive.dart'; +import '../generated/wallet_migration_receive.dart'; import '../generated/website_status_receive.dart'; import '../response.dart'; @@ -153,8 +154,6 @@ Response getGeneratedResponse(Map responseMap) { return AccountStatisticsReceive.fromJson(responseMap); case 'active_symbols': return ActiveSymbolsReceive.fromJson(responseMap); - case 'affiliate_account_add': - return AffiliateAccountAddReceive.fromJson(responseMap); case 'api_token': return ApiTokenReceive.fromJson(responseMap); case 'app_delete': @@ -383,6 +382,8 @@ Response getGeneratedResponse(Map responseMap) { return TradingDurationsReceive.fromJson(responseMap); case 'trading_platform_accounts': return TradingPlatformAccountsReceive.fromJson(responseMap); + case 'trading_platform_asset_listing': + return TradingPlatformAssetListingReceive.fromJson(responseMap); case 'trading_platform_available_accounts': return TradingPlatformAvailableAccountsReceive.fromJson(responseMap); case 'trading_platform_deposit': @@ -415,6 +416,8 @@ Response getGeneratedResponse(Map responseMap) { return VerifyEmailCellxpertReceive.fromJson(responseMap); case 'verify_email': return VerifyEmailReceive.fromJson(responseMap); + case 'wallet_migration': + return WalletMigrationReceive.fromJson(responseMap); case 'website_status': return WebsiteStatusReceive.fromJson(responseMap); diff --git a/lib/services/connection/api_manager/mock_api.dart b/lib/services/connection/api_manager/mock_api.dart index 8f51940748..a18cc41ecd 100644 --- a/lib/services/connection/api_manager/mock_api.dart +++ b/lib/services/connection/api_manager/mock_api.dart @@ -12,6 +12,8 @@ import 'package:flutter_deriv_api/basic_api/response.dart'; import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; import 'package:flutter_deriv_api/services/connection/api_manager/connection_information.dart'; import 'package:flutter_deriv_api/services/connection/api_manager/exceptions/api_manager_exception.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/mock_data/account/new_account_wallet_response.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/mock_data/cashier/cashier_payments_response.dart'; import 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart'; import 'package:flutter_deriv_api/services/connection/call_manager/exceptions/call_manager_exception.dart'; @@ -21,6 +23,7 @@ import 'mock_data/account/balance_response.dart'; import 'mock_data/account/copy_trading_list_response.dart'; import 'mock_data/account/copy_trading_statistics_response.dart'; import 'mock_data/account/get_account_status_response.dart'; +import 'mock_data/account/get_account_types_response.dart'; import 'mock_data/account/get_limits_response.dart'; import 'mock_data/account/get_self_exclusion_response.dart'; import 'mock_data/account/get_settings_response.dart'; @@ -106,6 +109,7 @@ import 'mock_data/user/set_financial_assessment_response.dart'; import 'mock_data/user/tnc_approval_response.dart'; import 'mock_data/user/transfer_between_accounts_response.dart'; import 'mock_data/user/verify_email_response.dart'; +import 'mock_data/wallet_migration_response.dart'; /// This class is for handling mock API connection and calling mock APIs class MockAPI extends BaseAPI { @@ -203,6 +207,8 @@ class MockAPI extends BaseAPI { return cancelResponse; case 'cashier': return cashierInformationResponse; + case 'cashier_payments': + return cashierPaymentsResponse; case 'contract_update': return contractUpdateResponse; case 'contract_update_history': @@ -226,6 +232,8 @@ class MockAPI extends BaseAPI { return forgetAllResponse; case 'get_account_status': return getAccountStatusResponse; + case 'get_account_types': + return getAccountTypesResponse; case 'get_financial_assessment': return getFinancialAssessmentResponse; case 'get_limits': @@ -263,6 +271,8 @@ class MockAPI extends BaseAPI { return newAccountRealResponse; case 'new_account_virtual': return newAccountVirtualResponse; + case 'new_account_wallet': + return newAccountWalletResponse; case 'oauth_apps': return oauthAppsResponse; case 'p2p_advert_create': @@ -361,6 +371,8 @@ class MockAPI extends BaseAPI { return verifyEmailResponse; case 'website_status': return websiteStatusResponse; + case 'wallet_migration': + return walletMigrationResponse; default: throw APIManagerException( diff --git a/lib/services/connection/api_manager/mock_data/account/get_account_types_response.dart b/lib/services/connection/api_manager/mock_data/account/get_account_types_response.dart new file mode 100644 index 0000000000..fb7a6146e3 --- /dev/null +++ b/lib/services/connection/api_manager/mock_data/account/get_account_types_response.dart @@ -0,0 +1,153 @@ +/// Mock data for get_account_types response. +const String getAccountTypesResponse = '''{ + "echo_req": { + "get_account_types": 1 + }, + "get_account_types": { + "trading": { + "binary": { + "allowed_wallet_currencies": [ + "AUD", + "BTC", + "ETH", + "EUR", + "GBP", + "LTC", + "USD", + "USDC", + "UST", + "eUSDT", + "tUSDT" + ], + "linkable_to_different_currency": 0, + "linkable_wallet_types": [ + "doughflow", + "crypto", + "p2p", + "paymentagent_client" + ] + }, + "derivez": { + "allowed_wallet_currencies": [ + "AUD", + "EUR", + "GBP", + "USD" + ], + "linkable_to_different_currency": 1, + "linkable_wallet_types": [ + "doughflow", + "p2p", + "paymentagent_client" + ] + }, + "dxtrade": { + "allowed_wallet_currencies": [ + "AUD", + "EUR", + "GBP", + "USD" + ], + "linkable_to_different_currency": 1, + "linkable_wallet_types": [ + "doughflow", + "p2p", + "paymentagent_client" + ] + }, + "mt5": { + "allowed_wallet_currencies": [ + "AUD", + "EUR", + "GBP", + "USD" + ], + "linkable_to_different_currency": 1, + "linkable_wallet_types": [ + "doughflow", + "p2p", + "paymentagent_client" + ] + }, + "standard": { + "allowed_wallet_currencies": [ + "AUD", + "BTC", + "ETH", + "EUR", + "GBP", + "LTC", + "USD", + "USDC", + "UST", + "eUSDT", + "tUSDT" + ], + "linkable_to_different_currency": 0, + "linkable_wallet_types": [ + "doughflow", + "crypto", + "p2p", + "paymentagent_client" + ] + } + }, + "wallet": { + "crypto": { + "currencies": [ + "BTC", + "ETH", + "LTC", + "USDC", + "UST", + "eUSDT", + "tUSDT" + ] + }, + "doughflow": { + "currencies": [ + "AUD", + "EUR", + "GBP", + "USD" + ] + }, + "p2p": { + "currencies": [ + "USD" + ] + }, + "paymentagent": { + "currencies": [ + "AUD", + "BTC", + "ETH", + "EUR", + "GBP", + "LTC", + "USD", + "USDC", + "UST", + "eUSDT", + "tUSDT" + ] + }, + "paymentagent_client": { + "currencies": [ + "AUD", + "BTC", + "ETH", + "EUR", + "GBP", + "LTC", + "USD", + "USDC", + "UST", + "eUSDT", + "tUSDT" + ] + } + } + }, + "msg_type": "get_account_types" +}'''; diff --git a/lib/services/connection/api_manager/mock_data/account/new_account_wallet_response.dart b/lib/services/connection/api_manager/mock_data/account/new_account_wallet_response.dart new file mode 100644 index 0000000000..7d428009ca --- /dev/null +++ b/lib/services/connection/api_manager/mock_data/account/new_account_wallet_response.dart @@ -0,0 +1,16 @@ +/// New account wallet response mock data. +const String newAccountWalletResponse = '''{ + "echo_req": { + "account_type": "crypto", + "currency": "BTC", + "new_account_wallet": 1 + }, + "msg_type": "new_account_wallet", + "new_account_wallet": { + "client_id": "CRW1170", + "currency": "BTC", + "landing_company": "Deriv (SVG) LLC", + "landing_company_shortcode": "svg", + "oauth_token": "DYsMOCKRAqaX23DvpZfmUW" + } +}'''; diff --git a/lib/services/connection/api_manager/mock_data/cashier/cashier_payments_response.dart b/lib/services/connection/api_manager/mock_data/cashier/cashier_payments_response.dart new file mode 100644 index 0000000000..f47489ccce --- /dev/null +++ b/lib/services/connection/api_manager/mock_data/cashier/cashier_payments_response.dart @@ -0,0 +1,27 @@ +import 'package:flutter_deriv_api/api/response/cashier_payments_response_result.dart'; + +/// The mock data for [CashierPaymentsResponse]. +const String cashierPaymentsResponse = ''' +{ + "cashier_payments": { + "crypto": [ + { + "address_hash": "addressHash", + "address_url": "addressUrl", + "id": "id", + "status_code": "CANCELLED", + "status_message": "statusMessage", + "transaction_type": "deposit", + "amount": 1, + "confirmations": 1, + "is_valid_to_cancel": true, + "submit_date": 1695118224, + "transaction_hash": "transactionHash", + "transaction_url": "transactionUrl" + } + ] + }, + "msg_type": "cashier_payments", + "req_id": 681 +} +'''; diff --git a/lib/services/connection/api_manager/mock_data/common/website_status_response.dart b/lib/services/connection/api_manager/mock_data/common/website_status_response.dart index 77ab3b219e..0bc9d3229f 100644 --- a/lib/services/connection/api_manager/mock_data/common/website_status_response.dart +++ b/lib/services/connection/api_manager/mock_data/common/website_status_response.dart @@ -653,6 +653,11 @@ const String websiteStatusResponse = '''{ "cancellation_count_period": 24, "cancellation_grace_period": 15, "cancellation_limit": 3, + "cross_border_ads_enabled": 1, + "block_trade": { + "disabled": false, + "maximum_advert_amount": 3000 + }, "maximum_advert_amount": 3000, "maximum_order_amount": 1000, "order_daily_limit": 200, diff --git a/lib/services/connection/api_manager/mock_data/wallet_migration_response.dart b/lib/services/connection/api_manager/mock_data/wallet_migration_response.dart new file mode 100644 index 0000000000..00ed61c8c6 --- /dev/null +++ b/lib/services/connection/api_manager/mock_data/wallet_migration_response.dart @@ -0,0 +1,42 @@ +/// Wallet migration response mock data. +const String walletMigrationResponse = '''{ + "echo_req": { + "wallet_migration": "state" + }, + "msg_type": "wallet_migration", + "wallet_migration": { + "account_list": [ + { + "account_category": "wallet", + "account_type": "virtual", + "currency": "USD", + "landing_company_short": "virtual", + "link_accounts": [ + { + "account_category": "trading", + "account_type": "standard", + "loginid": "VRTC90000164", + "platform": "dtrade" + } + ], + "platform": "dwallet" + }, + { + "account_category": "wallet", + "account_type": "doughflow", + "currency": "USD", + "landing_company_short": "svg", + "link_accounts": [ + { + "account_category": "trading", + "account_type": "standard", + "loginid": "CR90000255", + "platform": "dtrade" + } + ], + "platform": "dwallet" + } + ], + "state": "eligible" + } +}'''; diff --git a/test/api/account/get_account_types/get_account_types_test.dart b/test/api/account/get_account_types/get_account_types_test.dart new file mode 100644 index 0000000000..935494e26c --- /dev/null +++ b/test/api/account/get_account_types/get_account_types_test.dart @@ -0,0 +1,75 @@ +import 'package:flutter_deriv_api/api/api_initializer.dart'; +import 'package:flutter_deriv_api/api/response/get_account_types_response_extended.dart'; +import 'package:flutter_deriv_api/api/response/get_account_types_response_result.dart'; +import 'package:flutter_deriv_api/basic_api/generated/api.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/mock_api.dart'; +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + setUp(() => APIInitializer().initialize(api: MockAPI())); + + tearDown(() => Injector().dispose()); + + test('Get account types API call returns the expected result.', () async { + final GetAccountTypesResponse accountTypesResponse = + await GetAccountTypesResponseExtended.fetchAccountTypes( + request: const GetAccountTypesRequest(), + ); + + expect(accountTypesResponse.getAccountTypes?.trading.length, 5); + expect(accountTypesResponse.getAccountTypes?.wallet.length, 5); + expect(accountTypesResponse.getAccountTypes?.trading['binary'], + isA()); + expect( + accountTypesResponse + .getAccountTypes?.trading['binary']?.linkableWalletTypes.length, + 4, + ); + expect( + accountTypesResponse + .getAccountTypes?.trading['binary']?.linkableWalletTypes.first, + 'doughflow', + ); + expect( + accountTypesResponse + .getAccountTypes?.trading['binary']?.allowedWalletCurrencies.length, + 11, + ); + expect( + accountTypesResponse + .getAccountTypes?.trading['binary']?.allowedWalletCurrencies.first, + 'AUD', + ); + expect( + accountTypesResponse + .getAccountTypes?.trading['derivez']?.linkableWalletTypes.length, + 3, + ); + expect( + accountTypesResponse + .getAccountTypes?.trading['derivez']?.linkableWalletTypes.first, + 'doughflow', + ); + expect( + accountTypesResponse.getAccountTypes?.trading['standard'], + isA(), + ); + expect( + accountTypesResponse.getAccountTypes?.wallet['crypto']?.currencies.length, + 7, + ); + expect( + accountTypesResponse.getAccountTypes?.wallet['crypto']?.currencies.first, + 'BTC', + ); + expect( + accountTypesResponse.getAccountTypes?.wallet['crypto']?.currencies.last, + 'tUSDT', + ); + expect( + accountTypesResponse.getAccountTypes?.wallet['doughflow'], + isA(), + ); + }); +} diff --git a/test/api/account/new_account_wallet/new_account_wallet_test.dart b/test/api/account/new_account_wallet/new_account_wallet_test.dart new file mode 100644 index 0000000000..e3a990eea8 --- /dev/null +++ b/test/api/account/new_account_wallet/new_account_wallet_test.dart @@ -0,0 +1,31 @@ +import 'package:flutter_deriv_api/api/api_initializer.dart'; +import 'package:flutter_deriv_api/api/response/new_account_wallet_response_extended.dart'; +import 'package:flutter_deriv_api/api/response/new_account_wallet_response_result.dart'; +import 'package:flutter_deriv_api/basic_api/generated/api.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/mock_api.dart'; +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + setUp(() => APIInitializer().initialize(api: MockAPI())); + + tearDown(() => Injector().dispose()); + + test('New account wallet API call returns the expected result.', () async { + final NewAccountWalletResponse newAccountWallet = + await NewAccountWalletResponseExtended.createNewWalletAccount( + request: const NewAccountWalletRequest( + accountType: 'crypto', + currency: 'BTC', + ), + ); + + expect(newAccountWallet.newAccountWallet?.clientId, 'CRW1170'); + expect(newAccountWallet.newAccountWallet?.currency, 'BTC'); + expect(newAccountWallet.newAccountWallet?.clientId, 'CRW1170'); + expect( + newAccountWallet.newAccountWallet?.oauthToken, + 'DYsMOCKRAqaX23DvpZfmUW', + ); + }); +} diff --git a/test/api/account/wallet_migration/wallet_migration_test.dart b/test/api/account/wallet_migration/wallet_migration_test.dart new file mode 100644 index 0000000000..cd8448a4ad --- /dev/null +++ b/test/api/account/wallet_migration/wallet_migration_test.dart @@ -0,0 +1,63 @@ +import 'package:flutter_deriv_api/api/api_initializer.dart'; +import 'package:flutter_deriv_api/api/response/wallet_migration_response_extended.dart'; +import 'package:flutter_deriv_api/api/response/wallet_migration_response_result.dart'; +import 'package:flutter_deriv_api/basic_api/generated/wallet_migration_send.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/mock_api.dart'; +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + group('Wallet migration', () { + setUpAll(() => APIInitializer().initialize(api: MockAPI())); + + tearDownAll(() => Injector().dispose()); + + test( + 'fetchWalletMigration method returns the expected result.', + () async { + final WalletMigrationResponse response = + await WalletMigrationResponseExtended.fetchWalletMigration( + request: const WalletMigrationRequest(walletMigration: 'state'), + ); + + expect(response.walletMigration?.state, StateEnum.eligible); + expect(response.walletMigration?.accountList?.length, 2); + + final AccountListItem? firstAccount = + response.walletMigration?.accountList?.first; + + expect(firstAccount?.currency, 'USD'); + expect(firstAccount?.platform, AccountListItemPlatformEnum.dwallet); + expect( + firstAccount?.accountCategory, + AccountCategoryEnum.wallet, + ); + expect(firstAccount?.accountType, 'virtual'); + expect(firstAccount?.linkAccounts.length, 1); + }, + ); + + test( + 'checkStatus method returns the expected result.', + () async { + final WalletMigrationResponse response = + await WalletMigrationResponseExtended.checkStatus(); + + expect(response.walletMigration?.state, StateEnum.eligible); + expect(response.walletMigration?.accountList?.length, 2); + + final AccountListItem? firstAccount = + response.walletMigration?.accountList?.first; + + expect(firstAccount?.currency, 'USD'); + expect(firstAccount?.platform, AccountListItemPlatformEnum.dwallet); + expect( + firstAccount?.accountCategory, + AccountCategoryEnum.wallet, + ); + expect(firstAccount?.accountType, 'virtual'); + expect(firstAccount?.linkAccounts.length, 1); + }, + ); + }); +} diff --git a/test/api/cashier/cashier_payments_test.dart b/test/api/cashier/cashier_payments_test.dart new file mode 100644 index 0000000000..28e805c3ec --- /dev/null +++ b/test/api/cashier/cashier_payments_test.dart @@ -0,0 +1,30 @@ +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_deriv_api/api/api_initializer.dart'; +import 'package:flutter_deriv_api/api/response/cashier_payments_response_extended.dart'; +import 'package:flutter_deriv_api/api/response/cashier_payments_response_result.dart'; +import 'package:flutter_deriv_api/basic_api/generated/cashier_payments_send.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/mock_api.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + setUp(() => APIInitializer().initialize(api: MockAPI())); + + tearDown(() => Injector().dispose()); + + test('Fetch Cashier Payments Test', () async { + final CashierPaymentsResponse response = + await CashierPaymentsResponseExtended.fetchCashierPayments( + request: const CashierPaymentsRequest(), + ); + + expect(response.cashierPayments?.crypto?.length, 1); + expect(response.cashierPayments?.crypto?.first.id, 'id'); + expect(response.cashierPayments?.crypto?.first.statusCode, + StatusCodeEnum.cancelled); + expect( + response + .cashierPayments?.crypto?.first.submitDate?.millisecondsSinceEpoch, + 1695118224000, + ); + }); +} diff --git a/test/api/common/asset_index/asset_index_test.dart b/test/api/common/asset_index/asset_index_test.dart index 05a4bdfa32..013d2fc7ff 100644 --- a/test/api/common/asset_index/asset_index_test.dart +++ b/test/api/common/asset_index/asset_index_test.dart @@ -12,7 +12,8 @@ void main() { test('Fetch Asset Index Test', () async { final AssetIndexResponse assetIndices = - await AssetIndexResponse.fetchAssetIndices(const AssetIndexRequest()); + await AssetIndexResponse.fetchAssetIndices( + const AssetIndexRequest(landingCompany: 'svg')); expect(assetIndices.assetIndex?.length, 1); // expect(assetIndices.assetIndex.first['symbol_code'], 'frxAUDJPY'); diff --git a/test/api/common/trading/trading_duration_test.dart b/test/api/common/trading/trading_duration_test.dart index ede7e756b0..388c6af57e 100644 --- a/test/api/common/trading/trading_duration_test.dart +++ b/test/api/common/trading/trading_duration_test.dart @@ -13,7 +13,7 @@ void main() { test('Fetch Trading Duration Test', () async { final TradingDurationsResponse tradeDuration = await TradingDurationsResponse.fetchTradingDurations( - const TradingDurationsRequest(), + const TradingDurationsRequest(landingCompany: 'svg'), ); expect(tradeDuration.tradingDurations?.length, 8); diff --git a/test/api/mt5/mt5_account_test.dart b/test/api/mt5/mt5_account_test.dart index ef8d57c8ad..ceaeb5a242 100644 --- a/test/api/mt5/mt5_account_test.dart +++ b/test/api/mt5/mt5_account_test.dart @@ -131,7 +131,7 @@ void main() { ).fetchSettings(); expect(mt5Settings.mt5GetSettings?.address, 'sample address'); - expect(mt5Settings.mt5GetSettings?.balance, '250.0'); + expect(mt5Settings.mt5GetSettings?.balance, 250.0); expect(mt5Settings.mt5GetSettings?.city, 'London'); expect(mt5Settings.mt5GetSettings?.company, 'sample company'); expect(mt5Settings.mt5GetSettings?.country, 'England'); From 6360d7da5a098568a55f666048695112b600381d Mon Sep 17 00:00:00 2001 From: Weng Lok <103249398+weng-deriv@users.noreply.github.com> Date: Wed, 11 Oct 2023 14:45:19 +0800 Subject: [PATCH 35/64] weng/updated_p2p_order_list_api_request (#282) - updated p2p order list api request. --- .../generated/p2p_order_list_send.dart | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/lib/basic_api/generated/p2p_order_list_send.dart b/lib/basic_api/generated/p2p_order_list_send.dart index 8dee4a71b1..b340480493 100644 --- a/lib/basic_api/generated/p2p_order_list_send.dart +++ b/lib/basic_api/generated/p2p_order_list_send.dart @@ -10,23 +10,24 @@ class P2pOrderListRequest extends Request { const P2pOrderListRequest({ this.active, this.advertId, + this.dateFrom, + this.dateTo, this.limit, this.offset, this.p2pOrderList = true, this.subscribe, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_order_list', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_order_list', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pOrderListRequest.fromJson(Map json) => P2pOrderListRequest( active: json['active'] as num?, advertId: json['advert_id'] as String?, + dateFrom: json['date_from'] as String?, + dateTo: json['date_to'] as String?, limit: json['limit'] as int?, offset: json['offset'] as int?, p2pOrderList: @@ -42,6 +43,12 @@ class P2pOrderListRequest extends Request { /// [Optional] If present, lists orders applying to a specific advert. final String? advertId; + /// [Optional] Filter the orders created after this date(included) format(epoch or YYYY-MM-DD) + final String? dateFrom; + + /// [Optional] Filter the orders created before this date(included) format(epoch or YYYY-MM-DD) + final String? dateTo; + /// [Optional] Used for paging. final int? limit; @@ -59,6 +66,8 @@ class P2pOrderListRequest extends Request { Map toJson() => { 'active': active, 'advert_id': advertId, + 'date_from': dateFrom, + 'date_to': dateTo, 'limit': limit, 'offset': offset, 'p2p_order_list': p2pOrderList == null @@ -80,6 +89,8 @@ class P2pOrderListRequest extends Request { P2pOrderListRequest copyWith({ num? active, String? advertId, + String? dateFrom, + String? dateTo, int? limit, int? offset, bool? p2pOrderList, @@ -90,6 +101,8 @@ class P2pOrderListRequest extends Request { P2pOrderListRequest( active: active ?? this.active, advertId: advertId ?? this.advertId, + dateFrom: dateFrom ?? this.dateFrom, + dateTo: dateTo ?? this.dateTo, limit: limit ?? this.limit, offset: offset ?? this.offset, p2pOrderList: p2pOrderList ?? this.p2pOrderList, From c7fc160f541a3036ac5214e5e2696a89085d8449 Mon Sep 17 00:00:00 2001 From: Osama Ghazal <124760982+osama-deriv@users.noreply.github.com> Date: Wed, 6 Sep 2023 15:14:51 +0800 Subject: [PATCH 36/64] add auth endpoint to connection_information.dart class --- .../connection/api_manager/connection_information.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/services/connection/api_manager/connection_information.dart b/lib/services/connection/api_manager/connection_information.dart index 41820801ec..69a808d69a 100644 --- a/lib/services/connection/api_manager/connection_information.dart +++ b/lib/services/connection/api_manager/connection_information.dart @@ -5,6 +5,7 @@ class ConnectionInformation { required this.appId, required this.brand, required this.endpoint, + required this.authEndpoint, this.language = 'en', }); @@ -17,6 +18,9 @@ class ConnectionInformation { /// API endpoint. final String endpoint; + /// Auth endpoint. + final String authEndpoint; + /// API language. final String language; } From d755a513ea936d9d6067c3e70279327077e37e32 Mon Sep 17 00:00:00 2001 From: Osama Ghazal <124760982+osama-deriv@users.noreply.github.com> Date: Wed, 6 Sep 2023 15:29:18 +0800 Subject: [PATCH 37/64] add auth endpoint to connection_cubit.dart --- lib/state/connection/connection_cubit.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/state/connection/connection_cubit.dart b/lib/state/connection/connection_cubit.dart index c47d4db6ab..c2f401161e 100644 --- a/lib/state/connection/connection_cubit.dart +++ b/lib/state/connection/connection_cubit.dart @@ -67,6 +67,9 @@ class ConnectionCubit extends Cubit { /// Gets endpoint of websocket. static String get endpoint => _connectionInformation.endpoint; + /// Gets auth endpoint of websocket. + static String get authEndpoint => _connectionInformation.authEndpoint; + /// Gets app id of websocket. static String get appId => _connectionInformation.appId; From c01a211384d2af68a624819cbc3dccc7414dac4e Mon Sep 17 00:00:00 2001 From: Osama Ghazal <124760982+osama-deriv@users.noreply.github.com> Date: Mon, 11 Sep 2023 12:17:17 +0800 Subject: [PATCH 38/64] fix test --- test/state/connection/connection_bloc_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/state/connection/connection_bloc_test.dart b/test/state/connection/connection_bloc_test.dart index 651094dd51..d4147817a8 100644 --- a/test/state/connection/connection_bloc_test.dart +++ b/test/state/connection/connection_bloc_test.dart @@ -10,7 +10,7 @@ void main() { setUpAll( () { connectionCubit = ConnectionCubit( - ConnectionInformation(appId: '', brand: '', endpoint: ''), + ConnectionInformation(appId: '', brand: '', endpoint: '',authEndpoint: ''), api: MockAPI(), ); }, From 17c4d1ee5b35af3c400551b423f90abb7af2ca55 Mon Sep 17 00:00:00 2001 From: balakrishna-deriv <56330681+balakrishna-deriv@users.noreply.github.com> Date: Thu, 23 Nov 2023 13:37:05 +0800 Subject: [PATCH 39/64] chore: fix dependency injector branch (#289) --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 9612ac8ed5..be7316d9fb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: git: url: git@github.com:regentmarkets/flutter-deriv-packages.git path: packages/deriv_dependency_injector - ref: flutter-version-3 + ref: dev build: ^2.3.1 dart_style: ^2.3.0 From 27ed5e1b78b49f2041b55313c1a584e7933e40bc Mon Sep 17 00:00:00 2001 From: ramin-deriv <55975218+ramin-deriv@users.noreply.github.com> Date: Wed, 6 Dec 2023 10:14:11 +0800 Subject: [PATCH 40/64] Ramin/update_for_accumulators (#288) --- example/lib/sample_app.dart | 1 + ...roposal_open_contract_response_result.dart | 439 ++++++++---------- .../response/proposal_response_result.dart | 209 ++++----- .../methods/proposal_receive_methods.json | 2 +- .../proposal_open_contract_receive.dart | 15 +- .../proposal_open_contract_send.dart | 19 +- lib/basic_api/generated/proposal_receive.dart | 15 +- lib/basic_api/generated/proposal_send.dart | 19 +- 8 files changed, 310 insertions(+), 409 deletions(-) diff --git a/example/lib/sample_app.dart b/example/lib/sample_app.dart index 19286bf8e3..a3799bfe71 100644 --- a/example/lib/sample_app.dart +++ b/example/lib/sample_app.dart @@ -24,6 +24,7 @@ class _SampleAppState extends State { appId: '1089', brand: 'binary', endpoint: 'frontend.binaryws.com', + authEndpoint: '', ), ); } diff --git a/lib/api/response/proposal_open_contract_response_result.dart b/lib/api/response/proposal_open_contract_response_result.dart index c233b7dec7..35823a6354 100644 --- a/lib/api/response/proposal_open_contract_response_result.dart +++ b/lib/api/response/proposal_open_contract_response_result.dart @@ -20,7 +20,6 @@ import 'package:flutter_deriv_api/helpers/helpers.dart'; import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; import 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart'; import 'package:deriv_dependency_injector/dependency_injector.dart'; - /// Proposal open contract response model class. abstract class ProposalOpenContractResponseModel { /// Initializes Proposal open contract response model class . @@ -40,12 +39,9 @@ abstract class ProposalOpenContractResponseModel { class ProposalOpenContractResponse extends ProposalOpenContractResponseModel { /// Initializes Proposal open contract response class. const ProposalOpenContractResponse({ - ProposalOpenContract? proposalOpenContract, - Subscription? subscription, - }) : super( - proposalOpenContract: proposalOpenContract, - subscription: subscription, - ); + super.proposalOpenContract, + super.subscription, + }); /// Creates an instance from JSON. factory ProposalOpenContractResponse.fromJson( @@ -216,7 +212,6 @@ enum StatusEnum { /// null. _null, } - /// Proposal open contract model class. abstract class ProposalOpenContractModel { /// Initializes Proposal open contract model class . @@ -225,6 +220,7 @@ abstract class ProposalOpenContractModel { this.auditDetails, this.barrier, this.barrierCount, + this.barrierSpotDistance, this.bidPrice, this.buyPrice, this.cancellation, @@ -235,11 +231,14 @@ abstract class ProposalOpenContractModel { this.currency, this.currentSpot, this.currentSpotDisplayValue, + this.currentSpotHighBarrier, + this.currentSpotLowBarrier, this.currentSpotTime, this.dateExpiry, this.dateSettlement, this.dateStart, this.displayName, + this.displayNumberOfContracts, this.displayValue, this.entrySpot, this.entrySpotDisplayValue, @@ -265,10 +264,12 @@ abstract class ProposalOpenContractModel { this.longcode, this.lowBarrier, this.multiplier, + this.numberOfContracts, this.payout, this.profit, this.profitPercentage, this.purchaseTime, + this.resetBarrier, this.resetTime, this.sellPrice, this.sellSpot, @@ -283,6 +284,7 @@ abstract class ProposalOpenContractModel { this.transactionIds, this.underlying, this.validationError, + this.validationErrorCode, }); /// Account Id @@ -297,6 +299,9 @@ abstract class ProposalOpenContractModel { /// The number of barriers a contract has. final double? barrierCount; + /// [Only for accumulator] Absolute difference between high/low barrier and spot + final String? barrierSpotDistance; + /// Price at which the contract could be sold back to the company. final double? bidPrice; @@ -327,6 +332,12 @@ abstract class ProposalOpenContractModel { /// Spot value with the correct precision if we have license to stream this symbol. final String? currentSpotDisplayValue; + /// [Applicable for accumulator] High barrier based on current spot. + final String? currentSpotHighBarrier; + + /// [Applicable for accumulator] Low barrier based on current spot. + final String? currentSpotLowBarrier; + /// The corresponding time of the current spot. final DateTime? currentSpotTime; @@ -342,6 +353,9 @@ abstract class ProposalOpenContractModel { /// Display name of underlying final String? displayName; + /// [Only for vanilla or turbos options] The implied number of contracts + final String? displayNumberOfContracts; + /// The `bid_price` with the correct precision final String? displayValue; @@ -417,6 +431,9 @@ abstract class ProposalOpenContractModel { /// [Only for lookback trades] Multiplier applies when calculating the final payoff for each type of lookback. e.g. (Exit spot - Lowest historical price) * multiplier = Payout final double? multiplier; + /// [Only for vanilla or turbos options] The implied number of contracts + final double? numberOfContracts; + /// Payout value of the contract. final double? payout; @@ -429,7 +446,10 @@ abstract class ProposalOpenContractModel { /// Epoch of purchase time, will be same as `date_start` for all contracts except forward starting contracts. final DateTime? purchaseTime; - /// [Only for reset trades] The epoch time of a barrier reset. + /// [Only for reset trades i.e. RESETCALL and RESETPUT] Reset barrier of the contract. + final String? resetBarrier; + + /// [Only for reset trades i.e. RESETCALL and RESETPUT] The epoch time of a barrier reset. final DateTime? resetTime; /// Price at which contract was sold, only available when contract has been sold. @@ -470,138 +490,85 @@ abstract class ProposalOpenContractModel { /// Error message if validation fails final String? validationError; + + /// Error code if validation fails + final String? validationErrorCode; } /// Proposal open contract class. class ProposalOpenContract extends ProposalOpenContractModel { /// Initializes Proposal open contract class. const ProposalOpenContract({ - double? accountId, - AuditDetails? auditDetails, - String? barrier, - double? barrierCount, - double? bidPrice, - double? buyPrice, - Cancellation? cancellation, - double? commision, - double? commission, - int? contractId, - String? contractType, - String? currency, - double? currentSpot, - String? currentSpotDisplayValue, - DateTime? currentSpotTime, - DateTime? dateExpiry, - DateTime? dateSettlement, - DateTime? dateStart, - String? displayName, - String? displayValue, - double? entrySpot, - String? entrySpotDisplayValue, - double? entryTick, - String? entryTickDisplayValue, - DateTime? entryTickTime, - double? exitTick, - String? exitTickDisplayValue, - DateTime? exitTickTime, - DateTime? expiryTime, - double? growthRate, - String? highBarrier, - String? id, - bool? isExpired, - bool? isForwardStarting, - bool? isIntraday, - bool? isPathDependent, - bool? isSettleable, - bool? isSold, - bool? isValidToCancel, - bool? isValidToSell, - LimitOrder? limitOrder, - String? longcode, - String? lowBarrier, - double? multiplier, - double? payout, - double? profit, - double? profitPercentage, - DateTime? purchaseTime, - DateTime? resetTime, - double? sellPrice, - double? sellSpot, - String? sellSpotDisplayValue, - DateTime? sellSpotTime, - DateTime? sellTime, - String? shortcode, - StatusEnum? status, - int? tickCount, - int? tickPassed, - List? tickStream, - TransactionIds? transactionIds, - String? underlying, - String? validationError, - }) : super( - accountId: accountId, - auditDetails: auditDetails, - barrier: barrier, - barrierCount: barrierCount, - bidPrice: bidPrice, - buyPrice: buyPrice, - cancellation: cancellation, - commision: commision, - commission: commission, - contractId: contractId, - contractType: contractType, - currency: currency, - currentSpot: currentSpot, - currentSpotDisplayValue: currentSpotDisplayValue, - currentSpotTime: currentSpotTime, - dateExpiry: dateExpiry, - dateSettlement: dateSettlement, - dateStart: dateStart, - displayName: displayName, - displayValue: displayValue, - entrySpot: entrySpot, - entrySpotDisplayValue: entrySpotDisplayValue, - entryTick: entryTick, - entryTickDisplayValue: entryTickDisplayValue, - entryTickTime: entryTickTime, - exitTick: exitTick, - exitTickDisplayValue: exitTickDisplayValue, - exitTickTime: exitTickTime, - expiryTime: expiryTime, - growthRate: growthRate, - highBarrier: highBarrier, - id: id, - isExpired: isExpired, - isForwardStarting: isForwardStarting, - isIntraday: isIntraday, - isPathDependent: isPathDependent, - isSettleable: isSettleable, - isSold: isSold, - isValidToCancel: isValidToCancel, - isValidToSell: isValidToSell, - limitOrder: limitOrder, - longcode: longcode, - lowBarrier: lowBarrier, - multiplier: multiplier, - payout: payout, - profit: profit, - profitPercentage: profitPercentage, - purchaseTime: purchaseTime, - resetTime: resetTime, - sellPrice: sellPrice, - sellSpot: sellSpot, - sellSpotDisplayValue: sellSpotDisplayValue, - sellSpotTime: sellSpotTime, - sellTime: sellTime, - shortcode: shortcode, - status: status, - tickCount: tickCount, - tickPassed: tickPassed, - tickStream: tickStream, - transactionIds: transactionIds, - underlying: underlying, - validationError: validationError, - ); + super.accountId, + super.auditDetails, + super.barrier, + super.barrierCount, + super.barrierSpotDistance, + super.bidPrice, + super.buyPrice, + super.cancellation, + super.commision, + super.commission, + super.contractId, + super.contractType, + super.currency, + super.currentSpot, + super.currentSpotDisplayValue, + super.currentSpotHighBarrier, + super.currentSpotLowBarrier, + super.currentSpotTime, + super.dateExpiry, + super.dateSettlement, + super.dateStart, + super.displayName, + super.displayNumberOfContracts, + super.displayValue, + super.entrySpot, + super.entrySpotDisplayValue, + super.entryTick, + super.entryTickDisplayValue, + super.entryTickTime, + super.exitTick, + super.exitTickDisplayValue, + super.exitTickTime, + super.expiryTime, + super.growthRate, + super.highBarrier, + super.id, + super.isExpired, + super.isForwardStarting, + super.isIntraday, + super.isPathDependent, + super.isSettleable, + super.isSold, + super.isValidToCancel, + super.isValidToSell, + super.limitOrder, + super.longcode, + super.lowBarrier, + super.multiplier, + super.numberOfContracts, + super.payout, + super.profit, + super.profitPercentage, + super.purchaseTime, + super.resetBarrier, + super.resetTime, + super.sellPrice, + super.sellSpot, + super.sellSpotDisplayValue, + super.sellSpotTime, + super.sellTime, + super.shortcode, + super.status, + super.tickCount, + super.tickPassed, + super.tickStream, + super.transactionIds, + super.underlying, + super.validationError, + super.validationErrorCode, + }); /// Creates an instance from JSON. factory ProposalOpenContract.fromJson(Map json) => @@ -612,6 +579,7 @@ class ProposalOpenContract extends ProposalOpenContractModel { : AuditDetails.fromJson(json['audit_details']), barrier: json['barrier'], barrierCount: getDouble(json['barrier_count']), + barrierSpotDistance: json['barrier_spot_distance'], bidPrice: getDouble(json['bid_price']), buyPrice: getDouble(json['buy_price']), cancellation: json['cancellation'] == null @@ -624,11 +592,14 @@ class ProposalOpenContract extends ProposalOpenContractModel { currency: json['currency'], currentSpot: getDouble(json['current_spot']), currentSpotDisplayValue: json['current_spot_display_value'], + currentSpotHighBarrier: json['current_spot_high_barrier'], + currentSpotLowBarrier: json['current_spot_low_barrier'], currentSpotTime: getDateTime(json['current_spot_time']), dateExpiry: getDateTime(json['date_expiry']), dateSettlement: getDateTime(json['date_settlement']), dateStart: getDateTime(json['date_start']), displayName: json['display_name'], + displayNumberOfContracts: json['display_number_of_contracts'], displayValue: json['display_value'], entrySpot: getDouble(json['entry_spot']), entrySpotDisplayValue: json['entry_spot_display_value'], @@ -656,10 +627,12 @@ class ProposalOpenContract extends ProposalOpenContractModel { longcode: json['longcode'], lowBarrier: json['low_barrier'], multiplier: getDouble(json['multiplier']), + numberOfContracts: getDouble(json['number_of_contracts']), payout: getDouble(json['payout']), profit: getDouble(json['profit']), profitPercentage: getDouble(json['profit_percentage']), purchaseTime: getDateTime(json['purchase_time']), + resetBarrier: json['reset_barrier'], resetTime: getDateTime(json['reset_time']), sellPrice: getDouble(json['sell_price']), sellSpot: getDouble(json['sell_spot']), @@ -683,6 +656,7 @@ class ProposalOpenContract extends ProposalOpenContractModel { : TransactionIds.fromJson(json['transaction_ids']), underlying: json['underlying'], validationError: json['validation_error'], + validationErrorCode: json['validation_error_code'], ); /// Converts an instance to JSON. @@ -695,6 +669,7 @@ class ProposalOpenContract extends ProposalOpenContractModel { } resultMap['barrier'] = barrier; resultMap['barrier_count'] = barrierCount; + resultMap['barrier_spot_distance'] = barrierSpotDistance; resultMap['bid_price'] = bidPrice; resultMap['buy_price'] = buyPrice; if (cancellation != null) { @@ -707,12 +682,15 @@ class ProposalOpenContract extends ProposalOpenContractModel { resultMap['currency'] = currency; resultMap['current_spot'] = currentSpot; resultMap['current_spot_display_value'] = currentSpotDisplayValue; + resultMap['current_spot_high_barrier'] = currentSpotHighBarrier; + resultMap['current_spot_low_barrier'] = currentSpotLowBarrier; resultMap['current_spot_time'] = getSecondsSinceEpochDateTime(currentSpotTime); resultMap['date_expiry'] = getSecondsSinceEpochDateTime(dateExpiry); resultMap['date_settlement'] = getSecondsSinceEpochDateTime(dateSettlement); resultMap['date_start'] = getSecondsSinceEpochDateTime(dateStart); resultMap['display_name'] = displayName; + resultMap['display_number_of_contracts'] = displayNumberOfContracts; resultMap['display_value'] = displayValue; resultMap['entry_spot'] = entrySpot; resultMap['entry_spot_display_value'] = entrySpotDisplayValue; @@ -740,10 +718,12 @@ class ProposalOpenContract extends ProposalOpenContractModel { resultMap['longcode'] = longcode; resultMap['low_barrier'] = lowBarrier; resultMap['multiplier'] = multiplier; + resultMap['number_of_contracts'] = numberOfContracts; resultMap['payout'] = payout; resultMap['profit'] = profit; resultMap['profit_percentage'] = profitPercentage; resultMap['purchase_time'] = getSecondsSinceEpochDateTime(purchaseTime); + resultMap['reset_barrier'] = resetBarrier; resultMap['reset_time'] = getSecondsSinceEpochDateTime(resetTime); resultMap['sell_price'] = sellPrice; resultMap['sell_spot'] = sellSpot; @@ -769,6 +749,7 @@ class ProposalOpenContract extends ProposalOpenContractModel { } resultMap['underlying'] = underlying; resultMap['validation_error'] = validationError; + resultMap['validation_error_code'] = validationErrorCode; return resultMap; } @@ -779,6 +760,7 @@ class ProposalOpenContract extends ProposalOpenContractModel { AuditDetails? auditDetails, String? barrier, double? barrierCount, + String? barrierSpotDistance, double? bidPrice, double? buyPrice, Cancellation? cancellation, @@ -789,11 +771,14 @@ class ProposalOpenContract extends ProposalOpenContractModel { String? currency, double? currentSpot, String? currentSpotDisplayValue, + String? currentSpotHighBarrier, + String? currentSpotLowBarrier, DateTime? currentSpotTime, DateTime? dateExpiry, DateTime? dateSettlement, DateTime? dateStart, String? displayName, + String? displayNumberOfContracts, String? displayValue, double? entrySpot, String? entrySpotDisplayValue, @@ -819,10 +804,12 @@ class ProposalOpenContract extends ProposalOpenContractModel { String? longcode, String? lowBarrier, double? multiplier, + double? numberOfContracts, double? payout, double? profit, double? profitPercentage, DateTime? purchaseTime, + String? resetBarrier, DateTime? resetTime, double? sellPrice, double? sellSpot, @@ -837,12 +824,14 @@ class ProposalOpenContract extends ProposalOpenContractModel { TransactionIds? transactionIds, String? underlying, String? validationError, + String? validationErrorCode, }) => ProposalOpenContract( accountId: accountId ?? this.accountId, auditDetails: auditDetails ?? this.auditDetails, barrier: barrier ?? this.barrier, barrierCount: barrierCount ?? this.barrierCount, + barrierSpotDistance: barrierSpotDistance ?? this.barrierSpotDistance, bidPrice: bidPrice ?? this.bidPrice, buyPrice: buyPrice ?? this.buyPrice, cancellation: cancellation ?? this.cancellation, @@ -854,11 +843,17 @@ class ProposalOpenContract extends ProposalOpenContractModel { currentSpot: currentSpot ?? this.currentSpot, currentSpotDisplayValue: currentSpotDisplayValue ?? this.currentSpotDisplayValue, + currentSpotHighBarrier: + currentSpotHighBarrier ?? this.currentSpotHighBarrier, + currentSpotLowBarrier: + currentSpotLowBarrier ?? this.currentSpotLowBarrier, currentSpotTime: currentSpotTime ?? this.currentSpotTime, dateExpiry: dateExpiry ?? this.dateExpiry, dateSettlement: dateSettlement ?? this.dateSettlement, dateStart: dateStart ?? this.dateStart, displayName: displayName ?? this.displayName, + displayNumberOfContracts: + displayNumberOfContracts ?? this.displayNumberOfContracts, displayValue: displayValue ?? this.displayValue, entrySpot: entrySpot ?? this.entrySpot, entrySpotDisplayValue: @@ -886,10 +881,12 @@ class ProposalOpenContract extends ProposalOpenContractModel { longcode: longcode ?? this.longcode, lowBarrier: lowBarrier ?? this.lowBarrier, multiplier: multiplier ?? this.multiplier, + numberOfContracts: numberOfContracts ?? this.numberOfContracts, payout: payout ?? this.payout, profit: profit ?? this.profit, profitPercentage: profitPercentage ?? this.profitPercentage, purchaseTime: purchaseTime ?? this.purchaseTime, + resetBarrier: resetBarrier ?? this.resetBarrier, resetTime: resetTime ?? this.resetTime, sellPrice: sellPrice ?? this.sellPrice, sellSpot: sellSpot ?? this.sellSpot, @@ -904,9 +901,9 @@ class ProposalOpenContract extends ProposalOpenContractModel { transactionIds: transactionIds ?? this.transactionIds, underlying: underlying ?? this.underlying, validationError: validationError ?? this.validationError, + validationErrorCode: validationErrorCode ?? this.validationErrorCode, ); } - /// Audit details model class. abstract class AuditDetailsModel { /// Initializes Audit details model class . @@ -930,14 +927,10 @@ abstract class AuditDetailsModel { class AuditDetails extends AuditDetailsModel { /// Initializes Audit details class. const AuditDetails({ - List? allTicks, - List? contractEnd, - List? contractStart, - }) : super( - allTicks: allTicks, - contractEnd: contractEnd, - contractStart: contractStart, - ); + super.allTicks, + super.contractEnd, + super.contractStart, + }); /// Creates an instance from JSON. factory AuditDetails.fromJson(Map json) => AuditDetails( @@ -1005,7 +998,6 @@ class AuditDetails extends AuditDetailsModel { contractStart: contractStart ?? this.contractStart, ); } - /// All ticks item model class. abstract class AllTicksItemModel { /// Initializes All ticks item model class . @@ -1037,18 +1029,12 @@ abstract class AllTicksItemModel { class AllTicksItem extends AllTicksItemModel { /// Initializes All ticks item class. const AllTicksItem({ - DateTime? epoch, - String? flag, - String? name, - double? tick, - String? tickDisplayValue, - }) : super( - epoch: epoch, - flag: flag, - name: name, - tick: tick, - tickDisplayValue: tickDisplayValue, - ); + super.epoch, + super.flag, + super.name, + super.tick, + super.tickDisplayValue, + }); /// Creates an instance from JSON. factory AllTicksItem.fromJson(Map json) => AllTicksItem( @@ -1088,7 +1074,6 @@ class AllTicksItem extends AllTicksItemModel { tickDisplayValue: tickDisplayValue ?? this.tickDisplayValue, ); } - /// Contract end item model class. abstract class ContractEndItemModel { /// Initializes Contract end item model class . @@ -1120,18 +1105,12 @@ abstract class ContractEndItemModel { class ContractEndItem extends ContractEndItemModel { /// Initializes Contract end item class. const ContractEndItem({ - DateTime? epoch, - String? flag, - String? name, - double? tick, - String? tickDisplayValue, - }) : super( - epoch: epoch, - flag: flag, - name: name, - tick: tick, - tickDisplayValue: tickDisplayValue, - ); + super.epoch, + super.flag, + super.name, + super.tick, + super.tickDisplayValue, + }); /// Creates an instance from JSON. factory ContractEndItem.fromJson(Map json) => @@ -1172,7 +1151,6 @@ class ContractEndItem extends ContractEndItemModel { tickDisplayValue: tickDisplayValue ?? this.tickDisplayValue, ); } - /// Contract start item model class. abstract class ContractStartItemModel { /// Initializes Contract start item model class . @@ -1204,18 +1182,12 @@ abstract class ContractStartItemModel { class ContractStartItem extends ContractStartItemModel { /// Initializes Contract start item class. const ContractStartItem({ - DateTime? epoch, - String? flag, - String? name, - double? tick, - String? tickDisplayValue, - }) : super( - epoch: epoch, - flag: flag, - name: name, - tick: tick, - tickDisplayValue: tickDisplayValue, - ); + super.epoch, + super.flag, + super.name, + super.tick, + super.tickDisplayValue, + }); /// Creates an instance from JSON. factory ContractStartItem.fromJson(Map json) => @@ -1256,7 +1228,6 @@ class ContractStartItem extends ContractStartItemModel { tickDisplayValue: tickDisplayValue ?? this.tickDisplayValue, ); } - /// Cancellation model class. abstract class CancellationModel extends Equatable { /// Initializes Cancellation model class . @@ -1276,12 +1247,9 @@ abstract class CancellationModel extends Equatable { class Cancellation extends CancellationModel { /// Initializes Cancellation class. const Cancellation({ - double? askPrice, - DateTime? dateExpiry, - }) : super( - askPrice: askPrice, - dateExpiry: dateExpiry, - ); + super.askPrice, + super.dateExpiry, + }); /// Creates an instance from JSON. factory Cancellation.fromJson(Map json) => Cancellation( @@ -1316,7 +1284,6 @@ class Cancellation extends CancellationModel { dateExpiry, ]; } - /// Limit order model class. abstract class LimitOrderModel extends Equatable { /// Initializes Limit order model class . @@ -1340,14 +1307,10 @@ abstract class LimitOrderModel extends Equatable { class LimitOrder extends LimitOrderModel { /// Initializes Limit order class. const LimitOrder({ - StopLoss? stopLoss, - StopOut? stopOut, - TakeProfit? takeProfit, - }) : super( - stopLoss: stopLoss, - stopOut: stopOut, - takeProfit: takeProfit, - ); + super.stopLoss, + super.stopOut, + super.takeProfit, + }); /// Creates an instance from JSON. factory LimitOrder.fromJson(Map json) => LimitOrder( @@ -1399,7 +1362,6 @@ class LimitOrder extends LimitOrderModel { takeProfit, ]; } - /// Stop loss model class. abstract class StopLossModel extends Equatable { /// Initializes Stop loss model class . @@ -1427,16 +1389,11 @@ abstract class StopLossModel extends Equatable { class StopLoss extends StopLossModel { /// Initializes Stop loss class. const StopLoss({ - String? displayName, - double? orderAmount, - DateTime? orderDate, - String? value, - }) : super( - displayName: displayName, - orderAmount: orderAmount, - orderDate: orderDate, - value: value, - ); + super.displayName, + super.orderAmount, + super.orderDate, + super.value, + }); /// Creates an instance from JSON. factory StopLoss.fromJson(Map json) => StopLoss( @@ -1479,7 +1436,6 @@ class StopLoss extends StopLossModel { orderAmount, ]; } - /// Stop out model class. abstract class StopOutModel extends Equatable { /// Initializes Stop out model class . @@ -1507,16 +1463,11 @@ abstract class StopOutModel extends Equatable { class StopOut extends StopOutModel { /// Initializes Stop out class. const StopOut({ - String? displayName, - double? orderAmount, - DateTime? orderDate, - String? value, - }) : super( - displayName: displayName, - orderAmount: orderAmount, - orderDate: orderDate, - value: value, - ); + super.displayName, + super.orderAmount, + super.orderDate, + super.value, + }); /// Creates an instance from JSON. factory StopOut.fromJson(Map json) => StopOut( @@ -1559,7 +1510,6 @@ class StopOut extends StopOutModel { orderAmount, ]; } - /// Take profit model class. abstract class TakeProfitModel extends Equatable { /// Initializes Take profit model class . @@ -1587,16 +1537,11 @@ abstract class TakeProfitModel extends Equatable { class TakeProfit extends TakeProfitModel { /// Initializes Take profit class. const TakeProfit({ - String? displayName, - double? orderAmount, - DateTime? orderDate, - String? value, - }) : super( - displayName: displayName, - orderAmount: orderAmount, - orderDate: orderDate, - value: value, - ); + super.displayName, + super.orderAmount, + super.orderDate, + super.value, + }); /// Creates an instance from JSON. factory TakeProfit.fromJson(Map json) => TakeProfit( @@ -1639,7 +1584,6 @@ class TakeProfit extends TakeProfitModel { orderAmount, ]; } - /// Tick stream item model class. abstract class TickStreamItemModel { /// Initializes Tick stream item model class . @@ -1663,14 +1607,10 @@ abstract class TickStreamItemModel { class TickStreamItem extends TickStreamItemModel { /// Initializes Tick stream item class. const TickStreamItem({ - DateTime? epoch, - double? tick, - String? tickDisplayValue, - }) : super( - epoch: epoch, - tick: tick, - tickDisplayValue: tickDisplayValue, - ); + super.epoch, + super.tick, + super.tickDisplayValue, + }); /// Creates an instance from JSON. factory TickStreamItem.fromJson(Map json) => TickStreamItem( @@ -1702,7 +1642,6 @@ class TickStreamItem extends TickStreamItemModel { tickDisplayValue: tickDisplayValue ?? this.tickDisplayValue, ); } - /// Transaction ids model class. abstract class TransactionIdsModel { /// Initializes Transaction ids model class . @@ -1722,12 +1661,9 @@ abstract class TransactionIdsModel { class TransactionIds extends TransactionIdsModel { /// Initializes Transaction ids class. const TransactionIds({ - int? buy, - int? sell, - }) : super( - buy: buy, - sell: sell, - ); + super.buy, + super.sell, + }); /// Creates an instance from JSON. factory TransactionIds.fromJson(Map json) => TransactionIds( @@ -1755,7 +1691,6 @@ class TransactionIds extends TransactionIdsModel { sell: sell ?? this.sell, ); } - /// Subscription model class. abstract class SubscriptionModel { /// Initializes Subscription model class . @@ -1771,10 +1706,8 @@ abstract class SubscriptionModel { class Subscription extends SubscriptionModel { /// Initializes Subscription class. const Subscription({ - required String id, - }) : super( - id: id, - ); + required super.id, + }); /// Creates an instance from JSON. factory Subscription.fromJson(Map json) => Subscription( diff --git a/lib/api/response/proposal_response_result.dart b/lib/api/response/proposal_response_result.dart index 00df4fd869..37124d8d5d 100644 --- a/lib/api/response/proposal_response_result.dart +++ b/lib/api/response/proposal_response_result.dart @@ -1,8 +1,9 @@ // ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import import 'package:equatable/equatable.dart'; -import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/api/models/enums.dart'; import 'package:flutter_deriv_api/api/response/buy_response_result.dart'; import 'package:flutter_deriv_api/api/response/forget_all_response_result.dart'; @@ -38,12 +39,9 @@ abstract class ProposalResponseModel { class ProposalResponse extends ProposalResponseModel { /// Initializes Proposal response class. const ProposalResponse({ - Proposal? proposal, - Subscription? subscription, - }) : super( - proposal: proposal, - subscription: subscription, - ); + super.proposal, + super.subscription, + }); /// Creates an instance from JSON. factory ProposalResponse.fromJson( @@ -181,7 +179,6 @@ class ProposalResponse extends ProposalResponseModel { subscription: subscription ?? this.subscription, ); } - /// Proposal model class. abstract class ProposalModel extends Equatable { /// Initializes Proposal model class . @@ -199,6 +196,7 @@ abstract class ProposalModel extends Equatable { this.commission, this.contractDetails, this.dateExpiry, + this.displayNumberOfContracts, this.limitOrder, this.maxStake, this.minStake, @@ -239,25 +237,28 @@ abstract class ProposalModel extends Equatable { /// Commission changed in percentage (%). final double? commission; - /// Contains contract information. (Only applicable for accumulator). + /// Contains contract information. final ContractDetails? contractDetails; /// The end date of the contract. final DateTime? dateExpiry; + /// [Only for vanilla or turbos options] The implied number of contracts + final String? displayNumberOfContracts; + /// Contains limit order information. (Only applicable for contract with limit order). final LimitOrder? limitOrder; - /// [Only for vanilla options] Maximum stakes allowed + /// [Only for vanilla or turbos options] Maximum stakes allowed final double? maxStake; - /// [Only for vanilla options] Minimum stakes allowed + /// [Only for vanilla or turbos options] Minimum stakes allowed final double? minStake; /// [Only for lookback trades] Multiplier applies when calculating the final payoff for each type of lookback. e.g. (Exit spot - Lowest historical price) * multiplier = Payout final double? multiplier; - /// [Only for vanilla options] The implied number of contracts + /// [Only for vanilla or turbos options] The implied number of contracts final double? numberOfContracts; } @@ -265,44 +266,26 @@ abstract class ProposalModel extends Equatable { class Proposal extends ProposalModel { /// Initializes Proposal class. const Proposal({ - required double askPrice, - required DateTime dateStart, - required String displayValue, - required String id, - required String longcode, - required double payout, - required double spot, - required DateTime spotTime, - List? barrierChoices, - Cancellation? cancellation, - double? commission, - ContractDetails? contractDetails, - DateTime? dateExpiry, - LimitOrder? limitOrder, - double? maxStake, - double? minStake, - double? multiplier, - double? numberOfContracts, - }) : super( - askPrice: askPrice, - dateStart: dateStart, - displayValue: displayValue, - id: id, - longcode: longcode, - payout: payout, - spot: spot, - spotTime: spotTime, - barrierChoices: barrierChoices, - cancellation: cancellation, - commission: commission, - contractDetails: contractDetails, - dateExpiry: dateExpiry, - limitOrder: limitOrder, - maxStake: maxStake, - minStake: minStake, - multiplier: multiplier, - numberOfContracts: numberOfContracts, - ); + required super.askPrice, + required super.dateStart, + required super.displayValue, + required super.id, + required super.longcode, + required super.payout, + required super.spot, + required super.spotTime, + super.barrierChoices, + super.cancellation, + super.commission, + super.contractDetails, + super.dateExpiry, + super.displayNumberOfContracts, + super.limitOrder, + super.maxStake, + super.minStake, + super.multiplier, + super.numberOfContracts, + }); /// Creates an instance from JSON. factory Proposal.fromJson(Map json) => Proposal( @@ -329,6 +312,7 @@ class Proposal extends ProposalModel { ? null : ContractDetails.fromJson(json['contract_details']), dateExpiry: getDateTime(json['date_expiry']), + displayNumberOfContracts: json['display_number_of_contracts'], limitOrder: json['limit_order'] == null ? null : LimitOrder.fromJson(json['limit_order']), @@ -365,6 +349,7 @@ class Proposal extends ProposalModel { resultMap['contract_details'] = contractDetails!.toJson(); } resultMap['date_expiry'] = getSecondsSinceEpochDateTime(dateExpiry); + resultMap['display_number_of_contracts'] = displayNumberOfContracts; if (limitOrder != null) { resultMap['limit_order'] = limitOrder!.toJson(); } @@ -391,6 +376,7 @@ class Proposal extends ProposalModel { double? commission, ContractDetails? contractDetails, DateTime? dateExpiry, + String? displayNumberOfContracts, LimitOrder? limitOrder, double? maxStake, double? minStake, @@ -411,6 +397,8 @@ class Proposal extends ProposalModel { commission: commission ?? this.commission, contractDetails: contractDetails ?? this.contractDetails, dateExpiry: dateExpiry ?? this.dateExpiry, + displayNumberOfContracts: + displayNumberOfContracts ?? this.displayNumberOfContracts, limitOrder: limitOrder ?? this.limitOrder, maxStake: maxStake ?? this.maxStake, minStake: minStake ?? this.minStake, @@ -430,7 +418,6 @@ class Proposal extends ProposalModel { limitOrder, ]; } - /// Cancellation model class. abstract class CancellationModel extends Equatable { /// Initializes Cancellation model class . @@ -450,12 +437,9 @@ abstract class CancellationModel extends Equatable { class Cancellation extends CancellationModel { /// Initializes Cancellation class. const Cancellation({ - double? askPrice, - DateTime? dateExpiry, - }) : super( - askPrice: askPrice, - dateExpiry: dateExpiry, - ); + super.askPrice, + super.dateExpiry, + }); /// Creates an instance from JSON. factory Cancellation.fromJson(Map json) => Cancellation( @@ -490,11 +474,12 @@ class Cancellation extends CancellationModel { dateExpiry, ]; } - /// Contract details model class. abstract class ContractDetailsModel { /// Initializes Contract details model class . const ContractDetailsModel({ + this.barrier, + this.barrierSpotDistance, this.highBarrier, this.lastTickEpoch, this.lowBarrier, @@ -504,6 +489,12 @@ abstract class ContractDetailsModel { this.ticksStayedIn, }); + /// Barrier of the contract. + final String? barrier; + + /// Absolute difference between high/low barrier and spot + final String? barrierSpotDistance; + /// High barrier calculated based on current spot final String? highBarrier; @@ -530,26 +521,22 @@ abstract class ContractDetailsModel { class ContractDetails extends ContractDetailsModel { /// Initializes Contract details class. const ContractDetails({ - String? highBarrier, - DateTime? lastTickEpoch, - String? lowBarrier, - double? maximumPayout, - int? maximumTicks, - double? tickSizeBarrier, - List? ticksStayedIn, - }) : super( - highBarrier: highBarrier, - lastTickEpoch: lastTickEpoch, - lowBarrier: lowBarrier, - maximumPayout: maximumPayout, - maximumTicks: maximumTicks, - tickSizeBarrier: tickSizeBarrier, - ticksStayedIn: ticksStayedIn, - ); + super.barrier, + super.barrierSpotDistance, + super.highBarrier, + super.lastTickEpoch, + super.lowBarrier, + super.maximumPayout, + super.maximumTicks, + super.tickSizeBarrier, + super.ticksStayedIn, + }); /// Creates an instance from JSON. factory ContractDetails.fromJson(Map json) => ContractDetails( + barrier: json['barrier'], + barrierSpotDistance: json['barrier_spot_distance'], highBarrier: json['high_barrier'], lastTickEpoch: getDateTime(json['last_tick_epoch']), lowBarrier: json['low_barrier'], @@ -569,6 +556,8 @@ class ContractDetails extends ContractDetailsModel { Map toJson() { final Map resultMap = {}; + resultMap['barrier'] = barrier; + resultMap['barrier_spot_distance'] = barrierSpotDistance; resultMap['high_barrier'] = highBarrier; resultMap['last_tick_epoch'] = getSecondsSinceEpochDateTime(lastTickEpoch); resultMap['low_barrier'] = lowBarrier; @@ -588,6 +577,8 @@ class ContractDetails extends ContractDetailsModel { /// Creates a copy of instance with given parameters. ContractDetails copyWith({ + String? barrier, + String? barrierSpotDistance, String? highBarrier, DateTime? lastTickEpoch, String? lowBarrier, @@ -597,6 +588,8 @@ class ContractDetails extends ContractDetailsModel { List? ticksStayedIn, }) => ContractDetails( + barrier: barrier ?? this.barrier, + barrierSpotDistance: barrierSpotDistance ?? this.barrierSpotDistance, highBarrier: highBarrier ?? this.highBarrier, lastTickEpoch: lastTickEpoch ?? this.lastTickEpoch, lowBarrier: lowBarrier ?? this.lowBarrier, @@ -606,7 +599,6 @@ class ContractDetails extends ContractDetailsModel { ticksStayedIn: ticksStayedIn ?? this.ticksStayedIn, ); } - /// Limit order model class. abstract class LimitOrderModel extends Equatable { /// Initializes Limit order model class . @@ -630,14 +622,10 @@ abstract class LimitOrderModel extends Equatable { class LimitOrder extends LimitOrderModel { /// Initializes Limit order class. const LimitOrder({ - StopLoss? stopLoss, - StopOut? stopOut, - TakeProfit? takeProfit, - }) : super( - stopLoss: stopLoss, - stopOut: stopOut, - takeProfit: takeProfit, - ); + super.stopLoss, + super.stopOut, + super.takeProfit, + }); /// Creates an instance from JSON. factory LimitOrder.fromJson(Map json) => LimitOrder( @@ -689,7 +677,6 @@ class LimitOrder extends LimitOrderModel { takeProfit, ]; } - /// Stop loss model class. abstract class StopLossModel extends Equatable { /// Initializes Stop loss model class . @@ -717,16 +704,11 @@ abstract class StopLossModel extends Equatable { class StopLoss extends StopLossModel { /// Initializes Stop loss class. const StopLoss({ - String? displayName, - double? orderAmount, - DateTime? orderDate, - String? value, - }) : super( - displayName: displayName, - orderAmount: orderAmount, - orderDate: orderDate, - value: value, - ); + super.displayName, + super.orderAmount, + super.orderDate, + super.value, + }); /// Creates an instance from JSON. factory StopLoss.fromJson(Map json) => StopLoss( @@ -769,7 +751,6 @@ class StopLoss extends StopLossModel { orderAmount, ]; } - /// Stop out model class. abstract class StopOutModel extends Equatable { /// Initializes Stop out model class . @@ -797,16 +778,11 @@ abstract class StopOutModel extends Equatable { class StopOut extends StopOutModel { /// Initializes Stop out class. const StopOut({ - String? displayName, - double? orderAmount, - DateTime? orderDate, - String? value, - }) : super( - displayName: displayName, - orderAmount: orderAmount, - orderDate: orderDate, - value: value, - ); + super.displayName, + super.orderAmount, + super.orderDate, + super.value, + }); /// Creates an instance from JSON. factory StopOut.fromJson(Map json) => StopOut( @@ -849,7 +825,6 @@ class StopOut extends StopOutModel { orderAmount, ]; } - /// Take profit model class. abstract class TakeProfitModel extends Equatable { /// Initializes Take profit model class . @@ -877,16 +852,11 @@ abstract class TakeProfitModel extends Equatable { class TakeProfit extends TakeProfitModel { /// Initializes Take profit class. const TakeProfit({ - String? displayName, - double? orderAmount, - DateTime? orderDate, - String? value, - }) : super( - displayName: displayName, - orderAmount: orderAmount, - orderDate: orderDate, - value: value, - ); + super.displayName, + super.orderAmount, + super.orderDate, + super.value, + }); /// Creates an instance from JSON. factory TakeProfit.fromJson(Map json) => TakeProfit( @@ -929,7 +899,6 @@ class TakeProfit extends TakeProfitModel { orderAmount, ]; } - /// Subscription model class. abstract class SubscriptionModel { /// Initializes Subscription model class . @@ -945,10 +914,8 @@ abstract class SubscriptionModel { class Subscription extends SubscriptionModel { /// Initializes Subscription class. const Subscription({ - required String id, - }) : super( - id: id, - ); + required super.id, + }); /// Creates an instance from JSON. factory Subscription.fromJson(Map json) => Subscription( diff --git a/lib/basic_api/generated/methods/proposal_receive_methods.json b/lib/basic_api/generated/methods/proposal_receive_methods.json index 1e05eb285e..37ce13363b 100644 --- a/lib/basic_api/generated/methods/proposal_receive_methods.json +++ b/lib/basic_api/generated/methods/proposal_receive_methods.json @@ -1,4 +1,4 @@ { "methods": " static final BaseAPI _api = Injector()();\n\n /// Gets the price proposal for contract\n ///\n /// For parameters information refer to [ProposalRequest]\n /// Throws a [BaseAPIException] if API response contains an error\n static Future fetchPriceForContract(\n ProposalRequest request,\n ) async {\n final ProposalReceive response = await _api.call(request: request);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ProposalResponse.fromJson(response.proposal, response.subscription);\n }\n\n /// Gets the price proposal for contract.\n ///\n /// For parameters information refer to [ProposalRequest]\n /// Throws a [BaseAPIException] if API response contains an error\n static Stream subscribePriceForContract(\n ProposalRequest request, {\n RequestCompareFunction? comparePredicate,\n }) =>\n _api\n .subscribe(request: request, comparePredicate: comparePredicate)!\n .map(\n (Response response) {\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(\n baseExceptionModel: baseExceptionModel),\n );\n\n return response is ProposalReceive\n ? ProposalResponse.fromJson(\n response.proposal,\n response.subscription,\n )\n : null;\n },\n );\n\n /// Unsubscribes from price proposal subscription.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future unsubscribeProposal() async {\n if (subscription == null) {\n return null;\n }\n\n final ForgetReceive response =\n await _api.unsubscribe(subscriptionId: subscription!.id);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetResponse.fromJson(response.forget);\n }\n\n /// Unsubscribes all proposal subscriptions.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n static Future unsubscribeAllProposal() async {\n final ForgetAllReceive response =\n await _api.unsubscribeAll(method: ForgetStreamType.proposal);\n\n checkException(\n response: response,\n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>\n BaseAPIException(baseExceptionModel: baseExceptionModel),\n );\n\n return ForgetAllResponse.fromJson(response.forgetAll);\n }\n\n /// Buys this proposal contract with [price] specified.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Future buy({double? price}) => BuyResponse.buyMethod(BuyRequest(\n buy: proposal?.id,\n price: price ?? proposal?.askPrice,\n ));\n\n /// Buys this proposal contract with [price] specified and subscribes to it.\n ///\n /// Throws a [BaseAPIException] if API response contains an error\n Stream buyAndSubscribe({double? price}) =>\n BuyResponse.buyAndSubscribe(BuyRequest(\n buy: proposal?.id,\n price: price ?? proposal?.askPrice,\n ));", - "imports": "import 'package:flutter_deriv_api/api/exceptions/contract_operations_exception.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/buy_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/proposal_open_contract_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/buy_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/proposal_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/proposal_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" + "imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/api/models/enums.dart';\nimport 'package:flutter_deriv_api/api/response/buy_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_all_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/forget_response_result.dart';\nimport 'package:flutter_deriv_api/api/response/proposal_open_contract_response_result.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/buy_send.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/proposal_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/proposal_send.dart';\nimport 'package:flutter_deriv_api/basic_api/response.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n" } diff --git a/lib/basic_api/generated/proposal_open_contract_receive.dart b/lib/basic_api/generated/proposal_open_contract_receive.dart index 7f7acba998..8ec54eb880 100644 --- a/lib/basic_api/generated/proposal_open_contract_receive.dart +++ b/lib/basic_api/generated/proposal_open_contract_receive.dart @@ -10,16 +10,11 @@ class ProposalOpenContractReceive extends Response { const ProposalOpenContractReceive({ this.proposalOpenContract, this.subscription, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory ProposalOpenContractReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/proposal_open_contract_send.dart b/lib/basic_api/generated/proposal_open_contract_send.dart index 0b38b4afae..e7731bc4fc 100644 --- a/lib/basic_api/generated/proposal_open_contract_send.dart +++ b/lib/basic_api/generated/proposal_open_contract_send.dart @@ -9,20 +9,19 @@ class ProposalOpenContractRequest extends Request { /// Initialize ProposalOpenContractRequest. const ProposalOpenContractRequest({ this.contractId, + this.loginid, this.proposalOpenContract = true, this.subscribe, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'proposal_open_contract', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'proposal_open_contract', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory ProposalOpenContractRequest.fromJson(Map json) => ProposalOpenContractRequest( contractId: json['contract_id'] as int?, + loginid: json['loginid'] as String?, proposalOpenContract: json['proposal_open_contract'] == null ? null : json['proposal_open_contract'] == 1, @@ -34,6 +33,9 @@ class ProposalOpenContractRequest extends Request { /// [Optional] Contract ID received from a `portfolio` request. If not set, you will receive stream of all open contracts. final int? contractId; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? proposalOpenContract; @@ -44,6 +46,7 @@ class ProposalOpenContractRequest extends Request { @override Map toJson() => { 'contract_id': contractId, + 'loginid': loginid, 'proposal_open_contract': proposalOpenContract == null ? null : proposalOpenContract! @@ -62,6 +65,7 @@ class ProposalOpenContractRequest extends Request { @override ProposalOpenContractRequest copyWith({ int? contractId, + String? loginid, bool? proposalOpenContract, bool? subscribe, Map? passthrough, @@ -69,6 +73,7 @@ class ProposalOpenContractRequest extends Request { }) => ProposalOpenContractRequest( contractId: contractId ?? this.contractId, + loginid: loginid ?? this.loginid, proposalOpenContract: proposalOpenContract ?? this.proposalOpenContract, subscribe: subscribe ?? this.subscribe, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/proposal_receive.dart b/lib/basic_api/generated/proposal_receive.dart index a7c2bb428c..906279649e 100644 --- a/lib/basic_api/generated/proposal_receive.dart +++ b/lib/basic_api/generated/proposal_receive.dart @@ -10,16 +10,11 @@ class ProposalReceive extends Response { const ProposalReceive({ this.proposal, this.subscription, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory ProposalReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/proposal_send.dart b/lib/basic_api/generated/proposal_send.dart index 6d0de27ecb..ce91b2a5e2 100644 --- a/lib/basic_api/generated/proposal_send.dart +++ b/lib/basic_api/generated/proposal_send.dart @@ -22,6 +22,7 @@ class ProposalRequest extends Request { this.durationUnit, this.growthRate, required this.limitOrder, + this.loginid, this.multiplier, this.productType, this.proposal = true, @@ -29,13 +30,10 @@ class ProposalRequest extends Request { this.subscribe, required this.symbol, this.tradingPeriodStart, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'proposal', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'proposal', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory ProposalRequest.fromJson(Map json) => @@ -54,6 +52,7 @@ class ProposalRequest extends Request { durationUnit: json['duration_unit'] as String?, growthRate: json['growth_rate'] as num?, limitOrder: json['limit_order'] as Map?, + loginid: json['loginid'] as String?, multiplier: json['multiplier'] as num?, productType: json['product_type'] as String?, proposal: json['proposal'] == null ? null : json['proposal'] == 1, @@ -107,6 +106,9 @@ class ProposalRequest extends Request { /// Add an order to close the contract once the order condition is met (only for `MULTUP` and `MULTDOWN` and 'ACCU' contracts). Supported orders: `take_profit`, `stop_loss`. final Map? limitOrder; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] The multiplier for non-binary options. E.g. lookbacks. final num? multiplier; @@ -145,6 +147,7 @@ class ProposalRequest extends Request { 'duration_unit': durationUnit, 'growth_rate': growthRate, 'limit_order': limitOrder, + 'loginid': loginid, 'multiplier': multiplier, 'product_type': productType, 'proposal': proposal == null @@ -181,6 +184,7 @@ class ProposalRequest extends Request { String? durationUnit, num? growthRate, Map? limitOrder, + String? loginid, num? multiplier, String? productType, bool? proposal, @@ -206,6 +210,7 @@ class ProposalRequest extends Request { durationUnit: durationUnit ?? this.durationUnit, growthRate: growthRate ?? this.growthRate, limitOrder: limitOrder ?? this.limitOrder, + loginid: loginid ?? this.loginid, multiplier: multiplier ?? this.multiplier, productType: productType ?? this.productType, proposal: proposal ?? this.proposal, From 54ac3244bb8734f61f50501998ce719a7ad25ab3 Mon Sep 17 00:00:00 2001 From: Weng Lok <103249398+weng-deriv@users.noreply.github.com> Date: Wed, 6 Dec 2023 10:15:29 +0800 Subject: [PATCH 41/64] =?UTF-8?q?Updated=20p2p=20api=20send=20and=20receiv?= =?UTF-8?q?e=20requests=20for=20flexible=20order=20time=20sel=E2=80=A6=20(?= =?UTF-8?q?#286)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../p2p_advert_create_response_result.dart | 224 +++++++--------- .../p2p_advert_info_response_result.dart | 252 +++++++----------- .../p2p_advert_list_response_result.dart | 200 ++++++-------- .../p2p_advert_update_response_result.dart | 232 +++++++--------- ...2p_advertiser_adverts_response_result.dart | 192 ++++++------- .../generated/p2p_advert_create_send.dart | 32 ++- .../generated/p2p_advert_update_send.dart | 19 +- .../p2p/p2p_advert_create_response.dart | 2 + .../p2p/p2p_advert_list_response.dart | 4 + .../p2p/p2p_order_create_response.dart | 2 + test/api/p2p/p2p_advert/p2p_advert_test.dart | 9 +- 11 files changed, 493 insertions(+), 675 deletions(-) diff --git a/lib/api/response/p2p_advert_create_response_result.dart b/lib/api/response/p2p_advert_create_response_result.dart index 2c41b1b0b9..6cdd91498f 100644 --- a/lib/api/response/p2p_advert_create_response_result.dart +++ b/lib/api/response/p2p_advert_create_response_result.dart @@ -1,8 +1,8 @@ // ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import import 'package:equatable/equatable.dart'; -import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/api/exceptions/base_api_exception.dart'; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_receive.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_send.dart'; @@ -25,10 +25,8 @@ abstract class P2pAdvertCreateResponseModel { class P2pAdvertCreateResponse extends P2pAdvertCreateResponseModel { /// Initializes P2p advert create response class. const P2pAdvertCreateResponse({ - P2pAdvertCreate? p2pAdvertCreate, - }) : super( - p2pAdvertCreate: p2pAdvertCreate, - ); + super.p2pAdvertCreate, + }); /// Creates an instance from JSON. factory P2pAdvertCreateResponse.fromJson( @@ -185,6 +183,8 @@ final Map visibilityStatusItemEnumMapper = "advertiser_ads_paused": VisibilityStatusItemEnum.advertiserAdsPaused, "advertiser_approval": VisibilityStatusItemEnum.advertiserApproval, "advertiser_balance": VisibilityStatusItemEnum.advertiserBalance, + "advertiser_block_trade_ineligible": + VisibilityStatusItemEnum.advertiserBlockTradeIneligible, "advertiser_daily_limit": VisibilityStatusItemEnum.advertiserDailyLimit, "advertiser_temp_ban": VisibilityStatusItemEnum.advertiserTempBan, }; @@ -212,6 +212,9 @@ enum VisibilityStatusItemEnum { /// advertiser_balance. advertiserBalance, + /// advertiser_block_trade_ineligible. + advertiserBlockTradeIneligible, + /// advertiser_daily_limit. advertiserDailyLimit, @@ -229,6 +232,7 @@ abstract class P2pAdvertCreateModel { required this.rateType, required this.rateDisplay, required this.rate, + required this.orderExpiryPeriod, required this.minOrderAmountLimitDisplay, required this.minOrderAmountLimit, required this.minOrderAmountDisplay, @@ -245,6 +249,7 @@ abstract class P2pAdvertCreateModel { required this.createdTime, required this.country, required this.counterpartyType, + required this.blockTrade, required this.amountDisplay, required this.amount, required this.advertiserDetails, @@ -280,6 +285,9 @@ abstract class P2pAdvertCreateModel { /// Conversion rate from advertiser's account currency to `local_currency`. An absolute rate value (fixed), or percentage offset from current market rate (floating). final double rate; + /// Expiry period (seconds) for order created against this ad. + final int orderExpiryPeriod; + /// Minimum order amount at this time, in `account_currency`, formatted to appropriate decimal places. final String minOrderAmountLimitDisplay; @@ -328,6 +336,9 @@ abstract class P2pAdvertCreateModel { /// Type of transaction from the opposite party's perspective. final CounterpartyTypeEnum counterpartyType; + /// Indicates if this is block trade advert or not. + final bool blockTrade; + /// The total amount specified in advert, in `account_currency`, formatted to appropriate decimal places. final String amountDisplay; @@ -378,6 +389,7 @@ abstract class P2pAdvertCreateModel { /// - `advertiser_ads_paused`: the advertiser has paused all adverts. /// - `advertiser_approval`: the advertiser's proof of identity is not verified. /// - `advertiser_balance`: the advertiser's P2P balance is less than the minimum order. + /// - `advertiser_block_trade_ineligible`: the advertiser is not currently eligible for block trading. /// - `advertiser_daily_limit`: the advertiser's remaining daily limit is less than the minimum order. /// - `advertiser_temp_ban`: the advertiser is temporarily banned from P2P. final List? visibilityStatus; @@ -387,82 +399,46 @@ abstract class P2pAdvertCreateModel { class P2pAdvertCreate extends P2pAdvertCreateModel { /// Initializes P2p advert create class. const P2pAdvertCreate({ - required String accountCurrency, - required int activeOrders, - required AdvertiserDetails advertiserDetails, - required double amount, - required String amountDisplay, - required CounterpartyTypeEnum counterpartyType, - required String country, - required DateTime createdTime, - required String description, - required String id, - required bool isActive, - required bool isVisible, - required String localCurrency, - required double maxOrderAmount, - required String maxOrderAmountDisplay, - required double maxOrderAmountLimit, - required String maxOrderAmountLimitDisplay, - required double minOrderAmount, - required String minOrderAmountDisplay, - required double minOrderAmountLimit, - required String minOrderAmountLimitDisplay, - required double rate, - required String rateDisplay, - required RateTypeEnum rateType, - required double remainingAmount, - required String remainingAmountDisplay, - required P2pAdvertCreateTypeEnum type, - String? contactInfo, - double? effectiveRate, - String? effectiveRateDisplay, - String? paymentInfo, - String? paymentMethod, - Map? paymentMethodDetails, - List? paymentMethodNames, - double? price, - String? priceDisplay, - List? visibilityStatus, - }) : super( - accountCurrency: accountCurrency, - activeOrders: activeOrders, - advertiserDetails: advertiserDetails, - amount: amount, - amountDisplay: amountDisplay, - counterpartyType: counterpartyType, - country: country, - createdTime: createdTime, - description: description, - id: id, - isActive: isActive, - isVisible: isVisible, - localCurrency: localCurrency, - maxOrderAmount: maxOrderAmount, - maxOrderAmountDisplay: maxOrderAmountDisplay, - maxOrderAmountLimit: maxOrderAmountLimit, - maxOrderAmountLimitDisplay: maxOrderAmountLimitDisplay, - minOrderAmount: minOrderAmount, - minOrderAmountDisplay: minOrderAmountDisplay, - minOrderAmountLimit: minOrderAmountLimit, - minOrderAmountLimitDisplay: minOrderAmountLimitDisplay, - rate: rate, - rateDisplay: rateDisplay, - rateType: rateType, - remainingAmount: remainingAmount, - remainingAmountDisplay: remainingAmountDisplay, - type: type, - contactInfo: contactInfo, - effectiveRate: effectiveRate, - effectiveRateDisplay: effectiveRateDisplay, - paymentInfo: paymentInfo, - paymentMethod: paymentMethod, - paymentMethodDetails: paymentMethodDetails, - paymentMethodNames: paymentMethodNames, - price: price, - priceDisplay: priceDisplay, - visibilityStatus: visibilityStatus, - ); + required super.accountCurrency, + required super.activeOrders, + required super.advertiserDetails, + required super.amount, + required super.amountDisplay, + required super.blockTrade, + required super.counterpartyType, + required super.country, + required super.createdTime, + required super.description, + required super.id, + required super.isActive, + required super.isVisible, + required super.localCurrency, + required super.maxOrderAmount, + required super.maxOrderAmountDisplay, + required super.maxOrderAmountLimit, + required super.maxOrderAmountLimitDisplay, + required super.minOrderAmount, + required super.minOrderAmountDisplay, + required super.minOrderAmountLimit, + required super.minOrderAmountLimitDisplay, + required super.orderExpiryPeriod, + required super.rate, + required super.rateDisplay, + required super.rateType, + required super.remainingAmount, + required super.remainingAmountDisplay, + required super.type, + super.contactInfo, + super.effectiveRate, + super.effectiveRateDisplay, + super.paymentInfo, + super.paymentMethod, + super.paymentMethodDetails, + super.paymentMethodNames, + super.price, + super.priceDisplay, + super.visibilityStatus, + }); /// Creates an instance from JSON. factory P2pAdvertCreate.fromJson(Map json) => @@ -473,6 +449,7 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { AdvertiserDetails.fromJson(json['advertiser_details']), amount: getDouble(json['amount'])!, amountDisplay: json['amount_display'], + blockTrade: getBool(json['block_trade'])!, counterpartyType: counterpartyTypeEnumMapper[json['counterparty_type']]!, country: json['country'], @@ -490,6 +467,7 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { minOrderAmountDisplay: json['min_order_amount_display'], minOrderAmountLimit: getDouble(json['min_order_amount_limit'])!, minOrderAmountLimitDisplay: json['min_order_amount_limit_display'], + orderExpiryPeriod: json['order_expiry_period'], rate: getDouble(json['rate'])!, rateDisplay: json['rate_display'], rateType: rateTypeEnumMapper[json['rate_type']]!, @@ -542,6 +520,7 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { resultMap['amount'] = amount; resultMap['amount_display'] = amountDisplay; + resultMap['block_trade'] = blockTrade; resultMap['counterparty_type'] = counterpartyTypeEnumMapper.entries .firstWhere((MapEntry entry) => entry.value == counterpartyType) @@ -561,6 +540,7 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { resultMap['min_order_amount_display'] = minOrderAmountDisplay; resultMap['min_order_amount_limit'] = minOrderAmountLimit; resultMap['min_order_amount_limit_display'] = minOrderAmountLimitDisplay; + resultMap['order_expiry_period'] = orderExpiryPeriod; resultMap['rate'] = rate; resultMap['rate_display'] = rateDisplay; resultMap['rate_type'] = rateTypeEnumMapper.entries @@ -611,6 +591,7 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { AdvertiserDetails? advertiserDetails, double? amount, String? amountDisplay, + bool? blockTrade, CounterpartyTypeEnum? counterpartyType, String? country, DateTime? createdTime, @@ -627,6 +608,7 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { String? minOrderAmountDisplay, double? minOrderAmountLimit, String? minOrderAmountLimitDisplay, + int? orderExpiryPeriod, double? rate, String? rateDisplay, RateTypeEnum? rateType, @@ -650,6 +632,7 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { advertiserDetails: advertiserDetails ?? this.advertiserDetails, amount: amount ?? this.amount, amountDisplay: amountDisplay ?? this.amountDisplay, + blockTrade: blockTrade ?? this.blockTrade, counterpartyType: counterpartyType ?? this.counterpartyType, country: country ?? this.country, createdTime: createdTime ?? this.createdTime, @@ -670,6 +653,7 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { minOrderAmountLimit: minOrderAmountLimit ?? this.minOrderAmountLimit, minOrderAmountLimitDisplay: minOrderAmountLimitDisplay ?? this.minOrderAmountLimitDisplay, + orderExpiryPeriod: orderExpiryPeriod ?? this.orderExpiryPeriod, rate: rate ?? this.rate, rateDisplay: rateDisplay ?? this.rateDisplay, rateType: rateType ?? this.rateType, @@ -749,32 +733,19 @@ abstract class AdvertiserDetailsModel { class AdvertiserDetails extends AdvertiserDetailsModel { /// Initializes Advertiser details class. const AdvertiserDetails({ - required int completedOrdersCount, - required String id, - required bool isOnline, - required String name, - required int ratingCount, - String? firstName, - String? lastName, - DateTime? lastOnlineTime, - double? ratingAverage, - double? recommendedAverage, - int? recommendedCount, - double? totalCompletionRate, - }) : super( - completedOrdersCount: completedOrdersCount, - id: id, - isOnline: isOnline, - name: name, - ratingCount: ratingCount, - firstName: firstName, - lastName: lastName, - lastOnlineTime: lastOnlineTime, - ratingAverage: ratingAverage, - recommendedAverage: recommendedAverage, - recommendedCount: recommendedCount, - totalCompletionRate: totalCompletionRate, - ); + required super.completedOrdersCount, + required super.id, + required super.isOnline, + required super.name, + required super.ratingCount, + super.firstName, + super.lastName, + super.lastOnlineTime, + super.ratingAverage, + super.recommendedAverage, + super.recommendedCount, + super.totalCompletionRate, + }); /// Creates an instance from JSON. factory AdvertiserDetails.fromJson(Map json) => @@ -884,22 +855,14 @@ abstract class PaymentMethodDetailsPropertyModel { class PaymentMethodDetailsProperty extends PaymentMethodDetailsPropertyModel { /// Initializes Payment method details property class. const PaymentMethodDetailsProperty({ - required Map fields, - required bool isEnabled, - required String method, - required PaymentMethodDetailsPropertyTypeEnum type, - String? displayName, - List? usedByAdverts, - List? usedByOrders, - }) : super( - fields: fields, - isEnabled: isEnabled, - method: method, - type: type, - displayName: displayName, - usedByAdverts: usedByAdverts, - usedByOrders: usedByOrders, - ); + required super.fields, + required super.isEnabled, + required super.method, + required super.type, + super.displayName, + super.usedByAdverts, + super.usedByOrders, + }); /// Creates an instance from JSON. factory PaymentMethodDetailsProperty.fromJson(Map json) => @@ -1009,16 +972,11 @@ abstract class FieldsPropertyModel { class FieldsProperty extends FieldsPropertyModel { /// Initializes Fields property class. const FieldsProperty({ - required String displayName, - required int required, - required TypeEnum type, - required String value, - }) : super( - displayName: displayName, - required: required, - type: type, - value: value, - ); + required super.displayName, + required super.required, + required super.type, + required super.value, + }); /// Creates an instance from JSON. factory FieldsProperty.fromJson(Map json) => FieldsProperty( diff --git a/lib/api/response/p2p_advert_info_response_result.dart b/lib/api/response/p2p_advert_info_response_result.dart index 561bc9bb6e..eac7137470 100644 --- a/lib/api/response/p2p_advert_info_response_result.dart +++ b/lib/api/response/p2p_advert_info_response_result.dart @@ -17,7 +17,6 @@ import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_update_receive. import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_update_send.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_order_create_receive.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_order_create_send.dart'; - /// P2p advert info response model class. abstract class P2pAdvertInfoResponseModel { /// Initializes P2p advert info response model class . @@ -37,12 +36,9 @@ abstract class P2pAdvertInfoResponseModel { class P2pAdvertInfoResponse extends P2pAdvertInfoResponseModel { /// Initializes P2p advert info response class. const P2pAdvertInfoResponse({ - P2pAdvertInfo? p2pAdvertInfo, - Subscription? subscription, - }) : super( - p2pAdvertInfo: p2pAdvertInfo, - subscription: subscription, - ); + super.p2pAdvertInfo, + super.subscription, + }); /// Creates an instance from JSON. factory P2pAdvertInfoResponse.fromJson( @@ -317,6 +313,8 @@ final Map visibilityStatusItemEnumMapper = "advertiser_ads_paused": VisibilityStatusItemEnum.advertiserAdsPaused, "advertiser_approval": VisibilityStatusItemEnum.advertiserApproval, "advertiser_balance": VisibilityStatusItemEnum.advertiserBalance, + "advertiser_block_trade_ineligible": + VisibilityStatusItemEnum.advertiserBlockTradeIneligible, "advertiser_daily_limit": VisibilityStatusItemEnum.advertiserDailyLimit, "advertiser_temp_ban": VisibilityStatusItemEnum.advertiserTempBan, }; @@ -344,13 +342,15 @@ enum VisibilityStatusItemEnum { /// advertiser_balance. advertiserBalance, + /// advertiser_block_trade_ineligible. + advertiserBlockTradeIneligible, + /// advertiser_daily_limit. advertiserDailyLimit, /// advertiser_temp_ban. advertiserTempBan, } - /// P2p advert info model class. abstract class P2pAdvertInfoModel { /// Initializes P2p advert info model class . @@ -360,6 +360,7 @@ abstract class P2pAdvertInfoModel { this.advertiserDetails, this.amount, this.amountDisplay, + this.blockTrade, this.contactInfo, this.counterpartyType, this.country, @@ -381,6 +382,7 @@ abstract class P2pAdvertInfoModel { this.minOrderAmountDisplay, this.minOrderAmountLimit, this.minOrderAmountLimitDisplay, + this.orderExpiryPeriod, this.paymentInfo, this.paymentMethod, this.paymentMethodDetails, @@ -411,6 +413,9 @@ abstract class P2pAdvertInfoModel { /// The total amount specified in advert, in `account_currency`, formatted to appropriate decimal places. It is only visible to the advert owner. final String? amountDisplay; + /// Indicates if this is block trade advert or not. + final bool? blockTrade; + /// Advertiser contact information. Only applicable for 'sell adverts'. final String? contactInfo; @@ -474,6 +479,9 @@ abstract class P2pAdvertInfoModel { /// Minimum order amount at this time, in `account_currency`, formatted to appropriate decimal places. final String? minOrderAmountLimitDisplay; + /// Expiry period (seconds) for order created against this ad. + final int? orderExpiryPeriod; + /// Payment instructions. Only applicable for 'sell adverts'. final String? paymentInfo; @@ -518,6 +526,7 @@ abstract class P2pAdvertInfoModel { /// - `advertiser_ads_paused`: the advertiser has paused all adverts. /// - `advertiser_approval`: the advertiser's proof of identity is not verified. /// - `advertiser_balance`: the advertiser's P2P balance is less than the minimum order. + /// - `advertiser_block_trade_ineligible`: the advertiser is not currently eligible for block trading. /// - `advertiser_daily_limit`: the advertiser's remaining daily limit is less than the minimum order. /// - `advertiser_temp_ban`: the advertiser is temporarily banned from P2P. final List? visibilityStatus; @@ -527,86 +536,48 @@ abstract class P2pAdvertInfoModel { class P2pAdvertInfo extends P2pAdvertInfoModel { /// Initializes P2p advert info class. const P2pAdvertInfo({ - String? accountCurrency, - int? activeOrders, - AdvertiserDetails? advertiserDetails, - double? amount, - String? amountDisplay, - String? contactInfo, - CounterpartyTypeEnum? counterpartyType, - String? country, - DateTime? createdTime, - int? daysUntilArchive, - int? deleted, - String? description, - double? effectiveRate, - String? effectiveRateDisplay, - String? id, - bool? isActive, - bool? isVisible, - String? localCurrency, - double? maxOrderAmount, - String? maxOrderAmountDisplay, - double? maxOrderAmountLimit, - String? maxOrderAmountLimitDisplay, - double? minOrderAmount, - String? minOrderAmountDisplay, - double? minOrderAmountLimit, - String? minOrderAmountLimitDisplay, - String? paymentInfo, - String? paymentMethod, - Map? paymentMethodDetails, - List? paymentMethodNames, - double? price, - String? priceDisplay, - double? rate, - String? rateDisplay, - RateTypeEnum? rateType, - double? remainingAmount, - String? remainingAmountDisplay, - P2pAdvertInfoTypeEnum? type, - List? visibilityStatus, - }) : super( - accountCurrency: accountCurrency, - activeOrders: activeOrders, - advertiserDetails: advertiserDetails, - amount: amount, - amountDisplay: amountDisplay, - contactInfo: contactInfo, - counterpartyType: counterpartyType, - country: country, - createdTime: createdTime, - daysUntilArchive: daysUntilArchive, - deleted: deleted, - description: description, - effectiveRate: effectiveRate, - effectiveRateDisplay: effectiveRateDisplay, - id: id, - isActive: isActive, - isVisible: isVisible, - localCurrency: localCurrency, - maxOrderAmount: maxOrderAmount, - maxOrderAmountDisplay: maxOrderAmountDisplay, - maxOrderAmountLimit: maxOrderAmountLimit, - maxOrderAmountLimitDisplay: maxOrderAmountLimitDisplay, - minOrderAmount: minOrderAmount, - minOrderAmountDisplay: minOrderAmountDisplay, - minOrderAmountLimit: minOrderAmountLimit, - minOrderAmountLimitDisplay: minOrderAmountLimitDisplay, - paymentInfo: paymentInfo, - paymentMethod: paymentMethod, - paymentMethodDetails: paymentMethodDetails, - paymentMethodNames: paymentMethodNames, - price: price, - priceDisplay: priceDisplay, - rate: rate, - rateDisplay: rateDisplay, - rateType: rateType, - remainingAmount: remainingAmount, - remainingAmountDisplay: remainingAmountDisplay, - type: type, - visibilityStatus: visibilityStatus, - ); + super.accountCurrency, + super.activeOrders, + super.advertiserDetails, + super.amount, + super.amountDisplay, + super.blockTrade, + super.contactInfo, + super.counterpartyType, + super.country, + super.createdTime, + super.daysUntilArchive, + super.deleted, + super.description, + super.effectiveRate, + super.effectiveRateDisplay, + super.id, + super.isActive, + super.isVisible, + super.localCurrency, + super.maxOrderAmount, + super.maxOrderAmountDisplay, + super.maxOrderAmountLimit, + super.maxOrderAmountLimitDisplay, + super.minOrderAmount, + super.minOrderAmountDisplay, + super.minOrderAmountLimit, + super.minOrderAmountLimitDisplay, + super.orderExpiryPeriod, + super.paymentInfo, + super.paymentMethod, + super.paymentMethodDetails, + super.paymentMethodNames, + super.price, + super.priceDisplay, + super.rate, + super.rateDisplay, + super.rateType, + super.remainingAmount, + super.remainingAmountDisplay, + super.type, + super.visibilityStatus, + }); /// Creates an instance from JSON. factory P2pAdvertInfo.fromJson(Map json) => P2pAdvertInfo( @@ -617,6 +588,7 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { : AdvertiserDetails.fromJson(json['advertiser_details']), amount: getDouble(json['amount']), amountDisplay: json['amount_display'], + blockTrade: getBool(json['block_trade']), contactInfo: json['contact_info'], counterpartyType: json['counterparty_type'] == null ? null @@ -640,6 +612,7 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { minOrderAmountDisplay: json['min_order_amount_display'], minOrderAmountLimit: getDouble(json['min_order_amount_limit']), minOrderAmountLimitDisplay: json['min_order_amount_limit_display'], + orderExpiryPeriod: json['order_expiry_period'], paymentInfo: json['payment_info'], paymentMethod: json['payment_method'], paymentMethodDetails: json['payment_method_details'] == null @@ -694,6 +667,7 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { } resultMap['amount'] = amount; resultMap['amount_display'] = amountDisplay; + resultMap['block_trade'] = blockTrade; resultMap['contact_info'] = contactInfo; resultMap['counterparty_type'] = counterpartyTypeEnumMapper.entries .firstWhere((MapEntry entry) => @@ -718,6 +692,7 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { resultMap['min_order_amount_display'] = minOrderAmountDisplay; resultMap['min_order_amount_limit'] = minOrderAmountLimit; resultMap['min_order_amount_limit_display'] = minOrderAmountLimitDisplay; + resultMap['order_expiry_period'] = orderExpiryPeriod; resultMap['payment_info'] = paymentInfo; resultMap['payment_method'] = paymentMethod; resultMap['payment_method_details'] = paymentMethodDetails; @@ -765,6 +740,7 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { AdvertiserDetails? advertiserDetails, double? amount, String? amountDisplay, + bool? blockTrade, String? contactInfo, CounterpartyTypeEnum? counterpartyType, String? country, @@ -786,6 +762,7 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { String? minOrderAmountDisplay, double? minOrderAmountLimit, String? minOrderAmountLimitDisplay, + int? orderExpiryPeriod, String? paymentInfo, String? paymentMethod, Map? paymentMethodDetails, @@ -806,6 +783,7 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { advertiserDetails: advertiserDetails ?? this.advertiserDetails, amount: amount ?? this.amount, amountDisplay: amountDisplay ?? this.amountDisplay, + blockTrade: blockTrade ?? this.blockTrade, contactInfo: contactInfo ?? this.contactInfo, counterpartyType: counterpartyType ?? this.counterpartyType, country: country ?? this.country, @@ -831,6 +809,7 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { minOrderAmountLimit: minOrderAmountLimit ?? this.minOrderAmountLimit, minOrderAmountLimitDisplay: minOrderAmountLimitDisplay ?? this.minOrderAmountLimitDisplay, + orderExpiryPeriod: orderExpiryPeriod ?? this.orderExpiryPeriod, paymentInfo: paymentInfo ?? this.paymentInfo, paymentMethod: paymentMethod ?? this.paymentMethod, paymentMethodDetails: paymentMethodDetails ?? this.paymentMethodDetails, @@ -847,7 +826,6 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { visibilityStatus: visibilityStatus ?? this.visibilityStatus, ); } - /// Advertiser details model class. abstract class AdvertiserDetailsModel { /// Initializes Advertiser details model class . @@ -919,38 +897,22 @@ abstract class AdvertiserDetailsModel { class AdvertiserDetails extends AdvertiserDetailsModel { /// Initializes Advertiser details class. const AdvertiserDetails({ - required int completedOrdersCount, - required String id, - required bool isOnline, - required String name, - required int ratingCount, - String? firstName, - bool? isBlocked, - bool? isFavourite, - int? isRecommended, - String? lastName, - DateTime? lastOnlineTime, - double? ratingAverage, - double? recommendedAverage, - int? recommendedCount, - double? totalCompletionRate, - }) : super( - completedOrdersCount: completedOrdersCount, - id: id, - isOnline: isOnline, - name: name, - ratingCount: ratingCount, - firstName: firstName, - isBlocked: isBlocked, - isFavourite: isFavourite, - isRecommended: isRecommended, - lastName: lastName, - lastOnlineTime: lastOnlineTime, - ratingAverage: ratingAverage, - recommendedAverage: recommendedAverage, - recommendedCount: recommendedCount, - totalCompletionRate: totalCompletionRate, - ); + required super.completedOrdersCount, + required super.id, + required super.isOnline, + required super.name, + required super.ratingCount, + super.firstName, + super.isBlocked, + super.isFavourite, + super.isRecommended, + super.lastName, + super.lastOnlineTime, + super.ratingAverage, + super.recommendedAverage, + super.recommendedCount, + super.totalCompletionRate, + }); /// Creates an instance from JSON. factory AdvertiserDetails.fromJson(Map json) => @@ -1032,7 +994,6 @@ class AdvertiserDetails extends AdvertiserDetailsModel { totalCompletionRate: totalCompletionRate ?? this.totalCompletionRate, ); } - /// Payment method details property model class. abstract class PaymentMethodDetailsPropertyModel { /// Initializes Payment method details property model class . @@ -1072,22 +1033,14 @@ abstract class PaymentMethodDetailsPropertyModel { class PaymentMethodDetailsProperty extends PaymentMethodDetailsPropertyModel { /// Initializes Payment method details property class. const PaymentMethodDetailsProperty({ - required Map fields, - required bool isEnabled, - required String method, - required PaymentMethodDetailsPropertyTypeEnum type, - String? displayName, - List? usedByAdverts, - List? usedByOrders, - }) : super( - fields: fields, - isEnabled: isEnabled, - method: method, - type: type, - displayName: displayName, - usedByAdverts: usedByAdverts, - usedByOrders: usedByOrders, - ); + required super.fields, + required super.isEnabled, + required super.method, + required super.type, + super.displayName, + super.usedByAdverts, + super.usedByOrders, + }); /// Creates an instance from JSON. factory PaymentMethodDetailsProperty.fromJson(Map json) => @@ -1169,7 +1122,6 @@ class PaymentMethodDetailsProperty extends PaymentMethodDetailsPropertyModel { usedByOrders: usedByOrders ?? this.usedByOrders, ); } - /// Fields property model class. abstract class FieldsPropertyModel { /// Initializes Fields property model class . @@ -1197,16 +1149,11 @@ abstract class FieldsPropertyModel { class FieldsProperty extends FieldsPropertyModel { /// Initializes Fields property class. const FieldsProperty({ - required String displayName, - required int required, - required TypeEnum type, - required String value, - }) : super( - displayName: displayName, - required: required, - type: type, - value: value, - ); + required super.displayName, + required super.required, + required super.type, + required super.value, + }); /// Creates an instance from JSON. factory FieldsProperty.fromJson(Map json) => FieldsProperty( @@ -1244,7 +1191,6 @@ class FieldsProperty extends FieldsPropertyModel { value: value ?? this.value, ); } - /// Subscription model class. abstract class SubscriptionModel { /// Initializes Subscription model class . @@ -1260,10 +1206,8 @@ abstract class SubscriptionModel { class Subscription extends SubscriptionModel { /// Initializes Subscription class. const Subscription({ - required String id, - }) : super( - id: id, - ); + required super.id, + }); /// Creates an instance from JSON. factory Subscription.fromJson(Map json) => Subscription( diff --git a/lib/api/response/p2p_advert_list_response_result.dart b/lib/api/response/p2p_advert_list_response_result.dart index a42934b371..2f4d2bf0a2 100644 --- a/lib/api/response/p2p_advert_list_response_result.dart +++ b/lib/api/response/p2p_advert_list_response_result.dart @@ -1,8 +1,8 @@ // ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import import 'package:equatable/equatable.dart'; -import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/api/exceptions/base_api_exception.dart'; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_receive.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_send.dart'; @@ -25,10 +25,8 @@ abstract class P2pAdvertListResponseModel { class P2pAdvertListResponse extends P2pAdvertListResponseModel { /// Initializes P2p advert list response class. const P2pAdvertListResponse({ - P2pAdvertList? p2pAdvertList, - }) : super( - p2pAdvertList: p2pAdvertList, - ); + super.p2pAdvertList, + }); /// Creates an instance from JSON. factory P2pAdvertListResponse.fromJson( @@ -148,6 +146,8 @@ final Map visibilityStatusItemEnumMapper = "advertiser_ads_paused": VisibilityStatusItemEnum.advertiserAdsPaused, "advertiser_approval": VisibilityStatusItemEnum.advertiserApproval, "advertiser_balance": VisibilityStatusItemEnum.advertiserBalance, + "advertiser_block_trade_ineligible": + VisibilityStatusItemEnum.advertiserBlockTradeIneligible, "advertiser_daily_limit": VisibilityStatusItemEnum.advertiserDailyLimit, "advertiser_temp_ban": VisibilityStatusItemEnum.advertiserTempBan, }; @@ -175,6 +175,9 @@ enum VisibilityStatusItemEnum { /// advertiser_balance. advertiserBalance, + /// advertiser_block_trade_ineligible. + advertiserBlockTradeIneligible, + /// advertiser_daily_limit. advertiserDailyLimit, @@ -197,10 +200,8 @@ abstract class P2pAdvertListModel { class P2pAdvertList extends P2pAdvertListModel { /// Initializes P2p advert list class. const P2pAdvertList({ - required List list, - }) : super( - list: list, - ); + required super.list, + }); /// Creates an instance from JSON. factory P2pAdvertList.fromJson(Map json) => P2pAdvertList( @@ -241,6 +242,7 @@ abstract class ListItemModel { required this.rateType, required this.rateDisplay, required this.rate, + required this.orderExpiryPeriod, required this.minOrderAmountLimitDisplay, required this.minOrderAmountLimit, required this.maxOrderAmountLimitDisplay, @@ -253,6 +255,7 @@ abstract class ListItemModel { required this.createdTime, required this.country, required this.counterpartyType, + required this.blockTrade, required this.advertiserDetails, required this.accountCurrency, this.activeOrders, @@ -288,6 +291,9 @@ abstract class ListItemModel { /// Conversion rate from advertiser's account currency to `local_currency`. An absolute rate value (fixed), or percentage offset from current market rate (floating). final double rate; + /// Expiry period (seconds) for order created against this ad. + final int orderExpiryPeriod; + /// Minimum order amount at this time, in `account_currency`, formatted to appropriate decimal places. final String minOrderAmountLimitDisplay; @@ -324,6 +330,9 @@ abstract class ListItemModel { /// Type of transaction from the opposite party's perspective. final CounterpartyTypeEnum counterpartyType; + /// Indicates if this is block trade advert or not. + final bool blockTrade; + /// Details of the advertiser for this advert. final AdvertiserDetails advertiserDetails; @@ -392,6 +401,7 @@ abstract class ListItemModel { /// - `advertiser_ads_paused`: the advertiser has paused all adverts. /// - `advertiser_approval`: the advertiser's proof of identity is not verified. /// - `advertiser_balance`: the advertiser's P2P balance is less than the minimum order. + /// - `advertiser_block_trade_ineligible`: the advertiser is not currently eligible for block trading. /// - `advertiser_daily_limit`: the advertiser's remaining daily limit is less than the minimum order. /// - `advertiser_temp_ban`: the advertiser is temporarily banned from P2P. final List? visibilityStatus; @@ -401,88 +411,53 @@ abstract class ListItemModel { class ListItem extends ListItemModel { /// Initializes List item class. const ListItem({ - required String accountCurrency, - required AdvertiserDetails advertiserDetails, - required CounterpartyTypeEnum counterpartyType, - required String country, - required DateTime createdTime, - required String description, - required String id, - required bool isActive, - required bool isVisible, - required String localCurrency, - required double maxOrderAmountLimit, - required String maxOrderAmountLimitDisplay, - required double minOrderAmountLimit, - required String minOrderAmountLimitDisplay, - required double rate, - required String rateDisplay, - required RateTypeEnum rateType, - required TypeEnum type, - int? activeOrders, - double? amount, - String? amountDisplay, - String? contactInfo, - int? daysUntilArchive, - double? effectiveRate, - String? effectiveRateDisplay, - double? maxOrderAmount, - String? maxOrderAmountDisplay, - double? minOrderAmount, - String? minOrderAmountDisplay, - String? paymentInfo, - String? paymentMethod, - List? paymentMethodNames, - double? price, - String? priceDisplay, - double? remainingAmount, - String? remainingAmountDisplay, - List? visibilityStatus, - }) : super( - accountCurrency: accountCurrency, - advertiserDetails: advertiserDetails, - counterpartyType: counterpartyType, - country: country, - createdTime: createdTime, - description: description, - id: id, - isActive: isActive, - isVisible: isVisible, - localCurrency: localCurrency, - maxOrderAmountLimit: maxOrderAmountLimit, - maxOrderAmountLimitDisplay: maxOrderAmountLimitDisplay, - minOrderAmountLimit: minOrderAmountLimit, - minOrderAmountLimitDisplay: minOrderAmountLimitDisplay, - rate: rate, - rateDisplay: rateDisplay, - rateType: rateType, - type: type, - activeOrders: activeOrders, - amount: amount, - amountDisplay: amountDisplay, - contactInfo: contactInfo, - daysUntilArchive: daysUntilArchive, - effectiveRate: effectiveRate, - effectiveRateDisplay: effectiveRateDisplay, - maxOrderAmount: maxOrderAmount, - maxOrderAmountDisplay: maxOrderAmountDisplay, - minOrderAmount: minOrderAmount, - minOrderAmountDisplay: minOrderAmountDisplay, - paymentInfo: paymentInfo, - paymentMethod: paymentMethod, - paymentMethodNames: paymentMethodNames, - price: price, - priceDisplay: priceDisplay, - remainingAmount: remainingAmount, - remainingAmountDisplay: remainingAmountDisplay, - visibilityStatus: visibilityStatus, - ); + required super.accountCurrency, + required super.advertiserDetails, + required super.blockTrade, + required super.counterpartyType, + required super.country, + required super.createdTime, + required super.description, + required super.id, + required super.isActive, + required super.isVisible, + required super.localCurrency, + required super.maxOrderAmountLimit, + required super.maxOrderAmountLimitDisplay, + required super.minOrderAmountLimit, + required super.minOrderAmountLimitDisplay, + required super.orderExpiryPeriod, + required super.rate, + required super.rateDisplay, + required super.rateType, + required super.type, + super.activeOrders, + super.amount, + super.amountDisplay, + super.contactInfo, + super.daysUntilArchive, + super.effectiveRate, + super.effectiveRateDisplay, + super.maxOrderAmount, + super.maxOrderAmountDisplay, + super.minOrderAmount, + super.minOrderAmountDisplay, + super.paymentInfo, + super.paymentMethod, + super.paymentMethodNames, + super.price, + super.priceDisplay, + super.remainingAmount, + super.remainingAmountDisplay, + super.visibilityStatus, + }); /// Creates an instance from JSON. factory ListItem.fromJson(Map json) => ListItem( accountCurrency: json['account_currency'], advertiserDetails: AdvertiserDetails.fromJson(json['advertiser_details']), + blockTrade: getBool(json['block_trade'])!, counterpartyType: counterpartyTypeEnumMapper[json['counterparty_type']]!, country: json['country'], @@ -496,6 +471,7 @@ class ListItem extends ListItemModel { maxOrderAmountLimitDisplay: json['max_order_amount_limit_display'], minOrderAmountLimit: getDouble(json['min_order_amount_limit'])!, minOrderAmountLimitDisplay: json['min_order_amount_limit_display'], + orderExpiryPeriod: json['order_expiry_period'], rate: getDouble(json['rate'])!, rateDisplay: json['rate_display'], rateType: rateTypeEnumMapper[json['rate_type']]!, @@ -542,6 +518,7 @@ class ListItem extends ListItemModel { resultMap['account_currency'] = accountCurrency; resultMap['advertiser_details'] = advertiserDetails.toJson(); + resultMap['block_trade'] = blockTrade; resultMap['counterparty_type'] = counterpartyTypeEnumMapper.entries .firstWhere((MapEntry entry) => entry.value == counterpartyType) @@ -557,6 +534,7 @@ class ListItem extends ListItemModel { resultMap['max_order_amount_limit_display'] = maxOrderAmountLimitDisplay; resultMap['min_order_amount_limit'] = minOrderAmountLimit; resultMap['min_order_amount_limit_display'] = minOrderAmountLimitDisplay; + resultMap['order_expiry_period'] = orderExpiryPeriod; resultMap['rate'] = rate; resultMap['rate_display'] = rateDisplay; resultMap['rate_type'] = rateTypeEnumMapper.entries @@ -610,6 +588,7 @@ class ListItem extends ListItemModel { ListItem copyWith({ String? accountCurrency, AdvertiserDetails? advertiserDetails, + bool? blockTrade, CounterpartyTypeEnum? counterpartyType, String? country, DateTime? createdTime, @@ -622,6 +601,7 @@ class ListItem extends ListItemModel { String? maxOrderAmountLimitDisplay, double? minOrderAmountLimit, String? minOrderAmountLimitDisplay, + int? orderExpiryPeriod, double? rate, String? rateDisplay, RateTypeEnum? rateType, @@ -649,6 +629,7 @@ class ListItem extends ListItemModel { ListItem( accountCurrency: accountCurrency ?? this.accountCurrency, advertiserDetails: advertiserDetails ?? this.advertiserDetails, + blockTrade: blockTrade ?? this.blockTrade, counterpartyType: counterpartyType ?? this.counterpartyType, country: country ?? this.country, createdTime: createdTime ?? this.createdTime, @@ -663,6 +644,7 @@ class ListItem extends ListItemModel { minOrderAmountLimit: minOrderAmountLimit ?? this.minOrderAmountLimit, minOrderAmountLimitDisplay: minOrderAmountLimitDisplay ?? this.minOrderAmountLimitDisplay, + orderExpiryPeriod: orderExpiryPeriod ?? this.orderExpiryPeriod, rate: rate ?? this.rate, rateDisplay: rateDisplay ?? this.rateDisplay, rateType: rateType ?? this.rateType, @@ -763,38 +745,22 @@ abstract class AdvertiserDetailsModel { class AdvertiserDetails extends AdvertiserDetailsModel { /// Initializes Advertiser details class. const AdvertiserDetails({ - required int completedOrdersCount, - required String id, - required bool isOnline, - required String name, - required int ratingCount, - String? firstName, - int? isBlocked, - bool? isFavourite, - int? isRecommended, - String? lastName, - DateTime? lastOnlineTime, - double? ratingAverage, - double? recommendedAverage, - double? recommendedCount, - double? totalCompletionRate, - }) : super( - completedOrdersCount: completedOrdersCount, - id: id, - isOnline: isOnline, - name: name, - ratingCount: ratingCount, - firstName: firstName, - isBlocked: isBlocked, - isFavourite: isFavourite, - isRecommended: isRecommended, - lastName: lastName, - lastOnlineTime: lastOnlineTime, - ratingAverage: ratingAverage, - recommendedAverage: recommendedAverage, - recommendedCount: recommendedCount, - totalCompletionRate: totalCompletionRate, - ); + required super.completedOrdersCount, + required super.id, + required super.isOnline, + required super.name, + required super.ratingCount, + super.firstName, + super.isBlocked, + super.isFavourite, + super.isRecommended, + super.lastName, + super.lastOnlineTime, + super.ratingAverage, + super.recommendedAverage, + super.recommendedCount, + super.totalCompletionRate, + }); /// Creates an instance from JSON. factory AdvertiserDetails.fromJson(Map json) => diff --git a/lib/api/response/p2p_advert_update_response_result.dart b/lib/api/response/p2p_advert_update_response_result.dart index 7c0c1ff086..29dda903dd 100644 --- a/lib/api/response/p2p_advert_update_response_result.dart +++ b/lib/api/response/p2p_advert_update_response_result.dart @@ -25,10 +25,8 @@ abstract class P2pAdvertUpdateResponseModel { class P2pAdvertUpdateResponse extends P2pAdvertUpdateResponseModel { /// Initializes P2p advert update response class. const P2pAdvertUpdateResponse({ - P2pAdvertUpdate? p2pAdvertUpdate, - }) : super( - p2pAdvertUpdate: p2pAdvertUpdate, - ); + super.p2pAdvertUpdate, + }); /// Creates an instance from JSON. factory P2pAdvertUpdateResponse.fromJson( @@ -185,6 +183,8 @@ final Map visibilityStatusItemEnumMapper = "advertiser_ads_paused": VisibilityStatusItemEnum.advertiserAdsPaused, "advertiser_approval": VisibilityStatusItemEnum.advertiserApproval, "advertiser_balance": VisibilityStatusItemEnum.advertiserBalance, + "advertiser_block_trade_ineligible": + VisibilityStatusItemEnum.advertiserBlockTradeIneligible, "advertiser_daily_limit": VisibilityStatusItemEnum.advertiserDailyLimit, "advertiser_temp_ban": VisibilityStatusItemEnum.advertiserTempBan, }; @@ -212,13 +212,15 @@ enum VisibilityStatusItemEnum { /// advertiser_balance. advertiserBalance, + /// advertiser_block_trade_ineligible. + advertiserBlockTradeIneligible, + /// advertiser_daily_limit. advertiserDailyLimit, /// advertiser_temp_ban. advertiserTempBan, } - /// P2p advert update model class. abstract class P2pAdvertUpdateModel { /// Initializes P2p advert update model class . @@ -229,6 +231,7 @@ abstract class P2pAdvertUpdateModel { this.advertiserDetails, this.amount, this.amountDisplay, + this.blockTrade, this.contactInfo, this.counterpartyType, this.country, @@ -249,6 +252,7 @@ abstract class P2pAdvertUpdateModel { this.minOrderAmountDisplay, this.minOrderAmountLimit, this.minOrderAmountLimitDisplay, + this.orderExpiryPeriod, this.paymentInfo, this.paymentMethod, this.paymentMethodDetails, @@ -282,6 +286,9 @@ abstract class P2pAdvertUpdateModel { /// The total amount specified in advert, in `account_currency`, formatted to appropriate decimal places. final String? amountDisplay; + /// Indicates if this is block trade advert or not. + final bool? blockTrade; + /// Advertiser contact information. Only applicable for 'sell adverts'. final String? contactInfo; @@ -342,6 +349,9 @@ abstract class P2pAdvertUpdateModel { /// Minimum order amount at this time, in `account_currency`, formatted to appropriate decimal places. final String? minOrderAmountLimitDisplay; + /// Expiry period (seconds) for order created against this ad. + final int? orderExpiryPeriod; + /// Payment instructions. Only applicable for 'sell adverts'. final String? paymentInfo; @@ -386,6 +396,7 @@ abstract class P2pAdvertUpdateModel { /// - `advertiser_ads_paused`: the advertiser has paused all adverts. /// - `advertiser_approval`: the advertiser's proof of identity is not verified. /// - `advertiser_balance`: the advertiser's P2P balance is less than the minimum order. + /// - `advertiser_block_trade_ineligible`: the advertiser is not currently eligible for block trading. /// - `advertiser_daily_limit`: the advertiser's remaining daily limit is less than the minimum order. /// - `advertiser_temp_ban`: the advertiser is temporarily banned from P2P. final List? visibilityStatus; @@ -395,86 +406,48 @@ abstract class P2pAdvertUpdateModel { class P2pAdvertUpdate extends P2pAdvertUpdateModel { /// Initializes P2p advert update class. const P2pAdvertUpdate({ - required String id, - String? accountCurrency, - int? activeOrders, - AdvertiserDetails? advertiserDetails, - double? amount, - String? amountDisplay, - String? contactInfo, - CounterpartyTypeEnum? counterpartyType, - String? country, - DateTime? createdTime, - int? daysUntilArchive, - int? deleted, - String? description, - double? effectiveRate, - String? effectiveRateDisplay, - bool? isActive, - bool? isVisible, - String? localCurrency, - double? maxOrderAmount, - String? maxOrderAmountDisplay, - double? maxOrderAmountLimit, - String? maxOrderAmountLimitDisplay, - double? minOrderAmount, - String? minOrderAmountDisplay, - double? minOrderAmountLimit, - String? minOrderAmountLimitDisplay, - String? paymentInfo, - String? paymentMethod, - Map? paymentMethodDetails, - List? paymentMethodNames, - double? price, - String? priceDisplay, - double? rate, - String? rateDisplay, - RateTypeEnum? rateType, - double? remainingAmount, - String? remainingAmountDisplay, - P2pAdvertUpdateTypeEnum? type, - List? visibilityStatus, - }) : super( - id: id, - accountCurrency: accountCurrency, - activeOrders: activeOrders, - advertiserDetails: advertiserDetails, - amount: amount, - amountDisplay: amountDisplay, - contactInfo: contactInfo, - counterpartyType: counterpartyType, - country: country, - createdTime: createdTime, - daysUntilArchive: daysUntilArchive, - deleted: deleted, - description: description, - effectiveRate: effectiveRate, - effectiveRateDisplay: effectiveRateDisplay, - isActive: isActive, - isVisible: isVisible, - localCurrency: localCurrency, - maxOrderAmount: maxOrderAmount, - maxOrderAmountDisplay: maxOrderAmountDisplay, - maxOrderAmountLimit: maxOrderAmountLimit, - maxOrderAmountLimitDisplay: maxOrderAmountLimitDisplay, - minOrderAmount: minOrderAmount, - minOrderAmountDisplay: minOrderAmountDisplay, - minOrderAmountLimit: minOrderAmountLimit, - minOrderAmountLimitDisplay: minOrderAmountLimitDisplay, - paymentInfo: paymentInfo, - paymentMethod: paymentMethod, - paymentMethodDetails: paymentMethodDetails, - paymentMethodNames: paymentMethodNames, - price: price, - priceDisplay: priceDisplay, - rate: rate, - rateDisplay: rateDisplay, - rateType: rateType, - remainingAmount: remainingAmount, - remainingAmountDisplay: remainingAmountDisplay, - type: type, - visibilityStatus: visibilityStatus, - ); + required super.id, + super.accountCurrency, + super.activeOrders, + super.advertiserDetails, + super.amount, + super.amountDisplay, + super.blockTrade, + super.contactInfo, + super.counterpartyType, + super.country, + super.createdTime, + super.daysUntilArchive, + super.deleted, + super.description, + super.effectiveRate, + super.effectiveRateDisplay, + super.isActive, + super.isVisible, + super.localCurrency, + super.maxOrderAmount, + super.maxOrderAmountDisplay, + super.maxOrderAmountLimit, + super.maxOrderAmountLimitDisplay, + super.minOrderAmount, + super.minOrderAmountDisplay, + super.minOrderAmountLimit, + super.minOrderAmountLimitDisplay, + super.orderExpiryPeriod, + super.paymentInfo, + super.paymentMethod, + super.paymentMethodDetails, + super.paymentMethodNames, + super.price, + super.priceDisplay, + super.rate, + super.rateDisplay, + super.rateType, + super.remainingAmount, + super.remainingAmountDisplay, + super.type, + super.visibilityStatus, + }); /// Creates an instance from JSON. factory P2pAdvertUpdate.fromJson(Map json) => @@ -487,6 +460,7 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { : AdvertiserDetails.fromJson(json['advertiser_details']), amount: getDouble(json['amount']), amountDisplay: json['amount_display'], + blockTrade: getBool(json['block_trade']), contactInfo: json['contact_info'], counterpartyType: json['counterparty_type'] == null ? null @@ -509,6 +483,7 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { minOrderAmountDisplay: json['min_order_amount_display'], minOrderAmountLimit: getDouble(json['min_order_amount_limit']), minOrderAmountLimitDisplay: json['min_order_amount_limit_display'], + orderExpiryPeriod: json['order_expiry_period'], paymentInfo: json['payment_info'], paymentMethod: json['payment_method'], paymentMethodDetails: json['payment_method_details'] == null @@ -564,6 +539,7 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { } resultMap['amount'] = amount; resultMap['amount_display'] = amountDisplay; + resultMap['block_trade'] = blockTrade; resultMap['contact_info'] = contactInfo; resultMap['counterparty_type'] = counterpartyTypeEnumMapper.entries .firstWhere((MapEntry entry) => @@ -587,6 +563,7 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { resultMap['min_order_amount_display'] = minOrderAmountDisplay; resultMap['min_order_amount_limit'] = minOrderAmountLimit; resultMap['min_order_amount_limit_display'] = minOrderAmountLimitDisplay; + resultMap['order_expiry_period'] = orderExpiryPeriod; resultMap['payment_info'] = paymentInfo; resultMap['payment_method'] = paymentMethod; resultMap['payment_method_details'] = paymentMethodDetails; @@ -635,6 +612,7 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { AdvertiserDetails? advertiserDetails, double? amount, String? amountDisplay, + bool? blockTrade, String? contactInfo, CounterpartyTypeEnum? counterpartyType, String? country, @@ -655,6 +633,7 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { String? minOrderAmountDisplay, double? minOrderAmountLimit, String? minOrderAmountLimitDisplay, + int? orderExpiryPeriod, String? paymentInfo, String? paymentMethod, Map? paymentMethodDetails, @@ -676,6 +655,7 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { advertiserDetails: advertiserDetails ?? this.advertiserDetails, amount: amount ?? this.amount, amountDisplay: amountDisplay ?? this.amountDisplay, + blockTrade: blockTrade ?? this.blockTrade, contactInfo: contactInfo ?? this.contactInfo, counterpartyType: counterpartyType ?? this.counterpartyType, country: country ?? this.country, @@ -700,6 +680,7 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { minOrderAmountLimit: minOrderAmountLimit ?? this.minOrderAmountLimit, minOrderAmountLimitDisplay: minOrderAmountLimitDisplay ?? this.minOrderAmountLimitDisplay, + orderExpiryPeriod: orderExpiryPeriod ?? this.orderExpiryPeriod, paymentInfo: paymentInfo ?? this.paymentInfo, paymentMethod: paymentMethod ?? this.paymentMethod, paymentMethodDetails: paymentMethodDetails ?? this.paymentMethodDetails, @@ -716,7 +697,6 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { visibilityStatus: visibilityStatus ?? this.visibilityStatus, ); } - /// Advertiser details model class. abstract class AdvertiserDetailsModel { /// Initializes Advertiser details model class . @@ -776,32 +756,19 @@ abstract class AdvertiserDetailsModel { class AdvertiserDetails extends AdvertiserDetailsModel { /// Initializes Advertiser details class. const AdvertiserDetails({ - required int completedOrdersCount, - required String id, - required bool isOnline, - required String name, - required int ratingCount, - String? firstName, - String? lastName, - DateTime? lastOnlineTime, - double? ratingAverage, - double? recommendedAverage, - int? recommendedCount, - double? totalCompletionRate, - }) : super( - completedOrdersCount: completedOrdersCount, - id: id, - isOnline: isOnline, - name: name, - ratingCount: ratingCount, - firstName: firstName, - lastName: lastName, - lastOnlineTime: lastOnlineTime, - ratingAverage: ratingAverage, - recommendedAverage: recommendedAverage, - recommendedCount: recommendedCount, - totalCompletionRate: totalCompletionRate, - ); + required super.completedOrdersCount, + required super.id, + required super.isOnline, + required super.name, + required super.ratingCount, + super.firstName, + super.lastName, + super.lastOnlineTime, + super.ratingAverage, + super.recommendedAverage, + super.recommendedCount, + super.totalCompletionRate, + }); /// Creates an instance from JSON. factory AdvertiserDetails.fromJson(Map json) => @@ -871,7 +838,6 @@ class AdvertiserDetails extends AdvertiserDetailsModel { totalCompletionRate: totalCompletionRate ?? this.totalCompletionRate, ); } - /// Payment method details property model class. abstract class PaymentMethodDetailsPropertyModel { /// Initializes Payment method details property model class . @@ -911,22 +877,14 @@ abstract class PaymentMethodDetailsPropertyModel { class PaymentMethodDetailsProperty extends PaymentMethodDetailsPropertyModel { /// Initializes Payment method details property class. const PaymentMethodDetailsProperty({ - required Map fields, - required bool isEnabled, - required String method, - required PaymentMethodDetailsPropertyTypeEnum type, - String? displayName, - List? usedByAdverts, - List? usedByOrders, - }) : super( - fields: fields, - isEnabled: isEnabled, - method: method, - type: type, - displayName: displayName, - usedByAdverts: usedByAdverts, - usedByOrders: usedByOrders, - ); + required super.fields, + required super.isEnabled, + required super.method, + required super.type, + super.displayName, + super.usedByAdverts, + super.usedByOrders, + }); /// Creates an instance from JSON. factory PaymentMethodDetailsProperty.fromJson(Map json) => @@ -1008,7 +966,6 @@ class PaymentMethodDetailsProperty extends PaymentMethodDetailsPropertyModel { usedByOrders: usedByOrders ?? this.usedByOrders, ); } - /// Fields property model class. abstract class FieldsPropertyModel { /// Initializes Fields property model class . @@ -1036,16 +993,11 @@ abstract class FieldsPropertyModel { class FieldsProperty extends FieldsPropertyModel { /// Initializes Fields property class. const FieldsProperty({ - required String displayName, - required int required, - required TypeEnum type, - required String value, - }) : super( - displayName: displayName, - required: required, - type: type, - value: value, - ); + required super.displayName, + required super.required, + required super.type, + required super.value, + }); /// Creates an instance from JSON. factory FieldsProperty.fromJson(Map json) => FieldsProperty( diff --git a/lib/api/response/p2p_advertiser_adverts_response_result.dart b/lib/api/response/p2p_advertiser_adverts_response_result.dart index 4830ba2a78..89334957f2 100644 --- a/lib/api/response/p2p_advertiser_adverts_response_result.dart +++ b/lib/api/response/p2p_advertiser_adverts_response_result.dart @@ -25,10 +25,8 @@ abstract class P2pAdvertiserAdvertsResponseModel { class P2pAdvertiserAdvertsResponse extends P2pAdvertiserAdvertsResponseModel { /// Initializes P2p advertiser adverts response class. const P2pAdvertiserAdvertsResponse({ - P2pAdvertiserAdverts? p2pAdvertiserAdverts, - }) : super( - p2pAdvertiserAdverts: p2pAdvertiserAdverts, - ); + super.p2pAdvertiserAdverts, + }); /// Creates an instance from JSON. factory P2pAdvertiserAdvertsResponse.fromJson( @@ -148,6 +146,8 @@ final Map visibilityStatusItemEnumMapper = "advertiser_ads_paused": VisibilityStatusItemEnum.advertiserAdsPaused, "advertiser_approval": VisibilityStatusItemEnum.advertiserApproval, "advertiser_balance": VisibilityStatusItemEnum.advertiserBalance, + "advertiser_block_trade_ineligible": + VisibilityStatusItemEnum.advertiserBlockTradeIneligible, "advertiser_daily_limit": VisibilityStatusItemEnum.advertiserDailyLimit, "advertiser_temp_ban": VisibilityStatusItemEnum.advertiserTempBan, }; @@ -175,13 +175,15 @@ enum VisibilityStatusItemEnum { /// advertiser_balance. advertiserBalance, + /// advertiser_block_trade_ineligible. + advertiserBlockTradeIneligible, + /// advertiser_daily_limit. advertiserDailyLimit, /// advertiser_temp_ban. advertiserTempBan, } - /// P2p advertiser adverts model class. abstract class P2pAdvertiserAdvertsModel { /// Initializes P2p advertiser adverts model class . @@ -197,10 +199,8 @@ abstract class P2pAdvertiserAdvertsModel { class P2pAdvertiserAdverts extends P2pAdvertiserAdvertsModel { /// Initializes P2p advertiser adverts class. const P2pAdvertiserAdverts({ - required List list, - }) : super( - list: list, - ); + required super.list, + }); /// Creates an instance from JSON. factory P2pAdvertiserAdverts.fromJson(Map json) => @@ -233,7 +233,6 @@ class P2pAdvertiserAdverts extends P2pAdvertiserAdvertsModel { list: list ?? this.list, ); } - /// List item model class. abstract class ListItemModel { /// Initializes List item model class . @@ -245,6 +244,7 @@ abstract class ListItemModel { required this.rateDisplay, required this.rate, required this.paymentInfo, + required this.orderExpiryPeriod, required this.minOrderAmountLimitDisplay, required this.minOrderAmountLimit, required this.minOrderAmountDisplay, @@ -262,6 +262,7 @@ abstract class ListItemModel { required this.country, required this.counterpartyType, required this.contactInfo, + required this.blockTrade, required this.amountDisplay, required this.amount, required this.advertiserDetails, @@ -298,6 +299,9 @@ abstract class ListItemModel { /// Payment instructions. Only applicable for 'sell adverts'. final String paymentInfo; + /// Expiry period (seconds) for order created against this ad. + final int orderExpiryPeriod; + /// Minimum order amount at this time, in `account_currency`, formatted to appropriate decimal places. final String minOrderAmountLimitDisplay; @@ -349,6 +353,9 @@ abstract class ListItemModel { /// Advertiser contact information. Only applicable for 'sell adverts'. final String contactInfo; + /// Indicates if this is block trade advert or not. + final bool blockTrade; + /// The total amount specified in advert, in `account_currency`, formatted to appropriate decimal places. final String amountDisplay; @@ -393,6 +400,7 @@ abstract class ListItemModel { /// - `advertiser_ads_paused`: the advertiser has paused all adverts. /// - `advertiser_approval`: the advertiser's proof of identity is not verified. /// - `advertiser_balance`: the advertiser's P2P balance is less than the minimum order. + /// - `advertiser_block_trade_ineligible`: the advertiser is not currently eligible for block trading. /// - `advertiser_daily_limit`: the advertiser's remaining daily limit is less than the minimum order. /// - `advertiser_temp_ban`: the advertiser is temporarily banned from P2P. final List? visibilityStatus; @@ -402,82 +410,46 @@ abstract class ListItemModel { class ListItem extends ListItemModel { /// Initializes List item class. const ListItem({ - required String accountCurrency, - required int activeOrders, - required AdvertiserDetails advertiserDetails, - required double amount, - required String amountDisplay, - required String contactInfo, - required CounterpartyTypeEnum counterpartyType, - required String country, - required DateTime createdTime, - required String description, - required String id, - required bool isActive, - required bool isVisible, - required String localCurrency, - required double maxOrderAmount, - required String maxOrderAmountDisplay, - required double maxOrderAmountLimit, - required String maxOrderAmountLimitDisplay, - required double minOrderAmount, - required String minOrderAmountDisplay, - required double minOrderAmountLimit, - required String minOrderAmountLimitDisplay, - required String paymentInfo, - required double rate, - required String rateDisplay, - required RateTypeEnum rateType, - required double remainingAmount, - required String remainingAmountDisplay, - required TypeEnum type, - int? daysUntilArchive, - double? effectiveRate, - String? effectiveRateDisplay, - String? paymentMethod, - List? paymentMethodNames, - double? price, - String? priceDisplay, - List? visibilityStatus, - }) : super( - accountCurrency: accountCurrency, - activeOrders: activeOrders, - advertiserDetails: advertiserDetails, - amount: amount, - amountDisplay: amountDisplay, - contactInfo: contactInfo, - counterpartyType: counterpartyType, - country: country, - createdTime: createdTime, - description: description, - id: id, - isActive: isActive, - isVisible: isVisible, - localCurrency: localCurrency, - maxOrderAmount: maxOrderAmount, - maxOrderAmountDisplay: maxOrderAmountDisplay, - maxOrderAmountLimit: maxOrderAmountLimit, - maxOrderAmountLimitDisplay: maxOrderAmountLimitDisplay, - minOrderAmount: minOrderAmount, - minOrderAmountDisplay: minOrderAmountDisplay, - minOrderAmountLimit: minOrderAmountLimit, - minOrderAmountLimitDisplay: minOrderAmountLimitDisplay, - paymentInfo: paymentInfo, - rate: rate, - rateDisplay: rateDisplay, - rateType: rateType, - remainingAmount: remainingAmount, - remainingAmountDisplay: remainingAmountDisplay, - type: type, - daysUntilArchive: daysUntilArchive, - effectiveRate: effectiveRate, - effectiveRateDisplay: effectiveRateDisplay, - paymentMethod: paymentMethod, - paymentMethodNames: paymentMethodNames, - price: price, - priceDisplay: priceDisplay, - visibilityStatus: visibilityStatus, - ); + required super.accountCurrency, + required super.activeOrders, + required super.advertiserDetails, + required super.amount, + required super.amountDisplay, + required super.blockTrade, + required super.contactInfo, + required super.counterpartyType, + required super.country, + required super.createdTime, + required super.description, + required super.id, + required super.isActive, + required super.isVisible, + required super.localCurrency, + required super.maxOrderAmount, + required super.maxOrderAmountDisplay, + required super.maxOrderAmountLimit, + required super.maxOrderAmountLimitDisplay, + required super.minOrderAmount, + required super.minOrderAmountDisplay, + required super.minOrderAmountLimit, + required super.minOrderAmountLimitDisplay, + required super.orderExpiryPeriod, + required super.paymentInfo, + required super.rate, + required super.rateDisplay, + required super.rateType, + required super.remainingAmount, + required super.remainingAmountDisplay, + required super.type, + super.daysUntilArchive, + super.effectiveRate, + super.effectiveRateDisplay, + super.paymentMethod, + super.paymentMethodNames, + super.price, + super.priceDisplay, + super.visibilityStatus, + }); /// Creates an instance from JSON. factory ListItem.fromJson(Map json) => ListItem( @@ -487,6 +459,7 @@ class ListItem extends ListItemModel { AdvertiserDetails.fromJson(json['advertiser_details']), amount: getDouble(json['amount'])!, amountDisplay: json['amount_display'], + blockTrade: getBool(json['block_trade'])!, contactInfo: json['contact_info'], counterpartyType: counterpartyTypeEnumMapper[json['counterparty_type']]!, @@ -505,6 +478,7 @@ class ListItem extends ListItemModel { minOrderAmountDisplay: json['min_order_amount_display'], minOrderAmountLimit: getDouble(json['min_order_amount_limit'])!, minOrderAmountLimitDisplay: json['min_order_amount_limit_display'], + orderExpiryPeriod: json['order_expiry_period'], paymentInfo: json['payment_info'], rate: getDouble(json['rate'])!, rateDisplay: json['rate_display'], @@ -546,6 +520,7 @@ class ListItem extends ListItemModel { resultMap['amount'] = amount; resultMap['amount_display'] = amountDisplay; + resultMap['block_trade'] = blockTrade; resultMap['contact_info'] = contactInfo; resultMap['counterparty_type'] = counterpartyTypeEnumMapper.entries .firstWhere((MapEntry entry) => @@ -566,6 +541,7 @@ class ListItem extends ListItemModel { resultMap['min_order_amount_display'] = minOrderAmountDisplay; resultMap['min_order_amount_limit'] = minOrderAmountLimit; resultMap['min_order_amount_limit_display'] = minOrderAmountLimitDisplay; + resultMap['order_expiry_period'] = orderExpiryPeriod; resultMap['payment_info'] = paymentInfo; resultMap['rate'] = rate; resultMap['rate_display'] = rateDisplay; @@ -614,6 +590,7 @@ class ListItem extends ListItemModel { AdvertiserDetails? advertiserDetails, double? amount, String? amountDisplay, + bool? blockTrade, String? contactInfo, CounterpartyTypeEnum? counterpartyType, String? country, @@ -631,6 +608,7 @@ class ListItem extends ListItemModel { String? minOrderAmountDisplay, double? minOrderAmountLimit, String? minOrderAmountLimitDisplay, + int? orderExpiryPeriod, String? paymentInfo, double? rate, String? rateDisplay, @@ -653,6 +631,7 @@ class ListItem extends ListItemModel { advertiserDetails: advertiserDetails ?? this.advertiserDetails, amount: amount ?? this.amount, amountDisplay: amountDisplay ?? this.amountDisplay, + blockTrade: blockTrade ?? this.blockTrade, contactInfo: contactInfo ?? this.contactInfo, counterpartyType: counterpartyType ?? this.counterpartyType, country: country ?? this.country, @@ -674,6 +653,7 @@ class ListItem extends ListItemModel { minOrderAmountLimit: minOrderAmountLimit ?? this.minOrderAmountLimit, minOrderAmountLimitDisplay: minOrderAmountLimitDisplay ?? this.minOrderAmountLimitDisplay, + orderExpiryPeriod: orderExpiryPeriod ?? this.orderExpiryPeriod, paymentInfo: paymentInfo ?? this.paymentInfo, rate: rate ?? this.rate, rateDisplay: rateDisplay ?? this.rateDisplay, @@ -692,7 +672,6 @@ class ListItem extends ListItemModel { visibilityStatus: visibilityStatus ?? this.visibilityStatus, ); } - /// Advertiser details model class. abstract class AdvertiserDetailsModel { /// Initializes Advertiser details model class . @@ -752,32 +731,19 @@ abstract class AdvertiserDetailsModel { class AdvertiserDetails extends AdvertiserDetailsModel { /// Initializes Advertiser details class. const AdvertiserDetails({ - required int completedOrdersCount, - required String id, - required bool isOnline, - required String name, - required int ratingCount, - String? firstName, - String? lastName, - DateTime? lastOnlineTime, - double? ratingAverage, - double? recommendedAverage, - int? recommendedCount, - double? totalCompletionRate, - }) : super( - completedOrdersCount: completedOrdersCount, - id: id, - isOnline: isOnline, - name: name, - ratingCount: ratingCount, - firstName: firstName, - lastName: lastName, - lastOnlineTime: lastOnlineTime, - ratingAverage: ratingAverage, - recommendedAverage: recommendedAverage, - recommendedCount: recommendedCount, - totalCompletionRate: totalCompletionRate, - ); + required super.completedOrdersCount, + required super.id, + required super.isOnline, + required super.name, + required super.ratingCount, + super.firstName, + super.lastName, + super.lastOnlineTime, + super.ratingAverage, + super.recommendedAverage, + super.recommendedCount, + super.totalCompletionRate, + }); /// Creates an instance from JSON. factory AdvertiserDetails.fromJson(Map json) => diff --git a/lib/basic_api/generated/p2p_advert_create_send.dart b/lib/basic_api/generated/p2p_advert_create_send.dart index 09ad0891d8..e3a405655c 100644 --- a/lib/basic_api/generated/p2p_advert_create_send.dart +++ b/lib/basic_api/generated/p2p_advert_create_send.dart @@ -9,11 +9,13 @@ class P2pAdvertCreateRequest extends Request { /// Initialize P2pAdvertCreateRequest. const P2pAdvertCreateRequest({ required this.amount, + this.blockTrade, this.contactInfo, this.description, this.localCurrency, required this.maxOrderAmount, required this.minOrderAmount, + this.orderExpiryPeriod, this.p2pAdvertCreate = true, this.paymentInfo, this.paymentMethod, @@ -22,23 +24,23 @@ class P2pAdvertCreateRequest extends Request { required this.rate, required this.rateType, required this.type, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_advert_create', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_advert_create', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertCreateRequest.fromJson(Map json) => P2pAdvertCreateRequest( amount: json['amount'] as num?, + blockTrade: + json['block_trade'] == null ? null : json['block_trade'] == 1, contactInfo: json['contact_info'] as String?, description: json['description'] as String?, localCurrency: json['local_currency'] as String?, maxOrderAmount: json['max_order_amount'] as num?, minOrderAmount: json['min_order_amount'] as num?, + orderExpiryPeriod: json['order_expiry_period'] as int?, p2pAdvertCreate: json['p2p_advert_create'] == null ? null : json['p2p_advert_create'] == 1, @@ -60,6 +62,9 @@ class P2pAdvertCreateRequest extends Request { /// The total amount of the advert, in advertiser's account currency. final num? amount; + /// [Optional] Indicates if this is block trade ad or not. Default: `false`. + final bool? blockTrade; + /// [Optional] Advertiser contact information. final String? contactInfo; @@ -75,6 +80,9 @@ class P2pAdvertCreateRequest extends Request { /// Minimum allowed amount for the orders of this advert, in advertiser's `account_currency`. Should be less than or equal to `max_order_amount`. final num? minOrderAmount; + /// [Optional] Expiry period (seconds) for order created against this ad. + final int? orderExpiryPeriod; + /// Must be `true` final bool? p2pAdvertCreate; @@ -103,11 +111,17 @@ class P2pAdvertCreateRequest extends Request { @override Map toJson() => { 'amount': amount, + 'block_trade': blockTrade == null + ? null + : blockTrade! + ? 1 + : 0, 'contact_info': contactInfo, 'description': description, 'local_currency': localCurrency, 'max_order_amount': maxOrderAmount, 'min_order_amount': minOrderAmount, + 'order_expiry_period': orderExpiryPeriod, 'p2p_advert_create': p2pAdvertCreate == null ? null : p2pAdvertCreate! @@ -128,11 +142,13 @@ class P2pAdvertCreateRequest extends Request { @override P2pAdvertCreateRequest copyWith({ num? amount, + bool? blockTrade, String? contactInfo, String? description, String? localCurrency, num? maxOrderAmount, num? minOrderAmount, + int? orderExpiryPeriod, bool? p2pAdvertCreate, String? paymentInfo, String? paymentMethod, @@ -146,11 +162,13 @@ class P2pAdvertCreateRequest extends Request { }) => P2pAdvertCreateRequest( amount: amount ?? this.amount, + blockTrade: blockTrade ?? this.blockTrade, contactInfo: contactInfo ?? this.contactInfo, description: description ?? this.description, localCurrency: localCurrency ?? this.localCurrency, maxOrderAmount: maxOrderAmount ?? this.maxOrderAmount, minOrderAmount: minOrderAmount ?? this.minOrderAmount, + orderExpiryPeriod: orderExpiryPeriod ?? this.orderExpiryPeriod, p2pAdvertCreate: p2pAdvertCreate ?? this.p2pAdvertCreate, paymentInfo: paymentInfo ?? this.paymentInfo, paymentMethod: paymentMethod ?? this.paymentMethod, diff --git a/lib/basic_api/generated/p2p_advert_update_send.dart b/lib/basic_api/generated/p2p_advert_update_send.dart index 79859f96d5..586a0f2c91 100644 --- a/lib/basic_api/generated/p2p_advert_update_send.dart +++ b/lib/basic_api/generated/p2p_advert_update_send.dart @@ -16,6 +16,7 @@ class P2pAdvertUpdateRequest extends Request { this.localCurrency, this.maxOrderAmount, this.minOrderAmount, + this.orderExpiryPeriod, this.p2pAdvertUpdate = true, this.paymentInfo, this.paymentMethodIds, @@ -23,13 +24,10 @@ class P2pAdvertUpdateRequest extends Request { this.rate, this.rateType, this.remainingAmount, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_advert_update', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_advert_update', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertUpdateRequest.fromJson(Map json) => @@ -42,6 +40,7 @@ class P2pAdvertUpdateRequest extends Request { localCurrency: json['local_currency'] as String?, maxOrderAmount: json['max_order_amount'] as num?, minOrderAmount: json['min_order_amount'] as num?, + orderExpiryPeriod: json['order_expiry_period'] as int?, p2pAdvertUpdate: json['p2p_advert_update'] == null ? null : json['p2p_advert_update'] == 1, @@ -83,6 +82,9 @@ class P2pAdvertUpdateRequest extends Request { /// [Optional] Minimum allowed amount for the orders of this advert, in advertiser's `account_currency`. Should be less than or equal to `max_order_amount`. final num? minOrderAmount; + /// [Optional] Expiry period (seconds) for order created against this ad. + final int? orderExpiryPeriod; + /// Must be `true` final bool? p2pAdvertUpdate; @@ -123,6 +125,7 @@ class P2pAdvertUpdateRequest extends Request { 'local_currency': localCurrency, 'max_order_amount': maxOrderAmount, 'min_order_amount': minOrderAmount, + 'order_expiry_period': orderExpiryPeriod, 'p2p_advert_update': p2pAdvertUpdate == null ? null : p2pAdvertUpdate! @@ -149,6 +152,7 @@ class P2pAdvertUpdateRequest extends Request { String? localCurrency, num? maxOrderAmount, num? minOrderAmount, + int? orderExpiryPeriod, bool? p2pAdvertUpdate, String? paymentInfo, List? paymentMethodIds, @@ -168,6 +172,7 @@ class P2pAdvertUpdateRequest extends Request { localCurrency: localCurrency ?? this.localCurrency, maxOrderAmount: maxOrderAmount ?? this.maxOrderAmount, minOrderAmount: minOrderAmount ?? this.minOrderAmount, + orderExpiryPeriod: orderExpiryPeriod ?? this.orderExpiryPeriod, p2pAdvertUpdate: p2pAdvertUpdate ?? this.p2pAdvertUpdate, paymentInfo: paymentInfo ?? this.paymentInfo, paymentMethodIds: paymentMethodIds ?? this.paymentMethodIds, diff --git a/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_create_response.dart b/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_create_response.dart index 40ee999f43..96d87a6f4a 100644 --- a/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_create_response.dart +++ b/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_create_response.dart @@ -22,6 +22,7 @@ const String p2pAdvertCreateResponse = ''' }, "amount": 100, "amount_display": "100.00", + "block_trade": 1, "contact_info": "Please transfer to account number 1234", "counterparty_type": "buy", "country": "za", @@ -40,6 +41,7 @@ const String p2pAdvertCreateResponse = ''' "max_order_amount_display": "50.00", "min_order_amount": 20, "min_order_amount_display": "20.00", + "order_expiry_period": 3600, "payment_info": "it is a sell order", "payment_method": "bank_transfer", "price": 2.3, diff --git a/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_list_response.dart b/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_list_response.dart index fe0d70be50..e27468536a 100644 --- a/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_list_response.dart +++ b/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_list_response.dart @@ -17,6 +17,7 @@ const String p2pAdvertListResponse = ''' "rating_count" : 0, "is_online": true }, + "block_trade": 1, "counterparty_type": "sell", "country": "za", "created_time": 1589270475, @@ -29,6 +30,7 @@ const String p2pAdvertListResponse = ''' "max_order_amount_limit_display": "100.00", "min_order_amount_limit": 10, "min_order_amount_limit_display": "10.00", + "order_expiry_period": 3600, "payment_method": "bank_transfer", "price": 14500, "price_display": "14500.00", @@ -47,6 +49,7 @@ const String p2pAdvertListResponse = ''' "rating_count" : 0, "is_online": true }, + "block_trade": 1, "counterparty_type": "sell", "country": "za", "created_time": 1589275813, @@ -59,6 +62,7 @@ const String p2pAdvertListResponse = ''' "max_order_amount_limit_display": "100.00", "min_order_amount_limit": 10, "min_order_amount_limit_display": "10.00", + "order_expiry_period": 3600, "payment_method": "bank_transfer", "price": 14500, "price_display": "14500.00", diff --git a/lib/services/connection/api_manager/mock_data/p2p/p2p_order_create_response.dart b/lib/services/connection/api_manager/mock_data/p2p/p2p_order_create_response.dart index c9b03004fb..3cb9f95062 100644 --- a/lib/services/connection/api_manager/mock_data/p2p/p2p_order_create_response.dart +++ b/lib/services/connection/api_manager/mock_data/p2p/p2p_order_create_response.dart @@ -9,8 +9,10 @@ const String p2pOrderCreateResponse = '''{ "p2p_order_create": { "account_currency": "USD", "advert_details": { + "block_trade": 1, "description": "Please contact via whatsapp 1234", "id": "6", + "order_expiry_period": 3600, "payment_method": "bank_transfer", "type": "sell" }, diff --git a/test/api/p2p/p2p_advert/p2p_advert_test.dart b/test/api/p2p/p2p_advert/p2p_advert_test.dart index 631eaee2b7..a9aad382e3 100644 --- a/test/api/p2p/p2p_advert/p2p_advert_test.dart +++ b/test/api/p2p/p2p_advert/p2p_advert_test.dart @@ -1,5 +1,4 @@ -import 'package:flutter_test/flutter_test.dart'; - +import 'package:deriv_dependency_injector/dependency_injector.dart'; import 'package:flutter_deriv_api/api/api_initializer.dart'; import 'package:flutter_deriv_api/api/response/p2p_advert_create_response_result.dart' as advert_create; @@ -14,9 +13,9 @@ import 'package:flutter_deriv_api/api/response/p2p_order_create_response_result. import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_send.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_info_send.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_send.dart'; -import 'package:flutter_deriv_api/services/connection/api_manager/mock_api.dart'; -import 'package:deriv_dependency_injector/dependency_injector.dart'; import 'package:flutter_deriv_api/helpers/helpers.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/mock_api.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { setUp(() => APIInitializer().initialize(api: MockAPI())); @@ -81,6 +80,8 @@ void main() { 'advertiser CR90000018', ); + expect(adverts.first.blockTrade, true); + expect(adverts.first.orderExpiryPeriod, 3600); expect(adverts.first.counterpartyType, advert_list.CounterpartyTypeEnum.sell); expect(adverts.first.country, 'za'); From 356b29d1614fd70fbf397dbb7e70c5eaae6ccaa6 Mon Sep 17 00:00:00 2001 From: WAQAS YOUNAS Date: Tue, 14 Nov 2023 13:40:24 +0800 Subject: [PATCH 42/64] waqas/add_language_support_to_deriv_api --- lib/state/connection/connection_cubit.dart | 9 ++++++--- lib/state/connection/connection_state.dart | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/state/connection/connection_cubit.dart b/lib/state/connection/connection_cubit.dart index c2f401161e..cc8b8d9949 100644 --- a/lib/state/connection/connection_cubit.dart +++ b/lib/state/connection/connection_cubit.dart @@ -73,12 +73,15 @@ class ConnectionCubit extends Cubit { /// Gets app id of websocket. static String get appId => _connectionInformation.appId; - /// Streamsubscription for connectivity. + /// Stream subscription for connectivity. StreamSubscription? connectivitySubscription; /// Reconnect to Websocket. - Future reconnect({ConnectionInformation? connectionInformation}) async { - emit(const ConnectionDisconnectedState()); + Future reconnect({ + ConnectionInformation? connectionInformation, + bool isChangingLanguage = false, + }) async { + emit(ConnectionDisconnectedState(isChangingLanguage: isChangingLanguage)); if (connectionInformation != null) { _connectionInformation = connectionInformation; diff --git a/lib/state/connection/connection_state.dart b/lib/state/connection/connection_state.dart index 2ca83457c6..6ae26e40a5 100644 --- a/lib/state/connection/connection_state.dart +++ b/lib/state/connection/connection_state.dart @@ -33,7 +33,10 @@ class ConnectionConnectedState extends ConnectionState { /// Connection disconnected state. class ConnectionDisconnectedState extends ConnectionState { /// Initializes [ConnectionDisconnectedState]. - const ConnectionDisconnectedState(); + const ConnectionDisconnectedState({this.isChangingLanguage = false}); + + /// Is the App language changing during connection change + final bool isChangingLanguage; } /// Connection error state. From b5a88b6c458c1d77bd9032a7f9c9e2779268c1f1 Mon Sep 17 00:00:00 2001 From: abedelaziz-deriv Date: Wed, 13 Dec 2023 00:07:29 +0800 Subject: [PATCH 43/64] Updated with latest dev --- .../mock_data/p2p/p2p_advertiser_adverts_response.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/services/connection/api_manager/mock_data/p2p/p2p_advertiser_adverts_response.dart b/lib/services/connection/api_manager/mock_data/p2p/p2p_advertiser_adverts_response.dart index 7314bc1204..744619ee4a 100644 --- a/lib/services/connection/api_manager/mock_data/p2p/p2p_advertiser_adverts_response.dart +++ b/lib/services/connection/api_manager/mock_data/p2p/p2p_advertiser_adverts_response.dart @@ -50,7 +50,9 @@ const String p2pAdvertiserAdvertsResponse = ''' "rate_type" : "fixed", "rating_count" : 0, "is_online" : false, - "blocked_by_count" : 0 + "blocked_by_count" : 0, + "block_trade": true, + "order_expiry_period": 1 }, { "account_currency": "USD", @@ -93,7 +95,9 @@ const String p2pAdvertiserAdvertsResponse = ''' "rate_type" : "fixed", "rating_count" : 0, "is_online" : false, - "blocked_by_count" : 0 + "blocked_by_count" : 0, + "block_trade": true, + "order_expiry_period": 1 } ] } From d25811b7c49b66ef0728d23dcb81fc7bbdffcda9 Mon Sep 17 00:00:00 2001 From: naif-deriv <112558231+naif-deriv@users.noreply.github.com> Date: Tue, 21 Feb 2023 11:14:36 +0400 Subject: [PATCH 44/64] ci: implement github actions with flutter test, analyze and build naif/add_dart_new_features_to_code_generator (#244) - add dart new features to the code generator bassam/migrate_flutter_version_to_3_10 (#261) - migrate flutter version to 3.10.0 fix: deriv_dependency_injector versioning (#284) deps: update `deriv_dependency_injector` ci: integrate github actions ci: integrate github actions ci: fix pub get issue ci: fix pub get issue ci: remove unnecessary checkout ci: remove circle ci bassam/migrate_flutter_version_to_3_10 (#261) - migrate flutter version to 3.10.0 fix: deriv_dependency_injector versioning (#284) --- .circleci/config.yml | 82 ------------------------------------- .github/workflows/main.yaml | 47 +++++++++++++++++++++ pubspec.yaml | 5 +-- 3 files changed, 49 insertions(+), 85 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/main.yaml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index d810c8e928..0000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,82 +0,0 @@ -version: 2 -jobs: - build: - docker: - - image: cirrusci/flutter:stable - - steps: - - checkout - - run: - name: Update submodules - command: | - git submodule init - git submodule update --remote - - - run: - name: Run Flutter doctor - command: flutter doctor - - - run: - name: Link JSON files for API autobuild - command: ./setup.sh - - - restore_cache: - keys: - - android-sdk-licenses - - gradle - - pub-cache - - - run: - name: pub get - command: flutter pub get - - - run: - name: Build step - command: flutter pub run build_runner build --delete-conflicting-outputs - - - run: - name: Run the application tests - command: flutter test --coverage - - # - run: - # name: Upload coverage - # command: | - # bash <(curl -s https://codecov.io/bash) - - - run: - name: Code analysis - command: | - flutter pub global activate tuneup - flutter pub global run tuneup check - - # - run: - # name: Check that the package is ready for publishing - # command: flutter packages pub publish --dry-run - - - run: - name: Check that the package is ready for publishing - command: | - cd example && flutter build apk - - - save_cache: - key: android-sdk-licenses - paths: - - /opt/android-sdk-linux/licenses - - - save_cache: - key: pub-cache - paths: - - /home/cirrus/.pub-cache - - - save_cache: - key: gradle - paths: - - ~/.gradle - - - run: - name: Copy APK - command: | - sudo mkdir -p /artifacts && sudo chown "$(whoami)" /artifacts && cp example/build/app/outputs/apk/release/app-release.apk /artifacts/deriv-api-example.apk - - - store_artifacts: - path: /artifacts diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000000..25d5526100 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,47 @@ +name: Flutter Analyze, Test, and Build + +on: + push: + branches: + - master + - dev + pull_request: + branches: + - "*" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: "ubuntu-latest" + steps: + - name: 📚 Git Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + + - name: 🐦 Setup Flutter + uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa + with: + flutter-version: "3.10.2" + channel: stable + cache: true + cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }} + + - name: 📦 Install Dependencies + run: flutter pub get + + # do not fail if the analyze issue is info level + - name: 🕵️ Analyze + run: | + if flutter analyze 2>&1 | grep -q -E 'error:|warning:'; + then exit 1 + else exit 0 + fi + + - name: 🧪 Run Tests + run: flutter test + + - name: Build Example app + working-directory: ./example + run: flutter build apk --target-platform android-arm diff --git a/pubspec.yaml b/pubspec.yaml index be7316d9fb..d5ed6f5b18 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,9 +16,8 @@ dependencies: deriv_dependency_injector: git: - url: git@github.com:regentmarkets/flutter-deriv-packages.git - path: packages/deriv_dependency_injector - ref: dev + url: https://github.com/deriv-com/deriv-dependency-injector.git + ref: master build: ^2.3.1 dart_style: ^2.3.0 From 0403fa1a55626c8414cd1a3b3100554d6f6b8d2a Mon Sep 17 00:00:00 2001 From: akhil-deriv Date: Mon, 18 Dec 2023 14:44:59 +0400 Subject: [PATCH 45/64] added available accounts to response mapper helper --- lib/basic_api/helper/response_mapper.helper.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/basic_api/helper/response_mapper.helper.dart b/lib/basic_api/helper/response_mapper.helper.dart index 88237bceb5..75e71d1dc3 100644 --- a/lib/basic_api/helper/response_mapper.helper.dart +++ b/lib/basic_api/helper/response_mapper.helper.dart @@ -17,6 +17,7 @@ import '../generated/app_register_receive.dart'; import '../generated/app_update_receive.dart'; import '../generated/asset_index_receive.dart'; import '../generated/authorize_receive.dart'; +import '../generated/available_accounts_receive.dart'; import '../generated/balance_receive.dart'; import '../generated/buy_contract_for_multiple_accounts_receive.dart'; import '../generated/buy_receive.dart'; @@ -41,7 +42,6 @@ import '../generated/forget_all_receive.dart'; import '../generated/forget_receive.dart'; import '../generated/get_account_status_receive.dart'; import '../generated/get_account_types_receive.dart'; -import '../generated/get_available_accounts_to_transfer_receive.dart'; import '../generated/get_financial_assessment_receive.dart'; import '../generated/get_limits_receive.dart'; import '../generated/get_self_exclusion_receive.dart'; @@ -174,6 +174,8 @@ Response getGeneratedResponse(Map responseMap) { return AssetIndexReceive.fromJson(responseMap); case 'authorize': return AuthorizeReceive.fromJson(responseMap); + case 'available_accounts': + return AvailableAccountsReceive.fromJson(responseMap); case 'balance': return BalanceReceive.fromJson(responseMap); case 'buy_contract_for_multiple_accounts': @@ -222,8 +224,6 @@ Response getGeneratedResponse(Map responseMap) { return GetAccountStatusReceive.fromJson(responseMap); case 'get_account_types': return GetAccountTypesReceive.fromJson(responseMap); - case 'get_available_accounts_to_transfer': - return GetAvailableAccountsToTransferReceive.fromJson(responseMap); case 'get_financial_assessment': return GetFinancialAssessmentReceive.fromJson(responseMap); case 'get_limits': From e0fc9e62ce2ac499587a97ee7bfce823706a88ca Mon Sep 17 00:00:00 2001 From: Ali Akbar <116874053+aliakbar-deriv@users.noreply.github.com> Date: Thu, 28 Dec 2023 15:16:14 +0400 Subject: [PATCH 46/64] Added API call for trading platform reset password. --- ...form_password_reset_response_extended.dart | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 lib/api/response/trading_platform_password_reset_response_extended.dart diff --git a/lib/api/response/trading_platform_password_reset_response_extended.dart b/lib/api/response/trading_platform_password_reset_response_extended.dart new file mode 100644 index 0000000000..d3a9c22702 --- /dev/null +++ b/lib/api/response/trading_platform_password_reset_response_extended.dart @@ -0,0 +1,31 @@ +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/api/response/trading_platform_password_reset_response_result.dart'; +import 'package:flutter_deriv_api/basic_api/generated/trading_platform_password_reset_receive.dart'; +import 'package:flutter_deriv_api/basic_api/generated/trading_platform_password_reset_send.dart'; +import 'package:flutter_deriv_api/helpers/helpers.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; + +/// The extended version of the [TradingPlatformPasswordResetResponse] class to implement +/// the API call methods. +class TradingPlatformPasswordResetResponseExtended + extends TradingPlatformPasswordResetResponse { + static final BaseAPI _api = Injector()(); + + /// It calls the API to reset the password. + static Future resetPassword({ + required TradingPlatformPasswordResetRequest request, + }) async { + final TradingPlatformPasswordResetReceive response = + await _api.call(request: request); + + checkException( + response: response, + exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => + BaseAPIException(baseExceptionModel: baseExceptionModel), + ); + + return TradingPlatformPasswordResetResponse.fromJson( + response.tradingPlatformPasswordReset); + } +} From 41892a3d8ae74d77bd4fe43cc8773bbefd0c6ade Mon Sep 17 00:00:00 2001 From: Ali Akbar <116874053+aliakbar-deriv@users.noreply.github.com> Date: Fri, 29 Dec 2023 15:11:40 +0400 Subject: [PATCH 47/64] Added unit test for the API `trading_platform_password_reset`. --- .../connection/api_manager/mock_api.dart | 4 ++- ...ding_platform_password_reset_response.dart | 13 ++++++++++ .../trading_platform_password_reset_test.dart | 26 +++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 lib/services/connection/api_manager/mock_data/trading_platform/trading_platform_password_reset_response.dart create mode 100644 test/api/trading_platform/trading_platform_password_reset_test.dart diff --git a/lib/services/connection/api_manager/mock_api.dart b/lib/services/connection/api_manager/mock_api.dart index a18cc41ecd..15e702553a 100644 --- a/lib/services/connection/api_manager/mock_api.dart +++ b/lib/services/connection/api_manager/mock_api.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:convert'; import 'package:flutter/material.dart'; - import 'package:flutter_deriv_api/api/models/enums.dart'; import 'package:flutter_deriv_api/basic_api/generated/forget_all_receive.dart'; import 'package:flutter_deriv_api/basic_api/generated/forget_receive.dart'; @@ -104,6 +103,7 @@ import 'mock_data/p2p/p2p_order_confirm_response.dart'; import 'mock_data/p2p/p2p_order_create_response.dart'; import 'mock_data/p2p/p2p_order_info_response.dart'; import 'mock_data/p2p/p2p_order_list_response.dart'; +import 'mock_data/trading_platform/trading_platform_password_reset_response.dart'; import 'mock_data/user/get_financial_assessment_response.dart'; import 'mock_data/user/set_financial_assessment_response.dart'; import 'mock_data/user/tnc_approval_response.dart'; @@ -361,6 +361,8 @@ class MockAPI extends BaseAPI { return topUpVirtualResponse; case 'trading_durations': return tradingDurationsResponse; + case 'trading_platform_password_reset': + return tradingPlatformPasswordResetResponse; case 'trading_times': return tradingTimesResponse; case 'transaction': diff --git a/lib/services/connection/api_manager/mock_data/trading_platform/trading_platform_password_reset_response.dart b/lib/services/connection/api_manager/mock_data/trading_platform/trading_platform_password_reset_response.dart new file mode 100644 index 0000000000..d1ffbd2893 --- /dev/null +++ b/lib/services/connection/api_manager/mock_data/trading_platform/trading_platform_password_reset_response.dart @@ -0,0 +1,13 @@ +/// Mock data for trading platform password reset response. +const String tradingPlatformPasswordResetResponse = ''' +{ + "echo_req": { + "new_password": "", + "platform": "dxtrade", + "trading_platform_password_reset": 1, + "verification_code": "VYt3xeeu" + }, + "msg_type": "trading_platform_password_reset", + "trading_platform_password_reset": 1 +} +'''; diff --git a/test/api/trading_platform/trading_platform_password_reset_test.dart b/test/api/trading_platform/trading_platform_password_reset_test.dart new file mode 100644 index 0000000000..1f1c3f673c --- /dev/null +++ b/test/api/trading_platform/trading_platform_password_reset_test.dart @@ -0,0 +1,26 @@ +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_deriv_api/api/api_initializer.dart'; +import 'package:flutter_deriv_api/api/response/trading_platform_password_reset_response_extended.dart'; +import 'package:flutter_deriv_api/api/response/trading_platform_password_reset_response_result.dart'; +import 'package:flutter_deriv_api/basic_api/generated/trading_platform_password_reset_send.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/mock_api.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + setUp(() => APIInitializer().initialize(api: MockAPI())); + + tearDown(() => Injector().dispose()); + + test('Reset trading platform password', () async { + final TradingPlatformPasswordResetResponse passwordResetResponse = + await TradingPlatformPasswordResetResponseExtended.resetPassword( + request: const TradingPlatformPasswordResetRequest( + newPassword: 'Tst12345#', + platform: 'dxtrade', + verificationCode: 'VYt3xeeu', + ), + ); + + expect(passwordResetResponse.tradingPlatformPasswordReset, true); + }); +} From 884b460944c498d4c4c38f51b7692e379c85d3c8 Mon Sep 17 00:00:00 2001 From: Sagar Deriv Date: Thu, 4 Jan 2024 15:53:11 +0400 Subject: [PATCH 48/64] feat: add subscription method for currency exchange rates Signed-off-by: Sagar Deriv --- .../exchange_rates_response_extended.dart | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 lib/api/response/exchange_rates_response_extended.dart diff --git a/lib/api/response/exchange_rates_response_extended.dart b/lib/api/response/exchange_rates_response_extended.dart new file mode 100644 index 0000000000..7aace037b9 --- /dev/null +++ b/lib/api/response/exchange_rates_response_extended.dart @@ -0,0 +1,41 @@ +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_deriv_api/api/exceptions/base_api_exception.dart'; +import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; +import 'package:flutter_deriv_api/api/response/exchange_rates_response_result.dart'; +import 'package:flutter_deriv_api/basic_api/generated/exchange_rates_receive.dart'; +import 'package:flutter_deriv_api/basic_api/generated/exchange_rates_send.dart'; +import 'package:flutter_deriv_api/basic_api/response.dart'; +import 'package:flutter_deriv_api/helpers/helpers.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; +import 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart'; + +/// Extended functionality for [ExchangeRatesResponse] class. +class ExchangeRatesResponseExtended extends ExchangeRatesResponse { + static final BaseAPI _api = Injector()(); + + /// This will subscribe to currency exchange.
+ /// Inside [ExchangeRateRequest] class: + /// [baseCurrency]: currency that should be exchanged like USD, BTC or any other. + /// [targetCurrency]: currency that you want to exchange to. + /// Incase of error, It will throw [BaseAPIException]. + static Stream subscribeToExchangeRates( + ExchangeRatesRequest request, { + RequestCompareFunction? comparePredicate, + }) => + _api + .subscribe(request: request, comparePredicate: comparePredicate)! + .map( + (Response response) { + checkException( + response: response, + exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => + BaseAPIException(baseExceptionModel: baseExceptionModel), + ); + + return response is ExchangeRatesReceive + ? ExchangeRatesResponse.fromJson( + response.exchangeRates, response.subscription) + : null; + }, + ); +} From 5b3e0e8055772225934b56d424710480bf193613 Mon Sep 17 00:00:00 2001 From: Sagar Deriv Date: Thu, 4 Jan 2024 17:17:58 +0400 Subject: [PATCH 49/64] feat: add unsubscribe method for currency exchange rate Signed-off-by: Sagar Deriv --- .../exchange_rates_response_extended.dart | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/api/response/exchange_rates_response_extended.dart b/lib/api/response/exchange_rates_response_extended.dart index 7aace037b9..1fcc8c01fb 100644 --- a/lib/api/response/exchange_rates_response_extended.dart +++ b/lib/api/response/exchange_rates_response_extended.dart @@ -2,8 +2,7 @@ import 'package:deriv_dependency_injector/dependency_injector.dart'; import 'package:flutter_deriv_api/api/exceptions/base_api_exception.dart'; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/api/response/exchange_rates_response_result.dart'; -import 'package:flutter_deriv_api/basic_api/generated/exchange_rates_receive.dart'; -import 'package:flutter_deriv_api/basic_api/generated/exchange_rates_send.dart'; +import 'package:flutter_deriv_api/basic_api/generated/api.dart'; import 'package:flutter_deriv_api/basic_api/response.dart'; import 'package:flutter_deriv_api/helpers/helpers.dart'; import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; @@ -38,4 +37,18 @@ class ExchangeRatesResponseExtended extends ExchangeRatesResponse { : null; }, ); + + /// unsubscribe from the subscribed exchange rates
+ /// In case of error, It will throw [BaseAPIException]. + static Future unsubscribeFromExchangeRates( + String subscriptionId) async { + final ForgetReceive response = + await _api.unsubscribe(subscriptionId: subscriptionId); + checkException( + response: response, + exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => + BaseAPIException(baseExceptionModel: baseExceptionModel), + ); + return response.forget!; + } } From a104ee5896682f9bc06ef327ebded9232faa1f9b Mon Sep 17 00:00:00 2001 From: Sagar Deriv Date: Thu, 4 Jan 2024 17:21:51 +0400 Subject: [PATCH 50/64] docs: add developer documentation for currency exchange functionality Signed-off-by: Sagar Deriv --- lib/api/response/exchange_rates_response_result.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/api/response/exchange_rates_response_result.dart b/lib/api/response/exchange_rates_response_result.dart index 62c1a9194b..110f256561 100644 --- a/lib/api/response/exchange_rates_response_result.dart +++ b/lib/api/response/exchange_rates_response_result.dart @@ -9,6 +9,7 @@ import 'package:flutter_deriv_api/basic_api/generated/exchange_rates_send.dart'; import 'package:flutter_deriv_api/helpers/helpers.dart'; import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_deriv_api/api/response/exchange_rates_response_extended.dart'; /// Exchange rates response model class. abstract class ExchangeRatesResponseModel { @@ -25,7 +26,10 @@ abstract class ExchangeRatesResponseModel { final Subscription? subscription; } -/// Exchange rates response class. +/// Exchange rates response class.
+/// +/// DeveloperNote: In case of adding new functionality to this class, please use the extended version of the class i.e [ExchangeRatesResponseExtended] + class ExchangeRatesResponse extends ExchangeRatesResponseModel { /// Initializes Exchange rates response class. const ExchangeRatesResponse({ @@ -88,6 +92,7 @@ class ExchangeRatesResponse extends ExchangeRatesResponseModel { /// /// For parameters information refer to [ExchangeRatesRequest]. /// Throws an [BaseAPIException] if API response contains an error. + /// Developer NOTE: to use the realtime update to exchange rates please refer to [ExchangeRatesResponseExtended.subscribeToExchangeRates] method. static Future fetchExchangeRates( ExchangeRatesRequest request, ) async { From c6a70e0f88c41d6647542e1d62c1a958c41156f1 Mon Sep 17 00:00:00 2001 From: Sagar Deriv Date: Fri, 5 Jan 2024 16:46:28 +0400 Subject: [PATCH 51/64] refactor: add example UI for currency exchange Signed-off-by: Sagar Deriv --- example/lib/pages/main_page.dart | 2 + example/lib/widgets/exchange_rate_widget.dart | 93 +++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 example/lib/widgets/exchange_rate_widget.dart diff --git a/example/lib/pages/main_page.dart b/example/lib/pages/main_page.dart index 0a94a59d58..6d727a6b55 100644 --- a/example/lib/pages/main_page.dart +++ b/example/lib/pages/main_page.dart @@ -4,6 +4,7 @@ import 'package:flutter_deriv_api_example/blocs/active_symbols/active_symbols_bl import 'package:flutter_deriv_api_example/blocs/available_contracts/available_contracts_bloc.dart'; import 'package:flutter_deriv_api_example/widgets/active_symbols_widget.dart'; import 'package:flutter_deriv_api_example/widgets/contracts_type_widget.dart'; +import 'package:flutter_deriv_api_example/widgets/exchange_rate_widget.dart'; import 'package:flutter_deriv_api_example/widgets/price_proposal_widget.dart'; /// MainPage @@ -47,6 +48,7 @@ class _MainPageState extends State { Expanded(child: ActiveSymbolsWidget()), Expanded(child: ContractsTypeWidget()), Expanded(flex: 2, child: PriceProposalWidget()), + const Expanded(flex: 2, child: ExchangeRateWidget()), ], ), ); diff --git a/example/lib/widgets/exchange_rate_widget.dart b/example/lib/widgets/exchange_rate_widget.dart new file mode 100644 index 0000000000..ee92080f6d --- /dev/null +++ b/example/lib/widgets/exchange_rate_widget.dart @@ -0,0 +1,93 @@ +import 'dart:async'; +import 'dart:developer'; + +import 'package:flutter/material.dart'; +import 'package:flutter_deriv_api/api/response/exchange_rates_response_result.dart'; +import 'package:flutter_deriv_api/api/response/exchange_rates_response_extended.dart'; +import 'package:flutter_deriv_api/basic_api/generated/exchange_rates_send.dart'; + +/// Test widget for the exchange rates for BTC -> USD. +class ExchangeRateWidget extends StatefulWidget { + /// Test widget for exchange rates for BTC -> USD + const ExchangeRateWidget({super.key}); + + @override + State createState() => _ExchangeRateWidgetState(); +} + +class _ExchangeRateWidgetState extends State { + double value = 0; + + bool isSubscribed = false; + int exchangeUpdateTime = 0; + String subscriptionId = ''; + + Timer? _refreshingTimer; + + @override + Widget build(BuildContext context) => Column( + mainAxisSize: MainAxisSize.min, + children: [ + ElevatedButton( + onPressed: () => + isSubscribed ? _unsubscribe() : _subscribeUSDtoBTC(), + child: isSubscribed + ? const Text('Unsubscribe') + : const Text('Subscribe to exchange rate'), + ), + const Text('USD:'), + Text(value.toString()), + const SizedBox(height: 12), + const SizedBox(height: 12), + Text( + 'Last updated after: ${exchangeUpdateTime.toStringAsFixed(2)} seconds', + ) + ], + ); + + Future _subscribeUSDtoBTC() async { + final Stream ratesStream = + ExchangeRatesResponseExtended.subscribeToExchangeRates( + const ExchangeRatesRequest( + baseCurrency: 'BTC', + targetCurrency: 'USD', + subscribe: true, + )); + + // ignore: cascade_invocations + ratesStream.listen((ExchangeRatesResponse? response) { + setState(() { + subscriptionId = response!.subscription!.id; + isSubscribed = true; + value = response.exchangeRates!.rates!['USD'] as double; + _resetTimer(); + }); + }); + } + + void _resetTimer() { + _refreshingTimer?.cancel(); + + _refreshingTimer = Timer.periodic( + const Duration(seconds: 1), + (Timer timer) { + exchangeUpdateTime = timer.tick; + }, + ); + } + + Future _unsubscribe() async { + try { + final bool $ = + await ExchangeRatesResponseExtended.unsubscribeFromExchangeRates( + subscriptionId); + $.toString(); + _refreshingTimer?.cancel(); + } on Exception catch (e) { + log(e.toString()); + } + setState(() { + isSubscribed = false; + }); + } +} From 693a37ffd789f806226805729a2d85754dfe2094 Mon Sep 17 00:00:00 2001 From: Osama Date: Wed, 20 Dec 2023 17:09:43 +0800 Subject: [PATCH 52/64] Add underlyingSymbol --- lib/api/response/profit_table_response_result.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/api/response/profit_table_response_result.dart b/lib/api/response/profit_table_response_result.dart index c4593de8aa..14c8c7302a 100644 --- a/lib/api/response/profit_table_response_result.dart +++ b/lib/api/response/profit_table_response_result.dart @@ -1,14 +1,13 @@ // ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import +import 'package:deriv_dependency_injector/dependency_injector.dart'; import 'package:equatable/equatable.dart'; - import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/basic_api/generated/profit_table_receive.dart'; import 'package:flutter_deriv_api/basic_api/generated/profit_table_send.dart'; import 'package:flutter_deriv_api/helpers/helpers.dart'; import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; -import 'package:deriv_dependency_injector/dependency_injector.dart'; /// Profit table response model class. abstract class ProfitTableResponseModel { @@ -158,6 +157,7 @@ abstract class TransactionsItemModel { this.sellTime, this.shortcode, this.transactionId, + this.underlyingSymbol, }); /// ID of the application where this contract was purchased. @@ -192,6 +192,9 @@ abstract class TransactionsItemModel { /// The transaction Identifier. Every contract (buy or sell) and every payment has a unique transaction identifier. final int? transactionId; + + /// The underlying symbol for the contract. + final String? underlyingSymbol; } /// Transactions item class. @@ -209,6 +212,7 @@ class TransactionsItem extends TransactionsItemModel { DateTime? sellTime, String? shortcode, int? transactionId, + String? underlyingSymbol, }) : super( appId: appId, buyPrice: buyPrice, @@ -221,6 +225,7 @@ class TransactionsItem extends TransactionsItemModel { sellTime: sellTime, shortcode: shortcode, transactionId: transactionId, + underlyingSymbol: underlyingSymbol, ); /// Creates an instance from JSON. @@ -237,6 +242,7 @@ class TransactionsItem extends TransactionsItemModel { sellTime: getDateTime(json['sell_time']), shortcode: json['shortcode'], transactionId: json['transaction_id'], + underlyingSymbol: json['underlying_symbol'], ); /// Converts an instance to JSON. From f86ec5cce8dcd962daaae924c93f2e14e1f4d708 Mon Sep 17 00:00:00 2001 From: Osama Date: Wed, 20 Dec 2023 17:48:07 +0800 Subject: [PATCH 53/64] Add growth_rate, multiplier, deal_cancellation_duration, contract_type. --- .../profit_table_response_result.dart | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lib/api/response/profit_table_response_result.dart b/lib/api/response/profit_table_response_result.dart index 14c8c7302a..a7b41e48e5 100644 --- a/lib/api/response/profit_table_response_result.dart +++ b/lib/api/response/profit_table_response_result.dart @@ -158,6 +158,10 @@ abstract class TransactionsItemModel { this.shortcode, this.transactionId, this.underlyingSymbol, + this.contractType, + this.dealCancellationDuration, + this.multiplier, + this.growthRate, }); /// ID of the application where this contract was purchased. @@ -195,6 +199,18 @@ abstract class TransactionsItemModel { /// The underlying symbol for the contract. final String? underlyingSymbol; + + /// The contract type. + final String? contractType; + + /// The duration to cancel the contract. + final String? dealCancellationDuration; + + /// The multiplier. + final String? multiplier; + + /// The growth rate. + final String? growthRate; } /// Transactions item class. @@ -213,6 +229,10 @@ class TransactionsItem extends TransactionsItemModel { String? shortcode, int? transactionId, String? underlyingSymbol, + String? contractType, + String? dealCancellationDuration, + String? multiplier, + String? growthRate, }) : super( appId: appId, buyPrice: buyPrice, @@ -226,6 +246,10 @@ class TransactionsItem extends TransactionsItemModel { shortcode: shortcode, transactionId: transactionId, underlyingSymbol: underlyingSymbol, + contractType: contractType, + dealCancellationDuration: dealCancellationDuration, + multiplier: multiplier, + growthRate: growthRate, ); /// Creates an instance from JSON. @@ -243,6 +267,10 @@ class TransactionsItem extends TransactionsItemModel { shortcode: json['shortcode'], transactionId: json['transaction_id'], underlyingSymbol: json['underlying_symbol'], + contractType: json['contract_type'], + dealCancellationDuration: json['deal_cancellation_duration'], + multiplier: json['multiplier'], + growthRate: json['growth_rate'], ); /// Converts an instance to JSON. From 8b6d14327e99824a54b7a69168401828f40d96bc Mon Sep 17 00:00:00 2001 From: Sagar Deriv Date: Mon, 8 Jan 2024 15:05:46 +0400 Subject: [PATCH 54/64] refactor: handle null case for exchange rates response --- lib/api/response/exchange_rates_response_extended.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/api/response/exchange_rates_response_extended.dart b/lib/api/response/exchange_rates_response_extended.dart index 1fcc8c01fb..c954ed33af 100644 --- a/lib/api/response/exchange_rates_response_extended.dart +++ b/lib/api/response/exchange_rates_response_extended.dart @@ -31,10 +31,12 @@ class ExchangeRatesResponseExtended extends ExchangeRatesResponse { BaseAPIException(baseExceptionModel: baseExceptionModel), ); - return response is ExchangeRatesReceive - ? ExchangeRatesResponse.fromJson( - response.exchangeRates, response.subscription) - : null; + if (response is ExchangeRatesReceive) { + return ExchangeRatesResponse.fromJson( + response.exchangeRates, response.subscription); + } else { + throw Exception('Bad response received'); + } }, ); From 0c765200310fb25f986bc2dc1d9404dec731b6b2 Mon Sep 17 00:00:00 2001 From: sahani-deriv <125638269+sahani-deriv@users.noreply.github.com> Date: Wed, 24 Jan 2024 01:11:25 +0800 Subject: [PATCH 55/64] deps: update package_info_plus (#298) --- example/android/app/build.gradle | 2 +- pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 94759d7825..5247d3eebd 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -39,7 +39,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.deriv.flutter_deriv_api_example" - minSdkVersion 16 + minSdkVersion 19 targetSdkVersion 28 versionCode flutterVersionCode.toInteger() versionName flutterVersionName diff --git a/pubspec.yaml b/pubspec.yaml index d5ed6f5b18..3370f70c83 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -30,7 +30,7 @@ dependencies: rxdart: ^0.27.7 web_socket_channel: ^2.3.0 device_info_plus: ^8.1.0 - package_info_plus: ^3.0.3 + package_info_plus: ^4.2.0 connectivity_plus: ^3.0.3 dev_dependencies: From d2990a1cad632b4b755deb886381e65f213c555a Mon Sep 17 00:00:00 2001 From: bassam-deriv Date: Thu, 25 Jan 2024 12:27:28 +0400 Subject: [PATCH 56/64] refactor: updated package --- example/ios/Podfile | 2 +- example/ios/Runner/Info.plist | 4 ++++ example/pubspec.yaml | 1 + pubspec.yaml | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/example/ios/Podfile b/example/ios/Podfile index 1e8c3c90a5..2c068c404b 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '9.0' +platform :ios, '12.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist index ecedce56c9..56ad8ca23a 100644 --- a/example/ios/Runner/Info.plist +++ b/example/ios/Runner/Info.plist @@ -41,5 +41,9 @@ UIViewControllerBasedStatusBarAppearance + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 7839397ea0..b4d30506ab 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,6 +1,7 @@ name: flutter_deriv_api_example description: Demonstrates how to use the flutter_deriv_api plugin. publish_to: "none" +version: 0.0.1 environment: sdk: ">=3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 3370f70c83..30a16e33b2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -31,7 +31,7 @@ dependencies: web_socket_channel: ^2.3.0 device_info_plus: ^8.1.0 package_info_plus: ^4.2.0 - connectivity_plus: ^3.0.3 + connectivity_plus: ^5.0.2 dev_dependencies: flutter_test: From 98454beac65cdbee2ee502ef2bd08bbf2ee76795 Mon Sep 17 00:00:00 2001 From: Naif-Deriv Date: Mon, 29 Jan 2024 12:41:28 +0400 Subject: [PATCH 57/64] add new `get_limits` models. --- .../response/get_limits_response_result.dart | 231 ++++++++++++++++++ .../generated/get_limits_receive.dart | 15 +- lib/basic_api/generated/get_limits_send.dart | 19 +- 3 files changed, 248 insertions(+), 17 deletions(-) diff --git a/lib/api/response/get_limits_response_result.dart b/lib/api/response/get_limits_response_result.dart index 98c0e57a60..8438a4a6f1 100644 --- a/lib/api/response/get_limits_response_result.dart +++ b/lib/api/response/get_limits_response_result.dart @@ -86,6 +86,7 @@ abstract class GetLimitsModel { this.dailyTransfers, this.dailyTurnover, this.lifetimeLimit, + this.lifetimeTransfers, this.marketSpecific, this.numOfDays, this.numOfDaysLimit, @@ -113,6 +114,9 @@ abstract class GetLimitsModel { /// Lifetime withdrawal limit final double? lifetimeLimit; + /// Lifetime transfer limits. Only present when applicable to the current accout. + final LifetimeTransfers? lifetimeTransfers; + /// Contains limitation information for each market. final Map>? marketSpecific; @@ -153,6 +157,7 @@ class GetLimits extends GetLimitsModel { super.dailyTransfers, super.dailyTurnover, super.lifetimeLimit, + super.lifetimeTransfers, super.marketSpecific, super.numOfDays, super.numOfDaysLimit, @@ -173,6 +178,9 @@ class GetLimits extends GetLimitsModel { dailyTransfers: json['daily_transfers'], dailyTurnover: getDouble(json['daily_turnover']), lifetimeLimit: getDouble(json['lifetime_limit']), + lifetimeTransfers: json['lifetime_transfers'] == null + ? null + : LifetimeTransfers.fromJson(json['lifetime_transfers']), marketSpecific: json['market_specific'] == null ? null : Map>.fromEntries(json[ @@ -214,6 +222,9 @@ class GetLimits extends GetLimitsModel { resultMap['daily_transfers'] = dailyTransfers; resultMap['daily_turnover'] = dailyTurnover; resultMap['lifetime_limit'] = lifetimeLimit; + if (lifetimeTransfers != null) { + resultMap['lifetime_transfers'] = lifetimeTransfers!.toJson(); + } resultMap['market_specific'] = marketSpecific; resultMap['num_of_days'] = numOfDays; resultMap['num_of_days_limit'] = numOfDaysLimit; @@ -239,6 +250,7 @@ class GetLimits extends GetLimitsModel { Map? dailyTransfers, double? dailyTurnover, double? lifetimeLimit, + LifetimeTransfers? lifetimeTransfers, Map>? marketSpecific, int? numOfDays, double? numOfDaysLimit, @@ -257,6 +269,7 @@ class GetLimits extends GetLimitsModel { dailyTransfers: dailyTransfers ?? this.dailyTransfers, dailyTurnover: dailyTurnover ?? this.dailyTurnover, lifetimeLimit: lifetimeLimit ?? this.lifetimeLimit, + lifetimeTransfers: lifetimeTransfers ?? this.lifetimeTransfers, marketSpecific: marketSpecific ?? this.marketSpecific, numOfDays: numOfDays ?? this.numOfDays, numOfDaysLimit: numOfDaysLimit ?? this.numOfDaysLimit, @@ -272,6 +285,224 @@ class GetLimits extends GetLimitsModel { this.withdrawalSinceInceptionMonetary, ); } +/// Lifetime transfers model class. +abstract class LifetimeTransfersModel { + /// Initializes Lifetime transfers model class . + const LifetimeTransfersModel({ + this.cryptoToCrypto, + this.cryptoToFiat, + this.fiatToCrypto, + }); + + /// Lifetime transfer limit for crypto to crypto currencies. + final CryptoToCrypto? cryptoToCrypto; + + /// Lifetime transfer limit for crypto to fiat currencies. + final CryptoToFiat? cryptoToFiat; + + /// Lifetime transfer limit for fiat to crypto currencies. + final FiatToCrypto? fiatToCrypto; +} + +/// Lifetime transfers class. +class LifetimeTransfers extends LifetimeTransfersModel { + /// Initializes Lifetime transfers class. + const LifetimeTransfers({ + super.cryptoToCrypto, + super.cryptoToFiat, + super.fiatToCrypto, + }); + + /// Creates an instance from JSON. + factory LifetimeTransfers.fromJson(Map json) => + LifetimeTransfers( + cryptoToCrypto: json['crypto_to_crypto'] == null + ? null + : CryptoToCrypto.fromJson(json['crypto_to_crypto']), + cryptoToFiat: json['crypto_to_fiat'] == null + ? null + : CryptoToFiat.fromJson(json['crypto_to_fiat']), + fiatToCrypto: json['fiat_to_crypto'] == null + ? null + : FiatToCrypto.fromJson(json['fiat_to_crypto']), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (cryptoToCrypto != null) { + resultMap['crypto_to_crypto'] = cryptoToCrypto!.toJson(); + } + if (cryptoToFiat != null) { + resultMap['crypto_to_fiat'] = cryptoToFiat!.toJson(); + } + if (fiatToCrypto != null) { + resultMap['fiat_to_crypto'] = fiatToCrypto!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + LifetimeTransfers copyWith({ + CryptoToCrypto? cryptoToCrypto, + CryptoToFiat? cryptoToFiat, + FiatToCrypto? fiatToCrypto, + }) => + LifetimeTransfers( + cryptoToCrypto: cryptoToCrypto ?? this.cryptoToCrypto, + cryptoToFiat: cryptoToFiat ?? this.cryptoToFiat, + fiatToCrypto: fiatToCrypto ?? this.fiatToCrypto, + ); +} +/// Crypto to crypto model class. +abstract class CryptoToCryptoModel { + /// Initializes Crypto to crypto model class . + const CryptoToCryptoModel({ + this.allowed, + this.available, + }); + + /// Total limit in client's currency. + final double? allowed; + + /// Remaining limit in client's currency. + final double? available; +} + +/// Crypto to crypto class. +class CryptoToCrypto extends CryptoToCryptoModel { + /// Initializes Crypto to crypto class. + const CryptoToCrypto({ + super.allowed, + super.available, + }); + + /// Creates an instance from JSON. + factory CryptoToCrypto.fromJson(Map json) => CryptoToCrypto( + allowed: getDouble(json['allowed']), + available: getDouble(json['available']), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['allowed'] = allowed; + resultMap['available'] = available; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + CryptoToCrypto copyWith({ + double? allowed, + double? available, + }) => + CryptoToCrypto( + allowed: allowed ?? this.allowed, + available: available ?? this.available, + ); +} +/// Crypto to fiat model class. +abstract class CryptoToFiatModel { + /// Initializes Crypto to fiat model class . + const CryptoToFiatModel({ + this.allowed, + this.available, + }); + + /// Total limit in client's currency. + final double? allowed; + + /// Remaining limit in client's currency. + final double? available; +} + +/// Crypto to fiat class. +class CryptoToFiat extends CryptoToFiatModel { + /// Initializes Crypto to fiat class. + const CryptoToFiat({ + super.allowed, + super.available, + }); + + /// Creates an instance from JSON. + factory CryptoToFiat.fromJson(Map json) => CryptoToFiat( + allowed: getDouble(json['allowed']), + available: getDouble(json['available']), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['allowed'] = allowed; + resultMap['available'] = available; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + CryptoToFiat copyWith({ + double? allowed, + double? available, + }) => + CryptoToFiat( + allowed: allowed ?? this.allowed, + available: available ?? this.available, + ); +} +/// Fiat to crypto model class. +abstract class FiatToCryptoModel { + /// Initializes Fiat to crypto model class . + const FiatToCryptoModel({ + this.allowed, + this.available, + }); + + /// Total limit in client's currency. + final double? allowed; + + /// Remaining limit in client's currency. + final double? available; +} + +/// Fiat to crypto class. +class FiatToCrypto extends FiatToCryptoModel { + /// Initializes Fiat to crypto class. + const FiatToCrypto({ + super.allowed, + super.available, + }); + + /// Creates an instance from JSON. + factory FiatToCrypto.fromJson(Map json) => FiatToCrypto( + allowed: getDouble(json['allowed']), + available: getDouble(json['available']), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['allowed'] = allowed; + resultMap['available'] = available; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + FiatToCrypto copyWith({ + double? allowed, + double? available, + }) => + FiatToCrypto( + allowed: allowed ?? this.allowed, + available: available ?? this.available, + ); +} /// Market specific property item model class. abstract class MarketSpecificPropertyItemModel { /// Initializes Market specific property item model class . diff --git a/lib/basic_api/generated/get_limits_receive.dart b/lib/basic_api/generated/get_limits_receive.dart index f867211885..963546c5fd 100644 --- a/lib/basic_api/generated/get_limits_receive.dart +++ b/lib/basic_api/generated/get_limits_receive.dart @@ -9,16 +9,11 @@ class GetLimitsReceive extends Response { /// Initialize GetLimitsReceive. const GetLimitsReceive({ this.getLimits, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory GetLimitsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/get_limits_send.dart b/lib/basic_api/generated/get_limits_send.dart index 02af1951bf..b76fe66408 100644 --- a/lib/basic_api/generated/get_limits_send.dart +++ b/lib/basic_api/generated/get_limits_send.dart @@ -9,18 +9,17 @@ class GetLimitsRequest extends Request { /// Initialize GetLimitsRequest. const GetLimitsRequest({ this.getLimits = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'get_limits', - passthrough: passthrough, - reqId: reqId, - ); + this.loginid, + super.msgType = 'get_limits', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory GetLimitsRequest.fromJson(Map json) => GetLimitsRequest( getLimits: json['get_limits'] == null ? null : json['get_limits'] == 1, + loginid: json['loginid'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -28,6 +27,9 @@ class GetLimitsRequest extends Request { /// Must be `true` final bool? getLimits; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Converts this instance to JSON @override Map toJson() => { @@ -36,6 +38,7 @@ class GetLimitsRequest extends Request { : getLimits! ? 1 : 0, + 'loginid': loginid, 'passthrough': passthrough, 'req_id': reqId, }; @@ -44,11 +47,13 @@ class GetLimitsRequest extends Request { @override GetLimitsRequest copyWith({ bool? getLimits, + String? loginid, Map? passthrough, int? reqId, }) => GetLimitsRequest( getLimits: getLimits ?? this.getLimits, + loginid: loginid ?? this.loginid, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); From 22a7498c3c2c81000adbe0ba4ecd712829360c3a Mon Sep 17 00:00:00 2001 From: abedelaziz-deriv Date: Wed, 31 Jan 2024 00:51:01 +0800 Subject: [PATCH 58/64] Added P2PSettings models --- .gitmodules | 2 +- binary-websocket-api | 2 +- .../p2p_settings_response_result.dart | 639 ++++++++++++++++++ .../methods/p2p_settings_receive_methods.json | 4 + .../generated/p2p_settings_receive.dart | 69 ++ .../generated/p2p_settings_send.dart | 77 +++ .../helper/response_mapper.helper.dart | 3 + websockets | 1 - 8 files changed, 794 insertions(+), 3 deletions(-) create mode 100644 lib/api/response/p2p_settings_response_result.dart create mode 100644 lib/basic_api/generated/methods/p2p_settings_receive_methods.json create mode 100644 lib/basic_api/generated/p2p_settings_receive.dart create mode 100644 lib/basic_api/generated/p2p_settings_send.dart delete mode 160000 websockets diff --git a/.gitmodules b/.gitmodules index 5acd714fe2..cf49523818 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "binary-websocket-api"] path = binary-websocket-api - url = https://github.com/regentmarkets/binary-websocket-api.git + url = git@github.com:regentmarkets/binary-websocket-api.git branch = master diff --git a/binary-websocket-api b/binary-websocket-api index 4a2ead83f9..4f8dc8e529 160000 --- a/binary-websocket-api +++ b/binary-websocket-api @@ -1 +1 @@ -Subproject commit 4a2ead83f9323d0b8bfe762710b2898060a9c98f +Subproject commit 4f8dc8e529a455a3bb46ba980124fa354c4384f4 diff --git a/lib/api/response/p2p_settings_response_result.dart b/lib/api/response/p2p_settings_response_result.dart new file mode 100644 index 0000000000..817bf33f3c --- /dev/null +++ b/lib/api/response/p2p_settings_response_result.dart @@ -0,0 +1,639 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// P2p settings response model class. +abstract class P2pSettingsResponseModel { + /// Initializes P2p settings response model class . + const P2pSettingsResponseModel({ + this.p2pSettings, + this.subscription, + }); + + /// Peer-to-peer payment system settings. + final P2pSettings? p2pSettings; + + /// For subscription requests only. + final Subscription? subscription; +} + +/// P2p settings response class. +class P2pSettingsResponse extends P2pSettingsResponseModel { + /// Initializes P2p settings response class. + const P2pSettingsResponse({ + super.p2pSettings, + super.subscription, + }); + + /// Creates an instance from JSON. + factory P2pSettingsResponse.fromJson( + dynamic p2pSettingsJson, + dynamic subscriptionJson, + ) => + P2pSettingsResponse( + p2pSettings: p2pSettingsJson == null + ? null + : P2pSettings.fromJson(p2pSettingsJson), + subscription: subscriptionJson == null + ? null + : Subscription.fromJson(subscriptionJson), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (p2pSettings != null) { + resultMap['p2p_settings'] = p2pSettings!.toJson(); + } + if (subscription != null) { + resultMap['subscription'] = subscription!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + P2pSettingsResponse copyWith({ + P2pSettings? p2pSettings, + Subscription? subscription, + }) => + P2pSettingsResponse( + p2pSettings: p2pSettings ?? this.p2pSettings, + subscription: subscription ?? this.subscription, + ); +} + +/// FixedRateAdvertsEnum mapper. +final Map fixedRateAdvertsEnumMapper = + { + "disabled": FixedRateAdvertsEnum.disabled, + "enabled": FixedRateAdvertsEnum.enabled, + "list_only": FixedRateAdvertsEnum.listOnly, +}; + +/// FixedRateAdverts Enum. +enum FixedRateAdvertsEnum { + /// disabled. + disabled, + + /// enabled. + enabled, + + /// list_only. + listOnly, +} + +/// FloatRateAdvertsEnum mapper. +final Map floatRateAdvertsEnumMapper = + { + "disabled": FloatRateAdvertsEnum.disabled, + "enabled": FloatRateAdvertsEnum.enabled, + "list_only": FloatRateAdvertsEnum.listOnly, +}; + +/// FloatRateAdverts Enum. +enum FloatRateAdvertsEnum { + /// disabled. + disabled, + + /// enabled. + enabled, + + /// list_only. + listOnly, +} + +/// P2p settings model class. +abstract class P2pSettingsModel { + /// Initializes P2p settings model class . + const P2pSettingsModel({ + required this.supportedCurrencies, + required this.reviewPeriod, + required this.paymentMethodsEnabled, + required this.orderPaymentPeriod, + required this.orderDailyLimit, + required this.maximumOrderAmount, + required this.maximumAdvertAmount, + required this.localCurrencies, + required this.floatRateOffsetLimit, + required this.floatRateAdverts, + required this.fixedRateAdverts, + required this.featureLevel, + required this.disabled, + required this.crossBorderAdsEnabled, + required this.cancellationLimit, + required this.cancellationGracePeriod, + required this.cancellationCountPeriod, + required this.cancellationBlockDuration, + required this.blockTrade, + required this.advertsActiveLimit, + this.advertsArchivePeriod, + this.counterpartyTermSteps, + this.fixedRateAdvertsEndDate, + this.overrideExchangeRate, + }); + + /// List of currencies for which P2P is available + final List supportedCurrencies; + + /// Time after successful order completion during which reviews can be created, in hours. + final double reviewPeriod; + + /// Indicates if the payment methods feature is enabled. + final bool paymentMethodsEnabled; + + /// Time allowed for order payment, in minutes after order creation. + final int orderPaymentPeriod; + + /// Maximum number of orders a user may create per day. + final int orderDailyLimit; + + /// Maximum amount of an order, in USD. + final double maximumOrderAmount; + + /// Maximum amount of an advert, in USD. + final double maximumAdvertAmount; + + /// Available local currencies for p2p_advert_list request. + final List localCurrencies; + + /// Maximum rate offset for floating rate adverts. + final double floatRateOffsetLimit; + + /// Availability of floating rate adverts. + final FloatRateAdvertsEnum floatRateAdverts; + + /// Availability of fixed rate adverts. + final FixedRateAdvertsEnum fixedRateAdverts; + + /// Indicates the availbility of certain backend features. + final int featureLevel; + + /// When `true`, the P2P service is unavailable. + final bool disabled; + + /// When `false`, only exchanges in local currency are allowed for P2P advertiser. + final bool crossBorderAdsEnabled; + + /// A buyer will be temporarily barred after marking this number of cancellations within cancellation_period. + final int cancellationLimit; + + /// A buyer may cancel an order within this period without negative consequences, in minutes after order creation. + final int cancellationGracePeriod; + + /// The period within which to count buyer cancellations, in hours. + final int cancellationCountPeriod; + + /// A buyer will be blocked for this duration after exceeding the cancellation limit, in hours. + final int cancellationBlockDuration; + + /// Block trading settings + final BlockTrade blockTrade; + + /// Maximum number of active ads allowed by an advertiser per currency pair and advert type (buy or sell). + final int advertsActiveLimit; + + /// Adverts will be deactivated if no activity occurs within this period, in days. + final int? advertsArchivePeriod; + + /// Recommended step values for choosing advert counterparty terms. + final CounterpartyTermSteps? counterpartyTermSteps; + + /// Date on which fixed rate adverts will be deactivated. + final String? fixedRateAdvertsEndDate; + + /// Local P2P exchange rate which should be used instead of those obtained from the `exchange_rates` call. + final String? overrideExchangeRate; +} + +/// P2p settings class. +class P2pSettings extends P2pSettingsModel { + /// Initializes P2p settings class. + const P2pSettings({ + required super.advertsActiveLimit, + required super.blockTrade, + required super.cancellationBlockDuration, + required super.cancellationCountPeriod, + required super.cancellationGracePeriod, + required super.cancellationLimit, + required super.crossBorderAdsEnabled, + required super.disabled, + required super.featureLevel, + required super.fixedRateAdverts, + required super.floatRateAdverts, + required super.floatRateOffsetLimit, + required super.localCurrencies, + required super.maximumAdvertAmount, + required super.maximumOrderAmount, + required super.orderDailyLimit, + required super.orderPaymentPeriod, + required super.paymentMethodsEnabled, + required super.reviewPeriod, + required super.supportedCurrencies, + super.advertsArchivePeriod, + super.counterpartyTermSteps, + super.fixedRateAdvertsEndDate, + super.overrideExchangeRate, + }); + + /// Creates an instance from JSON. + factory P2pSettings.fromJson(Map json) => P2pSettings( + advertsActiveLimit: json['adverts_active_limit'], + blockTrade: BlockTrade.fromJson(json['block_trade']), + cancellationBlockDuration: json['cancellation_block_duration'], + cancellationCountPeriod: json['cancellation_count_period'], + cancellationGracePeriod: json['cancellation_grace_period'], + cancellationLimit: json['cancellation_limit'], + crossBorderAdsEnabled: getBool(json['cross_border_ads_enabled'])!, + disabled: getBool(json['disabled'])!, + featureLevel: json['feature_level'], + fixedRateAdverts: + fixedRateAdvertsEnumMapper[json['fixed_rate_adverts']]!, + floatRateAdverts: + floatRateAdvertsEnumMapper[json['float_rate_adverts']]!, + floatRateOffsetLimit: getDouble(json['float_rate_offset_limit'])!, + localCurrencies: List.from( + json['local_currencies'].map( + (dynamic item) => LocalCurrenciesItem.fromJson(item), + ), + ), + maximumAdvertAmount: getDouble(json['maximum_advert_amount'])!, + maximumOrderAmount: getDouble(json['maximum_order_amount'])!, + orderDailyLimit: json['order_daily_limit'], + orderPaymentPeriod: json['order_payment_period'], + paymentMethodsEnabled: getBool(json['payment_methods_enabled'])!, + reviewPeriod: getDouble(json['review_period'])!, + supportedCurrencies: List.from( + json['supported_currencies'].map( + (dynamic item) => item, + ), + ), + advertsArchivePeriod: json['adverts_archive_period'], + counterpartyTermSteps: json['counterparty_term_steps'] == null + ? null + : CounterpartyTermSteps.fromJson(json['counterparty_term_steps']), + fixedRateAdvertsEndDate: json['fixed_rate_adverts_end_date'], + overrideExchangeRate: json['override_exchange_rate'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['adverts_active_limit'] = advertsActiveLimit; + resultMap['block_trade'] = blockTrade.toJson(); + + resultMap['cancellation_block_duration'] = cancellationBlockDuration; + resultMap['cancellation_count_period'] = cancellationCountPeriod; + resultMap['cancellation_grace_period'] = cancellationGracePeriod; + resultMap['cancellation_limit'] = cancellationLimit; + resultMap['cross_border_ads_enabled'] = crossBorderAdsEnabled; + resultMap['disabled'] = disabled; + resultMap['feature_level'] = featureLevel; + resultMap['fixed_rate_adverts'] = fixedRateAdvertsEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == fixedRateAdverts) + .key; + resultMap['float_rate_adverts'] = floatRateAdvertsEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == floatRateAdverts) + .key; + resultMap['float_rate_offset_limit'] = floatRateOffsetLimit; + resultMap['local_currencies'] = localCurrencies + .map( + (LocalCurrenciesItem item) => item.toJson(), + ) + .toList(); + + resultMap['maximum_advert_amount'] = maximumAdvertAmount; + resultMap['maximum_order_amount'] = maximumOrderAmount; + resultMap['order_daily_limit'] = orderDailyLimit; + resultMap['order_payment_period'] = orderPaymentPeriod; + resultMap['payment_methods_enabled'] = paymentMethodsEnabled; + resultMap['review_period'] = reviewPeriod; + resultMap['supported_currencies'] = supportedCurrencies + .map( + (String item) => item, + ) + .toList(); + + resultMap['adverts_archive_period'] = advertsArchivePeriod; + if (counterpartyTermSteps != null) { + resultMap['counterparty_term_steps'] = counterpartyTermSteps!.toJson(); + } + resultMap['fixed_rate_adverts_end_date'] = fixedRateAdvertsEndDate; + resultMap['override_exchange_rate'] = overrideExchangeRate; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + P2pSettings copyWith({ + int? advertsActiveLimit, + BlockTrade? blockTrade, + int? cancellationBlockDuration, + int? cancellationCountPeriod, + int? cancellationGracePeriod, + int? cancellationLimit, + bool? crossBorderAdsEnabled, + bool? disabled, + int? featureLevel, + FixedRateAdvertsEnum? fixedRateAdverts, + FloatRateAdvertsEnum? floatRateAdverts, + double? floatRateOffsetLimit, + List? localCurrencies, + double? maximumAdvertAmount, + double? maximumOrderAmount, + int? orderDailyLimit, + int? orderPaymentPeriod, + bool? paymentMethodsEnabled, + double? reviewPeriod, + List? supportedCurrencies, + int? advertsArchivePeriod, + CounterpartyTermSteps? counterpartyTermSteps, + String? fixedRateAdvertsEndDate, + String? overrideExchangeRate, + }) => + P2pSettings( + advertsActiveLimit: advertsActiveLimit ?? this.advertsActiveLimit, + blockTrade: blockTrade ?? this.blockTrade, + cancellationBlockDuration: + cancellationBlockDuration ?? this.cancellationBlockDuration, + cancellationCountPeriod: + cancellationCountPeriod ?? this.cancellationCountPeriod, + cancellationGracePeriod: + cancellationGracePeriod ?? this.cancellationGracePeriod, + cancellationLimit: cancellationLimit ?? this.cancellationLimit, + crossBorderAdsEnabled: + crossBorderAdsEnabled ?? this.crossBorderAdsEnabled, + disabled: disabled ?? this.disabled, + featureLevel: featureLevel ?? this.featureLevel, + fixedRateAdverts: fixedRateAdverts ?? this.fixedRateAdverts, + floatRateAdverts: floatRateAdverts ?? this.floatRateAdverts, + floatRateOffsetLimit: floatRateOffsetLimit ?? this.floatRateOffsetLimit, + localCurrencies: localCurrencies ?? this.localCurrencies, + maximumAdvertAmount: maximumAdvertAmount ?? this.maximumAdvertAmount, + maximumOrderAmount: maximumOrderAmount ?? this.maximumOrderAmount, + orderDailyLimit: orderDailyLimit ?? this.orderDailyLimit, + orderPaymentPeriod: orderPaymentPeriod ?? this.orderPaymentPeriod, + paymentMethodsEnabled: + paymentMethodsEnabled ?? this.paymentMethodsEnabled, + reviewPeriod: reviewPeriod ?? this.reviewPeriod, + supportedCurrencies: supportedCurrencies ?? this.supportedCurrencies, + advertsArchivePeriod: advertsArchivePeriod ?? this.advertsArchivePeriod, + counterpartyTermSteps: + counterpartyTermSteps ?? this.counterpartyTermSteps, + fixedRateAdvertsEndDate: + fixedRateAdvertsEndDate ?? this.fixedRateAdvertsEndDate, + overrideExchangeRate: overrideExchangeRate ?? this.overrideExchangeRate, + ); +} + +/// Block trade model class. +abstract class BlockTradeModel { + /// Initializes Block trade model class . + const BlockTradeModel({ + this.disabled, + this.maximumAdvertAmount, + }); + + /// When `true`, Block trading is unavailable. + final bool? disabled; + + /// Maximum amount of a block trade advert, in USD. + final double? maximumAdvertAmount; +} + +/// Block trade class. +class BlockTrade extends BlockTradeModel { + /// Initializes Block trade class. + const BlockTrade({ + super.disabled, + super.maximumAdvertAmount, + }); + + /// Creates an instance from JSON. + factory BlockTrade.fromJson(Map json) => BlockTrade( + disabled: getBool(json['disabled']), + maximumAdvertAmount: getDouble(json['maximum_advert_amount']), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['disabled'] = disabled; + resultMap['maximum_advert_amount'] = maximumAdvertAmount; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + BlockTrade copyWith({ + bool? disabled, + double? maximumAdvertAmount, + }) => + BlockTrade( + disabled: disabled ?? this.disabled, + maximumAdvertAmount: maximumAdvertAmount ?? this.maximumAdvertAmount, + ); +} + +/// Local currencies item model class. +abstract class LocalCurrenciesItemModel { + /// Initializes Local currencies item model class . + const LocalCurrenciesItemModel({ + required this.symbol, + required this.hasAdverts, + required this.displayName, + this.isDefault, + }); + + /// Local currency symbol + final String symbol; + + /// Indicates that there are adverts available for this currency. + final bool hasAdverts; + + /// Local currency name + final String displayName; + + /// Indicates that this is local currency for the current country. + final int? isDefault; +} + +/// Local currencies item class. +class LocalCurrenciesItem extends LocalCurrenciesItemModel { + /// Initializes Local currencies item class. + const LocalCurrenciesItem({ + required super.displayName, + required super.hasAdverts, + required super.symbol, + super.isDefault, + }); + + /// Creates an instance from JSON. + factory LocalCurrenciesItem.fromJson(Map json) => + LocalCurrenciesItem( + displayName: json['display_name'], + hasAdverts: getBool(json['has_adverts'])!, + symbol: json['symbol'], + isDefault: json['is_default'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['display_name'] = displayName; + resultMap['has_adverts'] = hasAdverts; + resultMap['symbol'] = symbol; + resultMap['is_default'] = isDefault; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + LocalCurrenciesItem copyWith({ + String? displayName, + bool? hasAdverts, + String? symbol, + int? isDefault, + }) => + LocalCurrenciesItem( + displayName: displayName ?? this.displayName, + hasAdverts: hasAdverts ?? this.hasAdverts, + symbol: symbol ?? this.symbol, + isDefault: isDefault ?? this.isDefault, + ); +} + +/// Counterparty term steps model class. +abstract class CounterpartyTermStepsModel { + /// Initializes Counterparty term steps model class . + const CounterpartyTermStepsModel({ + required this.rating, + required this.joinDays, + required this.completionRate, + }); + + /// Values for minimum average rating. + final List rating; + + /// Values for minimum joined days. + final List joinDays; + + /// Values for minimum 30 day completion rate. + final List completionRate; +} + +/// Counterparty term steps class. +class CounterpartyTermSteps extends CounterpartyTermStepsModel { + /// Initializes Counterparty term steps class. + const CounterpartyTermSteps({ + required super.completionRate, + required super.joinDays, + required super.rating, + }); + + /// Creates an instance from JSON. + factory CounterpartyTermSteps.fromJson(Map json) => + CounterpartyTermSteps( + completionRate: List.from( + json['completion_rate'].map( + (dynamic item) => getDouble(item), + ), + ), + joinDays: List.from( + json['join_days'].map( + (dynamic item) => item, + ), + ), + rating: List.from( + json['rating'].map( + (dynamic item) => getDouble(item), + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['completion_rate'] = completionRate + .map( + (double item) => item, + ) + .toList(); + + resultMap['join_days'] = joinDays + .map( + (int item) => item, + ) + .toList(); + + resultMap['rating'] = rating + .map( + (double item) => item, + ) + .toList(); + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + CounterpartyTermSteps copyWith({ + List? completionRate, + List? joinDays, + List? rating, + }) => + CounterpartyTermSteps( + completionRate: completionRate ?? this.completionRate, + joinDays: joinDays ?? this.joinDays, + rating: rating ?? this.rating, + ); +} + +/// Subscription model class. +abstract class SubscriptionModel { + /// Initializes Subscription model class . + const SubscriptionModel({ + required this.id, + }); + + /// A per-connection unique identifier. Can be passed to the `forget` API call to unsubscribe. + final String id; +} + +/// Subscription class. +class Subscription extends SubscriptionModel { + /// Initializes Subscription class. + const Subscription({ + required super.id, + }); + + /// Creates an instance from JSON. + factory Subscription.fromJson(Map json) => Subscription( + id: json['id'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['id'] = id; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + Subscription copyWith({ + String? id, + }) => + Subscription( + id: id ?? this.id, + ); +} diff --git a/lib/basic_api/generated/methods/p2p_settings_receive_methods.json b/lib/basic_api/generated/methods/p2p_settings_receive_methods.json new file mode 100644 index 0000000000..97c02e4542 --- /dev/null +++ b/lib/basic_api/generated/methods/p2p_settings_receive_methods.json @@ -0,0 +1,4 @@ +{ + "methods": "", + "imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/p2p_settings_receive.dart b/lib/basic_api/generated/p2p_settings_receive.dart new file mode 100644 index 0000000000..607bd4ba44 --- /dev/null +++ b/lib/basic_api/generated/p2p_settings_receive.dart @@ -0,0 +1,69 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/p2p_settings_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// P2p settings receive class. +class P2pSettingsReceive extends Response { + /// Initialize P2pSettingsReceive. + const P2pSettingsReceive({ + this.p2pSettings, + this.subscription, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory P2pSettingsReceive.fromJson(Map json) => + P2pSettingsReceive( + p2pSettings: json['p2p_settings'] as Map?, + subscription: json['subscription'] as Map?, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// Peer-to-peer payment system settings. + final Map? p2pSettings; + + /// For subscription requests only. + final Map? subscription; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'p2p_settings': p2pSettings, + 'subscription': subscription, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + P2pSettingsReceive copyWith({ + Map? p2pSettings, + Map? subscription, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + P2pSettingsReceive( + p2pSettings: p2pSettings ?? this.p2pSettings, + subscription: subscription ?? this.subscription, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/p2p_settings_send.dart b/lib/basic_api/generated/p2p_settings_send.dart new file mode 100644 index 0000000000..bce1f7199c --- /dev/null +++ b/lib/basic_api/generated/p2p_settings_send.dart @@ -0,0 +1,77 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/p2p_settings_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// P2p settings request class. +class P2pSettingsRequest extends Request { + /// Initialize P2pSettingsRequest. + const P2pSettingsRequest({ + this.loginid, + this.p2pSettings = true, + this.subscribe, + super.msgType = 'p2p_settings', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory P2pSettingsRequest.fromJson(Map json) => + P2pSettingsRequest( + loginid: json['loginid'] as String?, + p2pSettings: + json['p2p_settings'] == null ? null : json['p2p_settings'] == 1, + subscribe: json['subscribe'] == null ? null : json['subscribe'] == 1, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + + /// Must be `true` + final bool? p2pSettings; + + /// [Optional] If set to `true`, will send updates whenever there is an update to P2P settings. + final bool? subscribe; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'loginid': loginid, + 'p2p_settings': p2pSettings == null + ? null + : p2pSettings! + ? 1 + : 0, + 'subscribe': subscribe == null + ? null + : subscribe! + ? 1 + : 0, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + P2pSettingsRequest copyWith({ + String? loginid, + bool? p2pSettings, + bool? subscribe, + Map? passthrough, + int? reqId, + }) => + P2pSettingsRequest( + loginid: loginid ?? this.loginid, + p2pSettings: p2pSettings ?? this.p2pSettings, + subscribe: subscribe ?? this.subscribe, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/helper/response_mapper.helper.dart b/lib/basic_api/helper/response_mapper.helper.dart index 75e71d1dc3..73bd465b4f 100644 --- a/lib/basic_api/helper/response_mapper.helper.dart +++ b/lib/basic_api/helper/response_mapper.helper.dart @@ -87,6 +87,7 @@ import '../generated/p2p_order_list_receive.dart'; import '../generated/p2p_order_review_receive.dart'; import '../generated/p2p_payment_methods_receive.dart'; import '../generated/p2p_ping_receive.dart'; +import '../generated/p2p_settings_receive.dart'; import '../generated/payment_methods_receive.dart'; import '../generated/paymentagent_create_receive.dart'; import '../generated/paymentagent_details_receive.dart'; @@ -314,6 +315,8 @@ Response getGeneratedResponse(Map responseMap) { return P2pPaymentMethodsReceive.fromJson(responseMap); case 'p2p_ping': return P2pPingReceive.fromJson(responseMap); + case 'p2p_settings': + return P2pSettingsReceive.fromJson(responseMap); case 'payment_methods': return PaymentMethodsReceive.fromJson(responseMap); case 'paymentagent_create': diff --git a/websockets b/websockets deleted file mode 160000 index c6f64c6f9d..0000000000 --- a/websockets +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c6f64c6f9d03a21bc90d9ae51378d64e2cd8dc20 From 8aa67d3225ddc31889968ba9dd986201dca57267 Mon Sep 17 00:00:00 2001 From: WAQAS YOUNAS Date: Mon, 5 Feb 2024 11:47:34 +0800 Subject: [PATCH 59/64] waqas/apply_latest_deriv_api_playground_changes --- .../account_closure_response_result.dart | 6 +- .../account_list_response_result.dart | 296 ++++++++ .../account_security_response_result.dart | 21 +- .../account_statistics_response_result.dart | 18 +- .../active_symbols_response_result.dart | 76 +- ...affiliate_add_company_response_result.dart | 239 +++++++ .../affiliate_add_person_response_result.dart | 220 ++++++ ...liate_register_person_response_result.dart | 50 ++ .../response/api_token_response_result.dart | 38 +- .../response/app_delete_response_result.dart | 6 +- lib/api/response/app_get_response_result.dart | 43 +- .../response/app_list_response_result.dart | 43 +- .../app_markup_details_response_result.dart | 47 +- ...app_markup_statistics_response_result.dart | 36 +- .../app_register_response_result.dart | 43 +- .../response/app_update_response_result.dart | 43 +- .../response/asset_index_response_result.dart | 6 +- .../response/authorize_response_result.dart | 15 +- lib/api/response/balance_response_result.dart | 116 +--- ...for_multiple_accounts_response_result.dart | 12 +- lib/api/response/buy_response_result.dart | 48 +- lib/api/response/cancel_response_result.dart | 25 +- lib/api/response/cashier_response_result.dart | 29 +- ...ier_withdrawal_cancel_response_result.dart | 15 +- .../change_email_response_result.dart | 6 +- .../change_password_response_result.dart | 6 +- .../confirm_email_response_result.dart | 49 ++ ...ntract_update_history_response_result.dart | 25 +- .../contract_update_response_result.dart | 48 +- .../contracts_for_response_result.dart | 171 +++-- .../response/copy_start_response_result.dart | 6 +- .../response/copy_stop_response_result.dart | 6 +- .../copytrading_list_response_result.dart | 45 +- ...opytrading_statistics_response_result.dart | 46 +- .../crypto_config_response_result.dart | 21 +- .../crypto_estimations_response_result.dart | 213 ++++++ .../document_upload_response_result.dart | 27 +- .../economic_calendar_response_result.dart | 54 +- .../exchange_rates_response_result.dart | 40 +- .../response/forget_all_response_result.dart | 6 +- lib/api/response/forget_response_result.dart | 6 +- .../get_account_status_response_result.dart | 432 ++++++++---- .../get_self_exclusion_response_result.dart | 52 +- .../get_settings_response_result.dart | 3 - ...fication_document_add_response_result.dart | 6 +- .../jtoken_create_response_result.dart | 49 ++ .../kyc_auth_status_response_result.dart | 49 ++ .../landing_company_response_result.dart | 8 +- .../login_history_response_result.dart | 22 +- lib/api/response/logout_response_result.dart | 6 +- .../response/mt5_deposit_response_result.dart | 9 +- .../mt5_new_account_response_result.dart | 48 +- .../mt5_password_change_response_result.dart | 6 +- .../mt5_password_check_response_result.dart | 6 +- .../mt5_password_reset_response_result.dart | 6 +- .../mt5_withdrawal_response_result.dart | 9 +- ...w_account_maltainvest_response_result.dart | 24 +- .../new_account_real_response_result.dart | 28 +- .../new_account_virtual_response_result.dart | 31 +- .../notification_event_response_result.dart | 6 +- .../response/oauth_apps_response_result.dart | 36 +- .../p2p_advert_create_response_result.dart | 54 +- .../p2p_advert_info_response_result.dart | 113 +++ .../p2p_advert_list_response_result.dart | 118 +++- .../p2p_advert_update_response_result.dart | 48 ++ ...2p_advertiser_adverts_response_result.dart | 48 ++ ...p2p_advertiser_create_response_result.dart | 184 ++--- .../p2p_advertiser_info_response_result.dart | 309 +++++---- .../p2p_advertiser_list_response_result.dart | 125 ++-- ...tiser_payment_methods_response_result.dart | 61 +- ..._advertiser_relations_response_result.dart | 42 +- ...p2p_advertiser_update_response_result.dart | 239 ++++--- .../p2p_chat_create_response_result.dart | 16 +- .../p2p_order_cancel_response_result.dart | 16 +- .../p2p_order_confirm_response_result.dart | 19 +- .../p2p_order_create_response_result.dart | 231 ++---- .../p2p_order_dispute_response_result.dart | 194 ++---- .../p2p_order_info_response_result.dart | 277 +++----- .../p2p_order_list_response_result.dart | 240 +++---- .../p2p_order_review_response_result.dart | 25 +- .../p2p_payment_methods_response_result.dart | 32 +- .../response/p2p_ping_response_result.dart | 22 +- .../p2p_settings_response_result.dart | 5 - .../passkeys_list_response_result.dart | 147 ++++ .../passkeys_login_response_result.dart | 111 +++ .../passkeys_options_response_result.dart | 340 +++++++++ ...keys_register_options_response_result.dart | 656 ++++++++++++++++++ .../passkeys_register_response_result.dart | 139 ++++ .../passkeys_rename_response_result.dart | 49 ++ .../passkeys_revoke_response_result.dart | 49 ++ .../payment_methods_response_result.dart | 69 +- .../paymentagent_details_response_result.dart | 121 ++-- .../paymentagent_list_response_result.dart | 80 +-- ...paymentagent_transfer_response_result.dart | 15 +- ...ithdraw_justification_response_result.dart | 53 ++ ...paymentagent_withdraw_response_result.dart | 12 +- .../payout_currencies_response_result.dart | 6 +- lib/api/response/ping_response_result.dart | 6 +- .../response/portfolio_response_result.dart | 56 +- .../profit_table_response_result.dart | 136 ++-- ...roposal_open_contract_response_result.dart | 18 + .../reality_check_response_result.dart | 37 +- .../request_report_response_result.dart | 12 +- .../reset_password_response_result.dart | 6 +- .../revoke_oauth_app_response_result.dart | 6 +- ...for_multiple_accounts_response_result.dart | 12 +- .../sell_expired_response_result.dart | 12 +- lib/api/response/sell_response_result.dart | 25 +- .../set_account_currency_response_result.dart | 6 +- ..._financial_assessment_response_result.dart | 22 +- .../set_self_exclusion_response_result.dart | 6 +- .../set_settings_response_result.dart | 6 +- .../response/statement_response_result.dart | 98 +-- .../response/states_list_response_result.dart | 16 +- .../ticks_history_response_result.dart | 51 +- lib/api/response/ticks_response_result.dart | 41 +- lib/api/response/time_response_result.dart | 8 +- .../tnc_approval_response_result.dart | 6 +- .../topup_virtual_response_result.dart | 16 +- .../trading_durations_response_result.dart | 121 +--- ...ing_platform_accounts_response_result.dart | 4 + ...estor_password_change_response_result.dart | 6 +- ...vestor_password_reset_response_result.dart | 6 +- ...ing_platform_leverage_response_result.dart | 314 +++++++++ .../trading_servers_response_result.dart | 61 +- .../trading_times_response_result.dart | 52 +- .../response/transaction_response_result.dart | 77 +- ...sfer_between_accounts_response_result.dart | 121 +++- .../unsubscribe_email_response_result.dart | 9 +- ...erify_email_cellxpert_response_result.dart | 6 +- .../verify_email_response_result.dart | 6 +- .../website_config_response_result.dart | 528 ++++++++++++++ .../generated/account_closure_receive.dart | 15 +- .../generated/account_closure_send.dart | 19 +- .../generated/account_list_receive.dart | 64 ++ .../generated/account_list_send.dart | 57 ++ .../generated/account_security_receive.dart | 15 +- .../generated/account_security_send.dart | 19 +- .../generated/account_statistics_receive.dart | 15 +- .../generated/account_statistics_send.dart | 19 +- .../generated/active_symbols_receive.dart | 15 +- .../generated/active_symbols_send.dart | 41 +- .../affiliate_add_company_receive.dart | 62 ++ .../generated/affiliate_add_company_send.dart | 252 +++++++ .../affiliate_add_person_receive.dart | 62 ++ .../generated/affiliate_add_person_send.dart | 251 +++++++ .../affiliate_register_person_receive.dart | 65 ++ .../affiliate_register_person_send.dart | 309 +++++++++ lib/basic_api/generated/api.dart | 44 ++ .../generated/api_token_receive.dart | 15 +- lib/basic_api/generated/api_token_send.dart | 19 +- .../generated/app_delete_receive.dart | 15 +- lib/basic_api/generated/app_delete_send.dart | 19 +- lib/basic_api/generated/app_get_receive.dart | 15 +- lib/basic_api/generated/app_get_send.dart | 19 +- lib/basic_api/generated/app_list_receive.dart | 15 +- lib/basic_api/generated/app_list_send.dart | 19 +- .../generated/app_markup_details_receive.dart | 15 +- .../generated/app_markup_details_send.dart | 25 +- .../app_markup_statistics_receive.dart | 15 +- .../generated/app_markup_statistics_send.dart | 19 +- .../generated/app_register_receive.dart | 15 +- .../generated/app_register_send.dart | 21 +- .../generated/app_update_receive.dart | 15 +- lib/basic_api/generated/app_update_send.dart | 21 +- .../generated/asset_index_receive.dart | 15 +- lib/basic_api/generated/asset_index_send.dart | 31 +- lib/basic_api/generated/authorize_send.dart | 10 + lib/basic_api/generated/balance_receive.dart | 15 +- lib/basic_api/generated/balance_send.dart | 19 +- ...ontract_for_multiple_accounts_receive.dart | 15 +- ...y_contract_for_multiple_accounts_send.dart | 19 +- lib/basic_api/generated/buy_receive.dart | 15 +- lib/basic_api/generated/buy_send.dart | 19 +- lib/basic_api/generated/cancel_receive.dart | 15 +- lib/basic_api/generated/cancel_send.dart | 19 +- .../generated/cashier_payments_receive.dart | 15 +- .../generated/cashier_payments_send.dart | 19 +- lib/basic_api/generated/cashier_receive.dart | 15 +- lib/basic_api/generated/cashier_send.dart | 29 +- .../cashier_withdrawal_cancel_receive.dart | 15 +- .../cashier_withdrawal_cancel_send.dart | 19 +- .../generated/change_email_receive.dart | 15 +- .../generated/change_email_send.dart | 19 +- .../generated/change_password_receive.dart | 15 +- .../generated/change_password_send.dart | 19 +- .../generated/confirm_email_receive.dart | 66 ++ .../generated/confirm_email_send.dart | 78 +++ .../contract_update_history_receive.dart | 15 +- .../contract_update_history_send.dart | 19 +- .../generated/contract_update_receive.dart | 15 +- .../generated/contract_update_send.dart | 19 +- .../generated/contracts_for_receive.dart | 15 +- .../generated/contracts_for_send.dart | 31 +- .../generated/copy_start_receive.dart | 15 +- lib/basic_api/generated/copy_start_send.dart | 19 +- .../generated/copy_stop_receive.dart | 15 +- lib/basic_api/generated/copy_stop_send.dart | 19 +- .../generated/copytrading_list_receive.dart | 15 +- .../generated/copytrading_list_send.dart | 19 +- .../copytrading_statistics_receive.dart | 15 +- .../copytrading_statistics_send.dart | 11 +- .../generated/crypto_config_receive.dart | 15 +- .../generated/crypto_config_send.dart | 19 +- .../generated/crypto_estimations_receive.dart | 69 ++ .../generated/crypto_estimations_send.dart | 86 +++ .../generated/document_upload_receive.dart | 15 +- .../generated/document_upload_send.dart | 23 +- .../generated/economic_calendar_receive.dart | 15 +- .../generated/economic_calendar_send.dart | 11 +- .../generated/exchange_rates_receive.dart | 17 +- .../generated/exchange_rates_send.dart | 21 +- .../generated/forget_all_receive.dart | 15 +- lib/basic_api/generated/forget_all_send.dart | 11 +- lib/basic_api/generated/forget_receive.dart | 15 +- lib/basic_api/generated/forget_send.dart | 11 +- .../generated/get_account_status_receive.dart | 15 +- .../generated/get_account_status_send.dart | 19 +- .../generated/get_account_types_send.dart | 8 + ...vailable_accounts_to_transfer_receive.dart | 69 -- ...t_available_accounts_to_transfer_send.dart | 73 -- .../get_financial_assessment_receive.dart | 15 +- .../get_financial_assessment_send.dart | 19 +- .../generated/get_self_exclusion_receive.dart | 15 +- .../generated/get_self_exclusion_send.dart | 19 +- .../generated/get_settings_send.dart | 8 + ...ity_verification_document_add_receive.dart | 15 +- ...entity_verification_document_add_send.dart | 27 +- .../generated/jtoken_create_receive.dart | 61 ++ .../generated/jtoken_create_send.dart | 65 ++ .../generated/kyc_auth_status_receive.dart | 61 ++ .../generated/kyc_auth_status_send.dart | 84 +++ .../landing_company_details_receive.dart | 15 +- .../generated/landing_company_receive.dart | 15 +- lib/basic_api/generated/link_wallet_send.dart | 8 + .../generated/login_history_receive.dart | 15 +- .../generated/login_history_send.dart | 19 +- lib/basic_api/generated/logout_receive.dart | 15 +- lib/basic_api/generated/logout_send.dart | 19 +- .../methods/account_list_receive_methods.json | 4 + ...affiliate_add_company_receive_methods.json | 4 + .../affiliate_add_person_receive_methods.json | 4 + ...liate_register_person_receive_methods.json | 4 + .../confirm_email_receive_methods.json | 4 + .../crypto_estimations_receive_methods.json | 4 + .../jtoken_create_receive_methods.json | 4 + .../kyc_auth_status_receive_methods.json | 4 + .../passkeys_list_receive_methods.json | 4 + .../passkeys_login_receive_methods.json | 4 + .../passkeys_options_receive_methods.json | 4 + ...keys_register_options_receive_methods.json | 4 + .../passkeys_register_receive_methods.json | 4 + .../passkeys_rename_receive_methods.json | 4 + .../passkeys_revoke_receive_methods.json | 4 + ...ithdraw_justification_receive_methods.json | 4 + ...ing_platform_leverage_receive_methods.json | 4 + .../website_config_receive_methods.json | 4 + .../generated/mt5_deposit_receive.dart | 15 +- lib/basic_api/generated/mt5_deposit_send.dart | 19 +- .../generated/mt5_get_settings_receive.dart | 15 +- .../generated/mt5_get_settings_send.dart | 19 +- .../generated/mt5_login_list_receive.dart | 15 +- .../generated/mt5_login_list_send.dart | 19 +- .../generated/mt5_new_account_send.dart | 16 + .../generated/mt5_password_change_send.dart | 19 +- .../generated/mt5_password_check_receive.dart | 15 +- .../generated/mt5_password_check_send.dart | 19 +- .../generated/mt5_password_reset_receive.dart | 15 +- .../generated/mt5_password_reset_send.dart | 19 +- .../generated/mt5_withdrawal_receive.dart | 15 +- .../generated/mt5_withdrawal_send.dart | 19 +- .../new_account_maltainvest_receive.dart | 15 +- .../new_account_maltainvest_send.dart | 8 + .../generated/new_account_real_send.dart | 18 +- .../generated/new_account_virtual_send.dart | 16 + .../generated/new_account_wallet_send.dart | 18 +- .../generated/notification_event_receive.dart | 15 +- .../generated/notification_event_send.dart | 19 +- .../generated/oauth_apps_receive.dart | 17 +- lib/basic_api/generated/oauth_apps_send.dart | 19 +- .../generated/p2p_advert_create_receive.dart | 15 +- .../generated/p2p_advert_create_send.dart | 42 ++ .../generated/p2p_advert_info_receive.dart | 15 +- .../generated/p2p_advert_info_send.dart | 19 +- .../generated/p2p_advert_list_receive.dart | 15 +- .../generated/p2p_advert_list_send.dart | 46 +- .../generated/p2p_advert_update_receive.dart | 15 +- .../generated/p2p_advert_update_send.dart | 42 ++ .../p2p_advertiser_adverts_receive.dart | 15 +- .../p2p_advertiser_adverts_send.dart | 19 +- .../p2p_advertiser_create_receive.dart | 15 +- .../generated/p2p_advertiser_create_send.dart | 19 +- .../p2p_advertiser_info_receive.dart | 15 +- .../generated/p2p_advertiser_info_send.dart | 19 +- .../p2p_advertiser_list_receive.dart | 15 +- .../generated/p2p_advertiser_list_send.dart | 19 +- ...2p_advertiser_payment_methods_receive.dart | 15 +- .../p2p_advertiser_payment_methods_send.dart | 19 +- .../p2p_advertiser_relations_receive.dart | 15 +- .../p2p_advertiser_relations_send.dart | 19 +- .../p2p_advertiser_update_receive.dart | 15 +- .../generated/p2p_advertiser_update_send.dart | 21 +- .../generated/p2p_chat_create_receive.dart | 15 +- .../generated/p2p_chat_create_send.dart | 19 +- .../generated/p2p_order_cancel_receive.dart | 15 +- .../generated/p2p_order_cancel_send.dart | 19 +- .../generated/p2p_order_confirm_receive.dart | 15 +- .../generated/p2p_order_confirm_send.dart | 19 +- .../generated/p2p_order_create_receive.dart | 15 +- .../generated/p2p_order_create_send.dart | 19 +- .../generated/p2p_order_dispute_receive.dart | 15 +- .../generated/p2p_order_dispute_send.dart | 19 +- .../generated/p2p_order_info_receive.dart | 15 +- .../generated/p2p_order_info_send.dart | 19 +- .../generated/p2p_order_list_receive.dart | 15 +- .../generated/p2p_order_list_send.dart | 8 + .../generated/p2p_order_review_receive.dart | 15 +- .../generated/p2p_order_review_send.dart | 19 +- .../p2p_payment_methods_receive.dart | 15 +- .../generated/p2p_payment_methods_send.dart | 19 +- lib/basic_api/generated/p2p_ping_receive.dart | 15 +- lib/basic_api/generated/p2p_ping_send.dart | 19 +- .../generated/passkeys_list_receive.dart | 64 ++ .../generated/passkeys_list_send.dart | 65 ++ .../generated/passkeys_login_receive.dart | 61 ++ .../generated/passkeys_login_send.dart | 74 ++ .../generated/passkeys_options_receive.dart | 61 ++ .../generated/passkeys_options_send.dart | 74 ++ .../passkeys_register_options_receive.dart | 63 ++ .../passkeys_register_options_send.dart | 67 ++ .../generated/passkeys_register_receive.dart | 61 ++ .../generated/passkeys_register_send.dart | 83 +++ .../generated/passkeys_rename_receive.dart | 61 ++ .../generated/passkeys_rename_send.dart | 82 +++ .../generated/passkeys_revoke_receive.dart | 61 ++ .../generated/passkeys_revoke_send.dart | 83 +++ .../generated/payment_methods_receive.dart | 15 +- .../generated/payment_methods_send.dart | 19 +- .../paymentagent_create_receive.dart | 15 +- .../generated/paymentagent_create_send.dart | 19 +- .../paymentagent_details_receive.dart | 15 +- .../generated/paymentagent_details_send.dart | 19 +- .../generated/paymentagent_list_receive.dart | 15 +- .../generated/paymentagent_list_send.dart | 19 +- .../paymentagent_transfer_receive.dart | 15 +- .../generated/paymentagent_transfer_send.dart | 19 +- ...tagent_withdraw_justification_receive.dart | 65 ++ ...mentagent_withdraw_justification_send.dart | 78 +++ .../paymentagent_withdraw_receive.dart | 15 +- .../generated/paymentagent_withdraw_send.dart | 19 +- .../generated/payout_currencies_receive.dart | 15 +- .../generated/payout_currencies_send.dart | 19 +- lib/basic_api/generated/ping_receive.dart | 15 +- lib/basic_api/generated/ping_send.dart | 11 +- .../generated/portfolio_receive.dart | 15 +- lib/basic_api/generated/portfolio_send.dart | 19 +- .../generated/profit_table_receive.dart | 15 +- .../generated/profit_table_send.dart | 8 + .../generated/reality_check_receive.dart | 15 +- .../generated/reality_check_send.dart | 19 +- .../generated/request_report_receive.dart | 15 +- .../generated/request_report_send.dart | 19 +- .../generated/reset_password_receive.dart | 15 +- .../generated/reset_password_send.dart | 19 +- .../generated/residence_list_receive.dart | 15 +- .../generated/residence_list_send.dart | 11 +- .../generated/revoke_oauth_app_receive.dart | 15 +- .../generated/revoke_oauth_app_send.dart | 19 +- ...ontract_for_multiple_accounts_receive.dart | 15 +- ...l_contract_for_multiple_accounts_send.dart | 19 +- .../generated/sell_expired_receive.dart | 15 +- .../generated/sell_expired_send.dart | 19 +- lib/basic_api/generated/sell_receive.dart | 15 +- lib/basic_api/generated/sell_send.dart | 19 +- .../generated/service_token_receive.dart | 15 +- .../generated/service_token_send.dart | 19 +- .../set_account_currency_receive.dart | 15 +- .../generated/set_account_currency_send.dart | 19 +- .../set_financial_assessment_receive.dart | 15 +- .../set_financial_assessment_send.dart | 70 +- .../generated/set_self_exclusion_receive.dart | 15 +- .../generated/set_self_exclusion_send.dart | 19 +- .../generated/set_settings_send.dart | 10 +- lib/basic_api/generated/statement_send.dart | 8 + .../generated/states_list_receive.dart | 15 +- lib/basic_api/generated/states_list_send.dart | 11 +- .../generated/ticks_history_receive.dart | 15 +- .../generated/ticks_history_send.dart | 11 +- lib/basic_api/generated/ticks_receive.dart | 15 +- lib/basic_api/generated/ticks_send.dart | 11 +- lib/basic_api/generated/time_receive.dart | 15 +- lib/basic_api/generated/time_send.dart | 11 +- .../generated/tnc_approval_receive.dart | 15 +- .../generated/tnc_approval_send.dart | 19 +- .../generated/topup_virtual_receive.dart | 15 +- .../generated/topup_virtual_send.dart | 19 +- .../generated/trading_durations_send.dart | 8 + .../trading_platform_accounts_receive.dart | 15 +- .../trading_platform_accounts_send.dart | 19 +- .../trading_platform_asset_listing_send.dart | 8 + ...g_platform_available_accounts_receive.dart | 15 +- ...ding_platform_available_accounts_send.dart | 19 +- .../trading_platform_deposit_receive.dart | 15 +- .../trading_platform_deposit_send.dart | 19 +- ...form_investor_password_change_receive.dart | 15 +- ...latform_investor_password_change_send.dart | 8 + ...tform_investor_password_reset_receive.dart | 15 +- ...platform_investor_password_reset_send.dart | 19 +- .../trading_platform_leverage_receive.dart | 63 ++ .../trading_platform_leverage_send.dart | 67 ++ .../trading_platform_new_account_send.dart | 10 +- ...ding_platform_password_change_receive.dart | 15 +- ...trading_platform_password_change_send.dart | 19 +- ...ading_platform_password_reset_receive.dart | 15 +- .../trading_platform_password_reset_send.dart | 19 +- ...ding_platform_product_listing_receive.dart | 15 +- ...trading_platform_product_listing_send.dart | 11 +- .../trading_platform_withdrawal_receive.dart | 15 +- .../trading_platform_withdrawal_send.dart | 19 +- .../generated/trading_servers_receive.dart | 15 +- .../generated/trading_servers_send.dart | 19 +- .../generated/trading_times_receive.dart | 15 +- .../generated/trading_times_send.dart | 11 +- .../generated/transaction_receive.dart | 15 +- lib/basic_api/generated/transaction_send.dart | 19 +- .../transfer_between_accounts_receive.dart | 15 +- .../transfer_between_accounts_send.dart | 19 +- .../generated/unsubscribe_email_receive.dart | 15 +- .../generated/unsubscribe_email_send.dart | 11 +- .../verify_email_cellxpert_receive.dart | 15 +- .../verify_email_cellxpert_send.dart | 19 +- .../generated/verify_email_receive.dart | 15 +- .../generated/verify_email_send.dart | 21 +- .../generated/wallet_migration_send.dart | 8 + .../generated/website_config_receive.dart | 69 ++ .../generated/website_config_send.dart | 57 ++ .../generated/website_status_receive.dart | 15 +- .../generated/website_status_send.dart | 11 +- .../helper/response_mapper.helper.dart | 54 ++ 439 files changed, 11561 insertions(+), 5285 deletions(-) create mode 100644 lib/api/response/account_list_response_result.dart create mode 100644 lib/api/response/affiliate_add_company_response_result.dart create mode 100644 lib/api/response/affiliate_add_person_response_result.dart create mode 100644 lib/api/response/affiliate_register_person_response_result.dart create mode 100644 lib/api/response/confirm_email_response_result.dart create mode 100644 lib/api/response/crypto_estimations_response_result.dart create mode 100644 lib/api/response/jtoken_create_response_result.dart create mode 100644 lib/api/response/kyc_auth_status_response_result.dart create mode 100644 lib/api/response/passkeys_list_response_result.dart create mode 100644 lib/api/response/passkeys_login_response_result.dart create mode 100644 lib/api/response/passkeys_options_response_result.dart create mode 100644 lib/api/response/passkeys_register_options_response_result.dart create mode 100644 lib/api/response/passkeys_register_response_result.dart create mode 100644 lib/api/response/passkeys_rename_response_result.dart create mode 100644 lib/api/response/passkeys_revoke_response_result.dart create mode 100644 lib/api/response/paymentagent_withdraw_justification_response_result.dart create mode 100644 lib/api/response/trading_platform_leverage_response_result.dart create mode 100644 lib/api/response/website_config_response_result.dart create mode 100644 lib/basic_api/generated/account_list_receive.dart create mode 100644 lib/basic_api/generated/account_list_send.dart create mode 100644 lib/basic_api/generated/affiliate_add_company_receive.dart create mode 100644 lib/basic_api/generated/affiliate_add_company_send.dart create mode 100644 lib/basic_api/generated/affiliate_add_person_receive.dart create mode 100644 lib/basic_api/generated/affiliate_add_person_send.dart create mode 100644 lib/basic_api/generated/affiliate_register_person_receive.dart create mode 100644 lib/basic_api/generated/affiliate_register_person_send.dart create mode 100644 lib/basic_api/generated/confirm_email_receive.dart create mode 100644 lib/basic_api/generated/confirm_email_send.dart create mode 100644 lib/basic_api/generated/crypto_estimations_receive.dart create mode 100644 lib/basic_api/generated/crypto_estimations_send.dart delete mode 100644 lib/basic_api/generated/get_available_accounts_to_transfer_receive.dart delete mode 100644 lib/basic_api/generated/get_available_accounts_to_transfer_send.dart create mode 100644 lib/basic_api/generated/jtoken_create_receive.dart create mode 100644 lib/basic_api/generated/jtoken_create_send.dart create mode 100644 lib/basic_api/generated/kyc_auth_status_receive.dart create mode 100644 lib/basic_api/generated/kyc_auth_status_send.dart create mode 100644 lib/basic_api/generated/methods/account_list_receive_methods.json create mode 100644 lib/basic_api/generated/methods/affiliate_add_company_receive_methods.json create mode 100644 lib/basic_api/generated/methods/affiliate_add_person_receive_methods.json create mode 100644 lib/basic_api/generated/methods/affiliate_register_person_receive_methods.json create mode 100644 lib/basic_api/generated/methods/confirm_email_receive_methods.json create mode 100644 lib/basic_api/generated/methods/crypto_estimations_receive_methods.json create mode 100644 lib/basic_api/generated/methods/jtoken_create_receive_methods.json create mode 100644 lib/basic_api/generated/methods/kyc_auth_status_receive_methods.json create mode 100644 lib/basic_api/generated/methods/passkeys_list_receive_methods.json create mode 100644 lib/basic_api/generated/methods/passkeys_login_receive_methods.json create mode 100644 lib/basic_api/generated/methods/passkeys_options_receive_methods.json create mode 100644 lib/basic_api/generated/methods/passkeys_register_options_receive_methods.json create mode 100644 lib/basic_api/generated/methods/passkeys_register_receive_methods.json create mode 100644 lib/basic_api/generated/methods/passkeys_rename_receive_methods.json create mode 100644 lib/basic_api/generated/methods/passkeys_revoke_receive_methods.json create mode 100644 lib/basic_api/generated/methods/paymentagent_withdraw_justification_receive_methods.json create mode 100644 lib/basic_api/generated/methods/trading_platform_leverage_receive_methods.json create mode 100644 lib/basic_api/generated/methods/website_config_receive_methods.json create mode 100644 lib/basic_api/generated/passkeys_list_receive.dart create mode 100644 lib/basic_api/generated/passkeys_list_send.dart create mode 100644 lib/basic_api/generated/passkeys_login_receive.dart create mode 100644 lib/basic_api/generated/passkeys_login_send.dart create mode 100644 lib/basic_api/generated/passkeys_options_receive.dart create mode 100644 lib/basic_api/generated/passkeys_options_send.dart create mode 100644 lib/basic_api/generated/passkeys_register_options_receive.dart create mode 100644 lib/basic_api/generated/passkeys_register_options_send.dart create mode 100644 lib/basic_api/generated/passkeys_register_receive.dart create mode 100644 lib/basic_api/generated/passkeys_register_send.dart create mode 100644 lib/basic_api/generated/passkeys_rename_receive.dart create mode 100644 lib/basic_api/generated/passkeys_rename_send.dart create mode 100644 lib/basic_api/generated/passkeys_revoke_receive.dart create mode 100644 lib/basic_api/generated/passkeys_revoke_send.dart create mode 100644 lib/basic_api/generated/paymentagent_withdraw_justification_receive.dart create mode 100644 lib/basic_api/generated/paymentagent_withdraw_justification_send.dart create mode 100644 lib/basic_api/generated/trading_platform_leverage_receive.dart create mode 100644 lib/basic_api/generated/trading_platform_leverage_send.dart create mode 100644 lib/basic_api/generated/website_config_receive.dart create mode 100644 lib/basic_api/generated/website_config_send.dart diff --git a/lib/api/response/account_closure_response_result.dart b/lib/api/response/account_closure_response_result.dart index d19fdc5012..01c56b55e4 100644 --- a/lib/api/response/account_closure_response_result.dart +++ b/lib/api/response/account_closure_response_result.dart @@ -19,10 +19,8 @@ abstract class AccountClosureResponseModel { class AccountClosureResponse extends AccountClosureResponseModel { /// Initializes Account closure response class. const AccountClosureResponse({ - bool? accountClosure, - }) : super( - accountClosure: accountClosure, - ); + super.accountClosure, + }); /// Creates an instance from JSON. factory AccountClosureResponse.fromJson( diff --git a/lib/api/response/account_list_response_result.dart b/lib/api/response/account_list_response_result.dart new file mode 100644 index 0000000000..bcef45fb5c --- /dev/null +++ b/lib/api/response/account_list_response_result.dart @@ -0,0 +1,296 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Account list response model class. +abstract class AccountListResponseModel { + /// Initializes Account list response model class . + const AccountListResponseModel({ + this.accountList, + }); + + /// List of accounts for current user. This is also available from the `authroize` call. + final List? accountList; +} + +/// Account list response class. +class AccountListResponse extends AccountListResponseModel { + /// Initializes Account list response class. + const AccountListResponse({ + super.accountList, + }); + + /// Creates an instance from JSON. + factory AccountListResponse.fromJson( + dynamic accountListJson, + ) => + AccountListResponse( + accountList: accountListJson == null + ? null + : List.from( + accountListJson?.map( + (dynamic item) => AccountListItem.fromJson(item), + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (accountList != null) { + resultMap['account_list'] = accountList! + .map( + (AccountListItem item) => item.toJson(), + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + AccountListResponse copyWith({ + List? accountList, + }) => + AccountListResponse( + accountList: accountList ?? this.accountList, + ); +} + +/// AccountCategoryEnum mapper. +final Map accountCategoryEnumMapper = + { + "trading": AccountCategoryEnum.trading, + "wallet": AccountCategoryEnum.wallet, +}; + +/// AccountCategory Enum. +enum AccountCategoryEnum { + /// trading. + trading, + + /// wallet. + wallet, +} + +/// PlatformEnum mapper. +final Map platformEnumMapper = { + "ctrader": PlatformEnum.ctrader, + "derivez": PlatformEnum.derivez, + "dtrade": PlatformEnum.dtrade, + "dwallet": PlatformEnum.dwallet, + "dxtrade": PlatformEnum.dxtrade, + "mt5": PlatformEnum.mt5, +}; + +/// Platform Enum. +enum PlatformEnum { + /// ctrader. + ctrader, + + /// derivez. + derivez, + + /// dtrade. + dtrade, + + /// dwallet. + dwallet, + + /// dxtrade. + dxtrade, + + /// mt5. + mt5, +} +/// Account list item model class. +abstract class AccountListItemModel { + /// Initializes Account list item model class . + const AccountListItemModel({ + required this.loginid, + required this.linkedTo, + required this.landingCompanyName, + required this.isVirtual, + required this.isDisabled, + required this.currency, + required this.createdAt, + required this.accountType, + required this.accountCategory, + this.broker, + }); + + /// The account ID of specified account. + final String loginid; + + /// Details of the list of Trading accounts linked to the Wallet account. + final List linkedTo; + + /// Landing company shortcode the account belongs to. + final String landingCompanyName; + + /// Boolean value: `true` or `false`, indicating whether the account is a virtual-money account. + final bool isVirtual; + + /// Boolean value: `true` or `false`, indicating whether the account is marked as disabled or not. + final bool isDisabled; + + /// Currency of specified account. + final String currency; + + /// Creation time of the account as epoch. + final DateTime createdAt; + + /// Account type. + final String accountType; + + /// Account category. + final AccountCategoryEnum accountCategory; + + /// 2 letter broker code. + final String? broker; +} + +/// Account list item class. +class AccountListItem extends AccountListItemModel { + /// Initializes Account list item class. + const AccountListItem({ + required super.accountCategory, + required super.accountType, + required super.createdAt, + required super.currency, + required super.isDisabled, + required super.isVirtual, + required super.landingCompanyName, + required super.linkedTo, + required super.loginid, + super.broker, + }); + + /// Creates an instance from JSON. + factory AccountListItem.fromJson(Map json) => + AccountListItem( + accountCategory: accountCategoryEnumMapper[json['account_category']]!, + accountType: json['account_type'], + createdAt: getDateTime(json['created_at'])!, + currency: json['currency'], + isDisabled: getBool(json['is_disabled'])!, + isVirtual: getBool(json['is_virtual'])!, + landingCompanyName: json['landing_company_name'], + linkedTo: List.from( + json['linked_to'].map( + (dynamic item) => LinkedToItem.fromJson(item), + ), + ), + loginid: json['loginid'], + broker: json['broker'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['account_category'] = accountCategoryEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == accountCategory) + .key; + resultMap['account_type'] = accountType; + resultMap['created_at'] = getSecondsSinceEpochDateTime(createdAt); + resultMap['currency'] = currency; + resultMap['is_disabled'] = isDisabled; + resultMap['is_virtual'] = isVirtual; + resultMap['landing_company_name'] = landingCompanyName; + resultMap['linked_to'] = linkedTo + .map( + (LinkedToItem item) => item.toJson(), + ) + .toList(); + + resultMap['loginid'] = loginid; + resultMap['broker'] = broker; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + AccountListItem copyWith({ + AccountCategoryEnum? accountCategory, + String? accountType, + DateTime? createdAt, + String? currency, + bool? isDisabled, + bool? isVirtual, + String? landingCompanyName, + List? linkedTo, + String? loginid, + String? broker, + }) => + AccountListItem( + accountCategory: accountCategory ?? this.accountCategory, + accountType: accountType ?? this.accountType, + createdAt: createdAt ?? this.createdAt, + currency: currency ?? this.currency, + isDisabled: isDisabled ?? this.isDisabled, + isVirtual: isVirtual ?? this.isVirtual, + landingCompanyName: landingCompanyName ?? this.landingCompanyName, + linkedTo: linkedTo ?? this.linkedTo, + loginid: loginid ?? this.loginid, + broker: broker ?? this.broker, + ); +} +/// Linked to item model class. +abstract class LinkedToItemModel { + /// Initializes Linked to item model class . + const LinkedToItemModel({ + this.loginid, + this.platform, + }); + + /// Account ID. + final String? loginid; + + /// Account platform name. + final PlatformEnum? platform; +} + +/// Linked to item class. +class LinkedToItem extends LinkedToItemModel { + /// Initializes Linked to item class. + const LinkedToItem({ + super.loginid, + super.platform, + }); + + /// Creates an instance from JSON. + factory LinkedToItem.fromJson(Map json) => LinkedToItem( + loginid: json['loginid'], + platform: json['platform'] == null + ? null + : platformEnumMapper[json['platform']], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['loginid'] = loginid; + resultMap['platform'] = platformEnumMapper.entries + .firstWhere( + (MapEntry entry) => entry.value == platform) + .key; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + LinkedToItem copyWith({ + String? loginid, + PlatformEnum? platform, + }) => + LinkedToItem( + loginid: loginid ?? this.loginid, + platform: platform ?? this.platform, + ); +} diff --git a/lib/api/response/account_security_response_result.dart b/lib/api/response/account_security_response_result.dart index 7b78c33647..9cda186520 100644 --- a/lib/api/response/account_security_response_result.dart +++ b/lib/api/response/account_security_response_result.dart @@ -19,10 +19,8 @@ abstract class AccountSecurityResponseModel { class AccountSecurityResponse extends AccountSecurityResponseModel { /// Initializes Account security response class. const AccountSecurityResponse({ - AccountSecurity? accountSecurity, - }) : super( - accountSecurity: accountSecurity, - ); + super.accountSecurity, + }); /// Creates an instance from JSON. factory AccountSecurityResponse.fromJson( @@ -68,10 +66,8 @@ abstract class AccountSecurityModel { class AccountSecurity extends AccountSecurityModel { /// Initializes Account security class. const AccountSecurity({ - Totp? totp, - }) : super( - totp: totp, - ); + super.totp, + }); /// Creates an instance from JSON. factory AccountSecurity.fromJson(Map json) => @@ -117,12 +113,9 @@ abstract class TotpModel { class Totp extends TotpModel { /// Initializes Totp class. const Totp({ - bool? isEnabled, - String? secretKey, - }) : super( - isEnabled: isEnabled, - secretKey: secretKey, - ); + super.isEnabled, + super.secretKey, + }); /// Creates an instance from JSON. factory Totp.fromJson(Map json) => Totp( diff --git a/lib/api/response/account_statistics_response_result.dart b/lib/api/response/account_statistics_response_result.dart index 33c73b856a..357c0a924e 100644 --- a/lib/api/response/account_statistics_response_result.dart +++ b/lib/api/response/account_statistics_response_result.dart @@ -19,10 +19,8 @@ abstract class AccountStatisticsResponseModel { class AccountStatisticsResponse extends AccountStatisticsResponseModel { /// Initializes Account statistics response class. const AccountStatisticsResponse({ - AccountStatistics? accountStatistics, - }) : super( - accountStatistics: accountStatistics, - ); + super.accountStatistics, + }); /// Creates an instance from JSON. factory AccountStatisticsResponse.fromJson( @@ -76,14 +74,10 @@ abstract class AccountStatisticsModel { class AccountStatistics extends AccountStatisticsModel { /// Initializes Account statistics class. const AccountStatistics({ - String? currency, - double? totalDeposits, - double? totalWithdrawals, - }) : super( - currency: currency, - totalDeposits: totalDeposits, - totalWithdrawals: totalWithdrawals, - ); + super.currency, + super.totalDeposits, + super.totalWithdrawals, + }); /// Creates an instance from JSON. factory AccountStatistics.fromJson(Map json) => diff --git a/lib/api/response/active_symbols_response_result.dart b/lib/api/response/active_symbols_response_result.dart index d646bdf460..e5cad6afaa 100644 --- a/lib/api/response/active_symbols_response_result.dart +++ b/lib/api/response/active_symbols_response_result.dart @@ -24,10 +24,8 @@ abstract class ActiveSymbolsResponseModel { class ActiveSymbolsResponse extends ActiveSymbolsResponseModel { /// Initializes Active symbols response class. const ActiveSymbolsResponse({ - List? activeSymbols, - }) : super( - activeSymbols: activeSymbols, - ); + super.activeSymbols, + }); /// Creates an instance from JSON. factory ActiveSymbolsResponse.fromJson( @@ -88,7 +86,6 @@ class ActiveSymbolsResponse extends ActiveSymbolsResponseModel { activeSymbols: activeSymbols ?? this.activeSymbols, ); } - /// Active symbols item model class. abstract class ActiveSymbolsItemModel { /// Initializes Active symbols item model class . @@ -188,52 +185,29 @@ abstract class ActiveSymbolsItemModel { class ActiveSymbolsItem extends ActiveSymbolsItemModel { /// Initializes Active symbols item class. const ActiveSymbolsItem({ - required String displayName, - required int displayOrder, - required bool exchangeIsOpen, - required bool isTradingSuspended, - required String market, - required String marketDisplayName, - required double pip, - required String subgroup, - required String subgroupDisplayName, - required String submarket, - required String submarketDisplayName, - required String symbol, - required String symbolType, - bool? allowForwardStarting, - int? delayAmount, - String? exchangeName, - int? intradayIntervalMinutes, - String? quotedCurrencySymbol, - double? spot, - String? spotAge, - String? spotPercentageChange, - String? spotTime, - }) : super( - displayName: displayName, - displayOrder: displayOrder, - exchangeIsOpen: exchangeIsOpen, - isTradingSuspended: isTradingSuspended, - market: market, - marketDisplayName: marketDisplayName, - pip: pip, - subgroup: subgroup, - subgroupDisplayName: subgroupDisplayName, - submarket: submarket, - submarketDisplayName: submarketDisplayName, - symbol: symbol, - symbolType: symbolType, - allowForwardStarting: allowForwardStarting, - delayAmount: delayAmount, - exchangeName: exchangeName, - intradayIntervalMinutes: intradayIntervalMinutes, - quotedCurrencySymbol: quotedCurrencySymbol, - spot: spot, - spotAge: spotAge, - spotPercentageChange: spotPercentageChange, - spotTime: spotTime, - ); + required super.displayName, + required super.displayOrder, + required super.exchangeIsOpen, + required super.isTradingSuspended, + required super.market, + required super.marketDisplayName, + required super.pip, + required super.subgroup, + required super.subgroupDisplayName, + required super.submarket, + required super.submarketDisplayName, + required super.symbol, + required super.symbolType, + super.allowForwardStarting, + super.delayAmount, + super.exchangeName, + super.intradayIntervalMinutes, + super.quotedCurrencySymbol, + super.spot, + super.spotAge, + super.spotPercentageChange, + super.spotTime, + }); /// Creates an instance from JSON. factory ActiveSymbolsItem.fromJson(Map json) => diff --git a/lib/api/response/affiliate_add_company_response_result.dart b/lib/api/response/affiliate_add_company_response_result.dart new file mode 100644 index 0000000000..175f69b276 --- /dev/null +++ b/lib/api/response/affiliate_add_company_response_result.dart @@ -0,0 +1,239 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Affiliate add company response model class. +abstract class AffiliateAddCompanyResponseModel { + /// Initializes Affiliate add company response model class . + const AffiliateAddCompanyResponseModel({ + this.affiliateAddCompany, + }); + + /// The information of the affiliate user trying to register. + final AffiliateAddCompany? affiliateAddCompany; +} + +/// Affiliate add company response class. +class AffiliateAddCompanyResponse extends AffiliateAddCompanyResponseModel { + /// Initializes Affiliate add company response class. + const AffiliateAddCompanyResponse({ + super.affiliateAddCompany, + }); + + /// Creates an instance from JSON. + factory AffiliateAddCompanyResponse.fromJson( + dynamic affiliateAddCompanyJson, + ) => + AffiliateAddCompanyResponse( + affiliateAddCompany: affiliateAddCompanyJson == null + ? null + : AffiliateAddCompany.fromJson(affiliateAddCompanyJson), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (affiliateAddCompany != null) { + resultMap['affiliate_add_company'] = affiliateAddCompany!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + AffiliateAddCompanyResponse copyWith({ + AffiliateAddCompany? affiliateAddCompany, + }) => + AffiliateAddCompanyResponse( + affiliateAddCompany: affiliateAddCompany ?? this.affiliateAddCompany, + ); +} +/// Affiliate add company model class. +abstract class AffiliateAddCompanyModel { + /// Initializes Affiliate add company model class . + const AffiliateAddCompanyModel({ + required this.real, + required this.demo, + this.addressPostcode, + this.addressState, + this.addressStreet, + this.affiliateId, + this.bta, + this.companyName, + this.companyRegisterNumber, + this.country, + this.dateOfBirth, + this.firstName, + this.lastName, + this.nonPepDeclaration, + this.phone, + this.tncAccepted, + this.verificationCode, + }); + + /// Real created account details + final Map real; + + /// Demo(VRTC) created account details + final Map demo; + + /// Postal code of the address. + final String? addressPostcode; + + /// State / Region of the address. + final String? addressState; + + /// First line of address. + final String? addressStreet; + + /// Affiliate ID from CellXperts for the created affiliate + final String? affiliateId; + + /// [Optional] BTA id field for master affiliate. + final int? bta; + + /// Name of the company trying to register. + final String? companyName; + + /// Company registration number. + final String? companyRegisterNumber; + + /// Registered country of the created affiliate. + final String? country; + + /// Birth date of user trying to register + final String? dateOfBirth; + + /// First name of the created affiliate. + final String? firstName; + + /// Last name of the created affiliate + final String? lastName; + + /// PEP declaration status of the created affiliate. + final bool? nonPepDeclaration; + + /// Registered phone number of the created affiliate. + final String? phone; + + /// Terms and conditions acceptance status of the created affiliate. + final bool? tncAccepted; + + /// Email verification code (received from a `verify_email` call, which must be done first). + final String? verificationCode; +} + +/// Affiliate add company class. +class AffiliateAddCompany extends AffiliateAddCompanyModel { + /// Initializes Affiliate add company class. + const AffiliateAddCompany({ + required super.demo, + required super.real, + super.addressPostcode, + super.addressState, + super.addressStreet, + super.affiliateId, + super.bta, + super.companyName, + super.companyRegisterNumber, + super.country, + super.dateOfBirth, + super.firstName, + super.lastName, + super.nonPepDeclaration, + super.phone, + super.tncAccepted, + super.verificationCode, + }); + + /// Creates an instance from JSON. + factory AffiliateAddCompany.fromJson(Map json) => + AffiliateAddCompany( + demo: json['demo'], + real: json['real'], + addressPostcode: json['address_postcode'], + addressState: json['address_state'], + addressStreet: json['address_street'], + affiliateId: json['affiliate_id'], + bta: json['bta'], + companyName: json['company_name'], + companyRegisterNumber: json['company_register_number'], + country: json['country'], + dateOfBirth: json['date_of_birth'], + firstName: json['first_name'], + lastName: json['last_name'], + nonPepDeclaration: getBool(json['non_pep_declaration']), + phone: json['phone'], + tncAccepted: getBool(json['tnc_accepted']), + verificationCode: json['verification_code'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['demo'] = demo; + resultMap['real'] = real; + resultMap['address_postcode'] = addressPostcode; + resultMap['address_state'] = addressState; + resultMap['address_street'] = addressStreet; + resultMap['affiliate_id'] = affiliateId; + resultMap['bta'] = bta; + resultMap['company_name'] = companyName; + resultMap['company_register_number'] = companyRegisterNumber; + resultMap['country'] = country; + resultMap['date_of_birth'] = dateOfBirth; + resultMap['first_name'] = firstName; + resultMap['last_name'] = lastName; + resultMap['non_pep_declaration'] = nonPepDeclaration; + resultMap['phone'] = phone; + resultMap['tnc_accepted'] = tncAccepted; + resultMap['verification_code'] = verificationCode; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + AffiliateAddCompany copyWith({ + Map? demo, + Map? real, + String? addressPostcode, + String? addressState, + String? addressStreet, + String? affiliateId, + int? bta, + String? companyName, + String? companyRegisterNumber, + String? country, + String? dateOfBirth, + String? firstName, + String? lastName, + bool? nonPepDeclaration, + String? phone, + bool? tncAccepted, + String? verificationCode, + }) => + AffiliateAddCompany( + demo: demo ?? this.demo, + real: real ?? this.real, + addressPostcode: addressPostcode ?? this.addressPostcode, + addressState: addressState ?? this.addressState, + addressStreet: addressStreet ?? this.addressStreet, + affiliateId: affiliateId ?? this.affiliateId, + bta: bta ?? this.bta, + companyName: companyName ?? this.companyName, + companyRegisterNumber: + companyRegisterNumber ?? this.companyRegisterNumber, + country: country ?? this.country, + dateOfBirth: dateOfBirth ?? this.dateOfBirth, + firstName: firstName ?? this.firstName, + lastName: lastName ?? this.lastName, + nonPepDeclaration: nonPepDeclaration ?? this.nonPepDeclaration, + phone: phone ?? this.phone, + tncAccepted: tncAccepted ?? this.tncAccepted, + verificationCode: verificationCode ?? this.verificationCode, + ); +} diff --git a/lib/api/response/affiliate_add_person_response_result.dart b/lib/api/response/affiliate_add_person_response_result.dart new file mode 100644 index 0000000000..0a0ada6297 --- /dev/null +++ b/lib/api/response/affiliate_add_person_response_result.dart @@ -0,0 +1,220 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Affiliate add person response model class. +abstract class AffiliateAddPersonResponseModel { + /// Initializes Affiliate add person response model class . + const AffiliateAddPersonResponseModel({ + this.affiliateAddPerson, + }); + + /// The information of the affiliate user trying to register. + final AffiliateAddPerson? affiliateAddPerson; +} + +/// Affiliate add person response class. +class AffiliateAddPersonResponse extends AffiliateAddPersonResponseModel { + /// Initializes Affiliate add person response class. + const AffiliateAddPersonResponse({ + super.affiliateAddPerson, + }); + + /// Creates an instance from JSON. + factory AffiliateAddPersonResponse.fromJson( + dynamic affiliateAddPersonJson, + ) => + AffiliateAddPersonResponse( + affiliateAddPerson: affiliateAddPersonJson == null + ? null + : AffiliateAddPerson.fromJson(affiliateAddPersonJson), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (affiliateAddPerson != null) { + resultMap['affiliate_add_person'] = affiliateAddPerson!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + AffiliateAddPersonResponse copyWith({ + AffiliateAddPerson? affiliateAddPerson, + }) => + AffiliateAddPersonResponse( + affiliateAddPerson: affiliateAddPerson ?? this.affiliateAddPerson, + ); +} +/// Affiliate add person model class. +abstract class AffiliateAddPersonModel { + /// Initializes Affiliate add person model class . + const AffiliateAddPersonModel({ + required this.real, + required this.demo, + this.addressPostcode, + this.addressState, + this.addressStreet, + this.affiliateId, + this.bta, + this.country, + this.dateOfBirth, + this.firstName, + this.lastName, + this.nonPepDeclaration, + this.phone, + this.tncAccepted, + this.verificationCode, + }); + + /// Real created account details + final Map real; + + /// Demo(VRTC) created account details + final Map demo; + + /// Postal code of the address. + final String? addressPostcode; + + /// State / Region of the address. + final String? addressState; + + /// First line of address. + final String? addressStreet; + + /// Affiliate ID from CellXperts for the created affiliate + final String? affiliateId; + + /// [Optional] BTA id field for master affiliate. + final int? bta; + + /// Registered country of the created affiliate. + final String? country; + + /// Birth date of user trying to register + final String? dateOfBirth; + + /// First name of the created affiliate. + final String? firstName; + + /// Last name of the created affiliate + final String? lastName; + + /// PEP declaration status of the created affiliate. + final bool? nonPepDeclaration; + + /// Registered phone number of the created affiliate. + final String? phone; + + /// Terms and conditions acceptance status of the created affiliate. + final bool? tncAccepted; + + /// Email verification code (received from a `verify_email` call, which must be done first). + final String? verificationCode; +} + +/// Affiliate add person class. +class AffiliateAddPerson extends AffiliateAddPersonModel { + /// Initializes Affiliate add person class. + const AffiliateAddPerson({ + required super.demo, + required super.real, + super.addressPostcode, + super.addressState, + super.addressStreet, + super.affiliateId, + super.bta, + super.country, + super.dateOfBirth, + super.firstName, + super.lastName, + super.nonPepDeclaration, + super.phone, + super.tncAccepted, + super.verificationCode, + }); + + /// Creates an instance from JSON. + factory AffiliateAddPerson.fromJson(Map json) => + AffiliateAddPerson( + demo: json['demo'], + real: json['real'], + addressPostcode: json['address_postcode'], + addressState: json['address_state'], + addressStreet: json['address_street'], + affiliateId: json['affiliate_id'], + bta: json['bta'], + country: json['country'], + dateOfBirth: json['date_of_birth'], + firstName: json['first_name'], + lastName: json['last_name'], + nonPepDeclaration: getBool(json['non_pep_declaration']), + phone: json['phone'], + tncAccepted: getBool(json['tnc_accepted']), + verificationCode: json['verification_code'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['demo'] = demo; + resultMap['real'] = real; + resultMap['address_postcode'] = addressPostcode; + resultMap['address_state'] = addressState; + resultMap['address_street'] = addressStreet; + resultMap['affiliate_id'] = affiliateId; + resultMap['bta'] = bta; + resultMap['country'] = country; + resultMap['date_of_birth'] = dateOfBirth; + resultMap['first_name'] = firstName; + resultMap['last_name'] = lastName; + resultMap['non_pep_declaration'] = nonPepDeclaration; + resultMap['phone'] = phone; + resultMap['tnc_accepted'] = tncAccepted; + resultMap['verification_code'] = verificationCode; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + AffiliateAddPerson copyWith({ + Map? demo, + Map? real, + String? addressPostcode, + String? addressState, + String? addressStreet, + String? affiliateId, + int? bta, + String? country, + String? dateOfBirth, + String? firstName, + String? lastName, + bool? nonPepDeclaration, + String? phone, + bool? tncAccepted, + String? verificationCode, + }) => + AffiliateAddPerson( + demo: demo ?? this.demo, + real: real ?? this.real, + addressPostcode: addressPostcode ?? this.addressPostcode, + addressState: addressState ?? this.addressState, + addressStreet: addressStreet ?? this.addressStreet, + affiliateId: affiliateId ?? this.affiliateId, + bta: bta ?? this.bta, + country: country ?? this.country, + dateOfBirth: dateOfBirth ?? this.dateOfBirth, + firstName: firstName ?? this.firstName, + lastName: lastName ?? this.lastName, + nonPepDeclaration: nonPepDeclaration ?? this.nonPepDeclaration, + phone: phone ?? this.phone, + tncAccepted: tncAccepted ?? this.tncAccepted, + verificationCode: verificationCode ?? this.verificationCode, + ); +} diff --git a/lib/api/response/affiliate_register_person_response_result.dart b/lib/api/response/affiliate_register_person_response_result.dart new file mode 100644 index 0000000000..2be66bda91 --- /dev/null +++ b/lib/api/response/affiliate_register_person_response_result.dart @@ -0,0 +1,50 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Affiliate register person response model class. +abstract class AffiliateRegisterPersonResponseModel { + /// Initializes Affiliate register person response model class . + const AffiliateRegisterPersonResponseModel({ + this.success, + }); + + /// Affiliate was successfully added, `false`:unsuccessful `true`:successful + final bool? success; +} + +/// Affiliate register person response class. +class AffiliateRegisterPersonResponse + extends AffiliateRegisterPersonResponseModel { + /// Initializes Affiliate register person response class. + const AffiliateRegisterPersonResponse({ + super.success, + }); + + /// Creates an instance from JSON. + factory AffiliateRegisterPersonResponse.fromJson( + dynamic successJson, + ) => + AffiliateRegisterPersonResponse( + success: getBool(successJson), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['success'] = success; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + AffiliateRegisterPersonResponse copyWith({ + bool? success, + }) => + AffiliateRegisterPersonResponse( + success: success ?? this.success, + ); +} diff --git a/lib/api/response/api_token_response_result.dart b/lib/api/response/api_token_response_result.dart index 9a665700e3..30477bd762 100644 --- a/lib/api/response/api_token_response_result.dart +++ b/lib/api/response/api_token_response_result.dart @@ -24,10 +24,8 @@ abstract class ApiTokenResponseModel { class ApiTokenResponse extends ApiTokenResponseModel { /// Initializes Api token response class. const ApiTokenResponse({ - ApiToken? apiToken, - }) : super( - apiToken: apiToken, - ); + super.apiToken, + }); /// Creates an instance from JSON. factory ApiTokenResponse.fromJson( @@ -134,7 +132,6 @@ enum ScopesItemEnum { /// admin. admin, } - /// Api token model class. abstract class ApiTokenModel { /// Initializes Api token model class . @@ -158,14 +155,10 @@ abstract class ApiTokenModel { class ApiToken extends ApiTokenModel { /// Initializes Api token class. const ApiToken({ - int? deleteToken, - int? newToken, - List? tokens, - }) : super( - deleteToken: deleteToken, - newToken: newToken, - tokens: tokens, - ); + super.deleteToken, + super.newToken, + super.tokens, + }); /// Creates an instance from JSON. factory ApiToken.fromJson(Map json) => ApiToken( @@ -209,7 +202,6 @@ class ApiToken extends ApiTokenModel { tokens: tokens ?? this.tokens, ); } - /// Tokens item model class. abstract class TokensItemModel { /// Initializes Tokens item model class . @@ -241,18 +233,12 @@ abstract class TokensItemModel { class TokensItem extends TokensItemModel { /// Initializes Tokens item class. const TokensItem({ - String? displayName, - String? lastUsed, - List? scopes, - String? token, - String? validForIp, - }) : super( - displayName: displayName, - lastUsed: lastUsed, - scopes: scopes, - token: token, - validForIp: validForIp, - ); + super.displayName, + super.lastUsed, + super.scopes, + super.token, + super.validForIp, + }); /// Creates an instance from JSON. factory TokensItem.fromJson(Map json) => TokensItem( diff --git a/lib/api/response/app_delete_response_result.dart b/lib/api/response/app_delete_response_result.dart index c5945ec156..c62c9dccf4 100644 --- a/lib/api/response/app_delete_response_result.dart +++ b/lib/api/response/app_delete_response_result.dart @@ -24,10 +24,8 @@ abstract class AppDeleteResponseModel { class AppDeleteResponse extends AppDeleteResponseModel { /// Initializes App delete response class. const AppDeleteResponse({ - int? appDelete, - }) : super( - appDelete: appDelete, - ); + super.appDelete, + }); /// Creates an instance from JSON. factory AppDeleteResponse.fromJson( diff --git a/lib/api/response/app_get_response_result.dart b/lib/api/response/app_get_response_result.dart index a914b47eb2..524efcc97d 100644 --- a/lib/api/response/app_get_response_result.dart +++ b/lib/api/response/app_get_response_result.dart @@ -37,10 +37,8 @@ abstract class AppGetResponseModel { class AppGetResponse extends AppGetResponseModel { /// Initializes App get response class. const AppGetResponse({ - AppGet? appGet, - }) : super( - appGet: appGet, - ); + super.appGet, + }); /// Creates an instance from JSON. factory AppGetResponse.fromJson( @@ -186,7 +184,6 @@ class AppGetResponse extends AppGetResponseModel { appGet: appGet ?? this.appGet, ); } - /// App get model class. abstract class AppGetModel { /// Initializes App get model class . @@ -242,30 +239,18 @@ abstract class AppGetModel { class AppGet extends AppGetModel { /// Initializes App get class. const AppGet({ - required int appId, - required double appMarkupPercentage, - required String appstore, - required String github, - required String googleplay, - required String homepage, - required String name, - required String redirectUri, - required String verificationUri, - int? active, - List? scopes, - }) : super( - appId: appId, - appMarkupPercentage: appMarkupPercentage, - appstore: appstore, - github: github, - googleplay: googleplay, - homepage: homepage, - name: name, - redirectUri: redirectUri, - verificationUri: verificationUri, - active: active, - scopes: scopes, - ); + required super.appId, + required super.appMarkupPercentage, + required super.appstore, + required super.github, + required super.googleplay, + required super.homepage, + required super.name, + required super.redirectUri, + required super.verificationUri, + super.active, + super.scopes, + }); /// Creates an instance from JSON. factory AppGet.fromJson(Map json) => AppGet( diff --git a/lib/api/response/app_list_response_result.dart b/lib/api/response/app_list_response_result.dart index 7cb8fbe1b5..ab2fd828e7 100644 --- a/lib/api/response/app_list_response_result.dart +++ b/lib/api/response/app_list_response_result.dart @@ -25,10 +25,8 @@ abstract class AppListResponseModel { class AppListResponse extends AppListResponseModel { /// Initializes App list response class. const AppListResponse({ - List? appList, - }) : super( - appList: appList, - ); + super.appList, + }); /// Creates an instance from JSON. factory AppListResponse.fromJson( @@ -87,7 +85,6 @@ class AppListResponse extends AppListResponseModel { appList: appList ?? this.appList, ); } - /// App list item model class. abstract class AppListItemModel { /// Initializes App list item model class . @@ -143,30 +140,18 @@ abstract class AppListItemModel { class AppListItem extends AppListItemModel { /// Initializes App list item class. const AppListItem({ - required int appId, - required double appMarkupPercentage, - required String name, - required String redirectUri, - int? active, - String? appstore, - String? github, - String? googleplay, - String? homepage, - List? scopes, - String? verificationUri, - }) : super( - appId: appId, - appMarkupPercentage: appMarkupPercentage, - name: name, - redirectUri: redirectUri, - active: active, - appstore: appstore, - github: github, - googleplay: googleplay, - homepage: homepage, - scopes: scopes, - verificationUri: verificationUri, - ); + required super.appId, + required super.appMarkupPercentage, + required super.name, + required super.redirectUri, + super.active, + super.appstore, + super.github, + super.googleplay, + super.homepage, + super.scopes, + super.verificationUri, + }); /// Creates an instance from JSON. factory AppListItem.fromJson(Map json) => AppListItem( diff --git a/lib/api/response/app_markup_details_response_result.dart b/lib/api/response/app_markup_details_response_result.dart index 3e7075aa59..06a048df18 100644 --- a/lib/api/response/app_markup_details_response_result.dart +++ b/lib/api/response/app_markup_details_response_result.dart @@ -24,10 +24,8 @@ abstract class AppMarkupDetailsResponseModel { class AppMarkupDetailsResponse extends AppMarkupDetailsResponseModel { /// Initializes App markup details response class. const AppMarkupDetailsResponse({ - AppMarkupDetails? appMarkupDetails, - }) : super( - appMarkupDetails: appMarkupDetails, - ); + super.appMarkupDetails, + }); /// Creates an instance from JSON. factory AppMarkupDetailsResponse.fromJson( @@ -78,7 +76,6 @@ class AppMarkupDetailsResponse extends AppMarkupDetailsResponseModel { appMarkupDetails: appMarkupDetails ?? this.appMarkupDetails, ); } - /// App markup details model class. abstract class AppMarkupDetailsModel { /// Initializes App markup details model class . @@ -94,10 +91,8 @@ abstract class AppMarkupDetailsModel { class AppMarkupDetails extends AppMarkupDetailsModel { /// Initializes App markup details class. const AppMarkupDetails({ - List? transactions, - }) : super( - transactions: transactions, - ); + super.transactions, + }); /// Creates an instance from JSON. factory AppMarkupDetails.fromJson(Map json) => @@ -134,7 +129,6 @@ class AppMarkupDetails extends AppMarkupDetailsModel { transactions: transactions ?? this.transactions, ); } - /// Transactions item model class. abstract class TransactionsItemModel { /// Initializes Transactions item model class . @@ -186,28 +180,17 @@ abstract class TransactionsItemModel { class TransactionsItem extends TransactionsItemModel { /// Initializes Transactions item class. const TransactionsItem({ - int? appId, - double? appMarkup, - double? appMarkupUsd, - double? appMarkupValue, - String? clientCurrcode, - String? clientLoginid, - String? devCurrcode, - String? devLoginid, - int? transactionId, - String? transactionTime, - }) : super( - appId: appId, - appMarkup: appMarkup, - appMarkupUsd: appMarkupUsd, - appMarkupValue: appMarkupValue, - clientCurrcode: clientCurrcode, - clientLoginid: clientLoginid, - devCurrcode: devCurrcode, - devLoginid: devLoginid, - transactionId: transactionId, - transactionTime: transactionTime, - ); + super.appId, + super.appMarkup, + super.appMarkupUsd, + super.appMarkupValue, + super.clientCurrcode, + super.clientLoginid, + super.devCurrcode, + super.devLoginid, + super.transactionId, + super.transactionTime, + }); /// Creates an instance from JSON. factory TransactionsItem.fromJson(Map json) => diff --git a/lib/api/response/app_markup_statistics_response_result.dart b/lib/api/response/app_markup_statistics_response_result.dart index c7d38bd19c..be36c2b6c7 100644 --- a/lib/api/response/app_markup_statistics_response_result.dart +++ b/lib/api/response/app_markup_statistics_response_result.dart @@ -19,10 +19,8 @@ abstract class AppMarkupStatisticsResponseModel { class AppMarkupStatisticsResponse extends AppMarkupStatisticsResponseModel { /// Initializes App markup statistics response class. const AppMarkupStatisticsResponse({ - AppMarkupStatistics? appMarkupStatistics, - }) : super( - appMarkupStatistics: appMarkupStatistics, - ); + super.appMarkupStatistics, + }); /// Creates an instance from JSON. factory AppMarkupStatisticsResponse.fromJson( @@ -76,14 +74,10 @@ abstract class AppMarkupStatisticsModel { class AppMarkupStatistics extends AppMarkupStatisticsModel { /// Initializes App markup statistics class. const AppMarkupStatistics({ - List? breakdown, - double? totalAppMarkupUsd, - double? totalTransactionsCount, - }) : super( - breakdown: breakdown, - totalAppMarkupUsd: totalAppMarkupUsd, - totalTransactionsCount: totalTransactionsCount, - ); + super.breakdown, + super.totalAppMarkupUsd, + super.totalTransactionsCount, + }); /// Creates an instance from JSON. factory AppMarkupStatistics.fromJson(Map json) => @@ -160,18 +154,12 @@ abstract class BreakdownItemModel { class BreakdownItem extends BreakdownItemModel { /// Initializes Breakdown item class. const BreakdownItem({ - int? appId, - double? appMarkupUsd, - double? appMarkupValue, - String? devCurrcode, - double? transactionsCount, - }) : super( - appId: appId, - appMarkupUsd: appMarkupUsd, - appMarkupValue: appMarkupValue, - devCurrcode: devCurrcode, - transactionsCount: transactionsCount, - ); + super.appId, + super.appMarkupUsd, + super.appMarkupValue, + super.devCurrcode, + super.transactionsCount, + }); /// Creates an instance from JSON. factory BreakdownItem.fromJson(Map json) => BreakdownItem( diff --git a/lib/api/response/app_register_response_result.dart b/lib/api/response/app_register_response_result.dart index 082f4616cb..1130290a57 100644 --- a/lib/api/response/app_register_response_result.dart +++ b/lib/api/response/app_register_response_result.dart @@ -25,10 +25,8 @@ abstract class AppRegisterResponseModel { class AppRegisterResponse extends AppRegisterResponseModel { /// Initializes App register response class. const AppRegisterResponse({ - AppRegister? appRegister, - }) : super( - appRegister: appRegister, - ); + super.appRegister, + }); /// Creates an instance from JSON. factory AppRegisterResponse.fromJson( @@ -79,7 +77,6 @@ class AppRegisterResponse extends AppRegisterResponseModel { appRegister: appRegister ?? this.appRegister, ); } - /// App register model class. abstract class AppRegisterModel { /// Initializes App register model class . @@ -135,30 +132,18 @@ abstract class AppRegisterModel { class AppRegister extends AppRegisterModel { /// Initializes App register class. const AppRegister({ - required int appId, - required double appMarkupPercentage, - required String appstore, - required String github, - required String googleplay, - required String homepage, - required String name, - required String redirectUri, - required String verificationUri, - int? active, - List? scopes, - }) : super( - appId: appId, - appMarkupPercentage: appMarkupPercentage, - appstore: appstore, - github: github, - googleplay: googleplay, - homepage: homepage, - name: name, - redirectUri: redirectUri, - verificationUri: verificationUri, - active: active, - scopes: scopes, - ); + required super.appId, + required super.appMarkupPercentage, + required super.appstore, + required super.github, + required super.googleplay, + required super.homepage, + required super.name, + required super.redirectUri, + required super.verificationUri, + super.active, + super.scopes, + }); /// Creates an instance from JSON. factory AppRegister.fromJson(Map json) => AppRegister( diff --git a/lib/api/response/app_update_response_result.dart b/lib/api/response/app_update_response_result.dart index 158ca4dcd9..aa99365731 100644 --- a/lib/api/response/app_update_response_result.dart +++ b/lib/api/response/app_update_response_result.dart @@ -25,10 +25,8 @@ abstract class AppUpdateResponseModel { class AppUpdateResponse extends AppUpdateResponseModel { /// Initializes App update response class. const AppUpdateResponse({ - AppUpdate? appUpdate, - }) : super( - appUpdate: appUpdate, - ); + super.appUpdate, + }); /// Creates an instance from JSON. factory AppUpdateResponse.fromJson( @@ -77,7 +75,6 @@ class AppUpdateResponse extends AppUpdateResponseModel { appUpdate: appUpdate ?? this.appUpdate, ); } - /// App update model class. abstract class AppUpdateModel { /// Initializes App update model class . @@ -133,30 +130,18 @@ abstract class AppUpdateModel { class AppUpdate extends AppUpdateModel { /// Initializes App update class. const AppUpdate({ - int? active, - int? appId, - double? appMarkupPercentage, - String? appstore, - String? github, - String? googleplay, - String? homepage, - String? name, - String? redirectUri, - List? scopes, - String? verificationUri, - }) : super( - active: active, - appId: appId, - appMarkupPercentage: appMarkupPercentage, - appstore: appstore, - github: github, - googleplay: googleplay, - homepage: homepage, - name: name, - redirectUri: redirectUri, - scopes: scopes, - verificationUri: verificationUri, - ); + super.active, + super.appId, + super.appMarkupPercentage, + super.appstore, + super.github, + super.googleplay, + super.homepage, + super.name, + super.redirectUri, + super.scopes, + super.verificationUri, + }); /// Creates an instance from JSON. factory AppUpdate.fromJson(Map json) => AppUpdate( diff --git a/lib/api/response/asset_index_response_result.dart b/lib/api/response/asset_index_response_result.dart index 3747bd71b2..b8ca1a12cf 100644 --- a/lib/api/response/asset_index_response_result.dart +++ b/lib/api/response/asset_index_response_result.dart @@ -25,10 +25,8 @@ abstract class AssetIndexResponseModel { class AssetIndexResponse extends AssetIndexResponseModel { /// Initializes Asset index response class. const AssetIndexResponse({ - List? assetIndex, - }) : super( - assetIndex: assetIndex, - ); + super.assetIndex, + }); /// Creates an instance from JSON. factory AssetIndexResponse.fromJson( diff --git a/lib/api/response/authorize_response_result.dart b/lib/api/response/authorize_response_result.dart index 555276e7f6..ff7c8b2f78 100644 --- a/lib/api/response/authorize_response_result.dart +++ b/lib/api/response/authorize_response_result.dart @@ -109,6 +109,7 @@ enum AccountCategoryEnum { /// PlatformEnum mapper. final Map platformEnumMapper = { + "ctrader": PlatformEnum.ctrader, "derivez": PlatformEnum.derivez, "dtrade": PlatformEnum.dtrade, "dwallet": PlatformEnum.dwallet, @@ -118,6 +119,9 @@ final Map platformEnumMapper = { /// Platform Enum. enum PlatformEnum { + /// ctrader. + ctrader, + /// derivez. derivez, @@ -155,7 +159,7 @@ abstract class AuthorizeModel { this.userId, }); - /// List of accounts for current user. + /// List of accounts for current user. This is also available from the `account_list` call. final List? accountList; /// Cash balance of the account. @@ -373,6 +377,7 @@ abstract class AccountListItemModel { const AccountListItemModel({ this.accountCategory, this.accountType, + this.broker, this.createdAt, this.currency, this.excludedUntil, @@ -389,6 +394,9 @@ abstract class AccountListItemModel { /// Account type. final String? accountType; + /// 2 letter broker code. + final String? broker; + /// Creation time of the account as epoch. final DateTime? createdAt; @@ -420,6 +428,7 @@ class AccountListItem extends AccountListItemModel { const AccountListItem({ super.accountCategory, super.accountType, + super.broker, super.createdAt, super.currency, super.excludedUntil, @@ -437,6 +446,7 @@ class AccountListItem extends AccountListItemModel { ? null : accountCategoryEnumMapper[json['account_category']], accountType: json['account_type'], + broker: json['broker'], createdAt: getDateTime(json['created_at']), currency: json['currency'], excludedUntil: getDateTime(json['excluded_until']), @@ -462,6 +472,7 @@ class AccountListItem extends AccountListItemModel { entry.value == accountCategory) .key; resultMap['account_type'] = accountType; + resultMap['broker'] = broker; resultMap['created_at'] = getSecondsSinceEpochDateTime(createdAt); resultMap['currency'] = currency; resultMap['excluded_until'] = getSecondsSinceEpochDateTime(excludedUntil); @@ -484,6 +495,7 @@ class AccountListItem extends AccountListItemModel { AccountListItem copyWith({ AccountCategoryEnum? accountCategory, String? accountType, + String? broker, DateTime? createdAt, String? currency, DateTime? excludedUntil, @@ -496,6 +508,7 @@ class AccountListItem extends AccountListItemModel { AccountListItem( accountCategory: accountCategory ?? this.accountCategory, accountType: accountType ?? this.accountType, + broker: broker ?? this.broker, createdAt: createdAt ?? this.createdAt, currency: currency ?? this.currency, excludedUntil: excludedUntil ?? this.excludedUntil, diff --git a/lib/api/response/balance_response_result.dart b/lib/api/response/balance_response_result.dart index 1ad7a4bf56..4f1304536f 100644 --- a/lib/api/response/balance_response_result.dart +++ b/lib/api/response/balance_response_result.dart @@ -36,12 +36,9 @@ abstract class BalanceResponseModel { class BalanceResponse extends BalanceResponseModel { /// Initializes Balance response class. const BalanceResponse({ - Balance? balance, - Subscription? subscription, - }) : super( - balance: balance, - subscription: subscription, - ); + super.balance, + super.subscription, + }); /// Creates an instance from JSON. factory BalanceResponse.fromJson( @@ -172,7 +169,6 @@ enum TypeEnum { /// deriv. deriv, } - /// Balance model class. abstract class BalanceModel { /// Initializes Balance model class . @@ -208,20 +204,13 @@ abstract class BalanceModel { class Balance extends BalanceModel { /// Initializes Balance class. const Balance({ - required double balance, - required String currency, - required String loginid, - Map? accounts, - String? id, - Total? total, - }) : super( - balance: balance, - currency: currency, - loginid: loginid, - accounts: accounts, - id: id, - total: total, - ); + required super.balance, + required super.currency, + required super.loginid, + super.accounts, + super.id, + super.total, + }); /// Creates an instance from JSON. factory Balance.fromJson(Map json) => Balance( @@ -274,7 +263,6 @@ class Balance extends BalanceModel { total: total ?? this.total, ); } - /// Accounts property model class. abstract class AccountsPropertyModel { /// Initializes Accounts property model class . @@ -310,20 +298,13 @@ abstract class AccountsPropertyModel { class AccountsProperty extends AccountsPropertyModel { /// Initializes Accounts property class. const AccountsProperty({ - required double balance, - required double convertedAmount, - required String currency, - required bool demoAccount, - required bool status, - required TypeEnum type, - }) : super( - balance: balance, - convertedAmount: convertedAmount, - currency: currency, - demoAccount: demoAccount, - status: status, - type: type, - ); + required super.balance, + required super.convertedAmount, + required super.currency, + required super.demoAccount, + required super.status, + required super.type, + }); /// Creates an instance from JSON. factory AccountsProperty.fromJson(Map json) => @@ -370,7 +351,6 @@ class AccountsProperty extends AccountsPropertyModel { type: type ?? this.type, ); } - /// Total model class. abstract class TotalModel { /// Initializes Total model class . @@ -398,16 +378,11 @@ abstract class TotalModel { class Total extends TotalModel { /// Initializes Total class. const Total({ - Deriv? deriv, - DerivDemo? derivDemo, - Mt5? mt5, - Mt5Demo? mt5Demo, - }) : super( - deriv: deriv, - derivDemo: derivDemo, - mt5: mt5, - mt5Demo: mt5Demo, - ); + super.deriv, + super.derivDemo, + super.mt5, + super.mt5Demo, + }); /// Creates an instance from JSON. factory Total.fromJson(Map json) => Total( @@ -455,7 +430,6 @@ class Total extends TotalModel { mt5Demo: mt5Demo ?? this.mt5Demo, ); } - /// Deriv model class. abstract class DerivModel { /// Initializes Deriv model class . @@ -475,12 +449,9 @@ abstract class DerivModel { class Deriv extends DerivModel { /// Initializes Deriv class. const Deriv({ - required double amount, - required String currency, - }) : super( - amount: amount, - currency: currency, - ); + required super.amount, + required super.currency, + }); /// Creates an instance from JSON. factory Deriv.fromJson(Map json) => Deriv( @@ -508,7 +479,6 @@ class Deriv extends DerivModel { currency: currency ?? this.currency, ); } - /// Deriv demo model class. abstract class DerivDemoModel { /// Initializes Deriv demo model class . @@ -528,12 +498,9 @@ abstract class DerivDemoModel { class DerivDemo extends DerivDemoModel { /// Initializes Deriv demo class. const DerivDemo({ - required double amount, - required String currency, - }) : super( - amount: amount, - currency: currency, - ); + required super.amount, + required super.currency, + }); /// Creates an instance from JSON. factory DerivDemo.fromJson(Map json) => DerivDemo( @@ -561,7 +528,6 @@ class DerivDemo extends DerivDemoModel { currency: currency ?? this.currency, ); } - /// Mt5 model class. abstract class Mt5Model { /// Initializes Mt5 model class . @@ -581,12 +547,9 @@ abstract class Mt5Model { class Mt5 extends Mt5Model { /// Initializes Mt5 class. const Mt5({ - required double amount, - required String currency, - }) : super( - amount: amount, - currency: currency, - ); + required super.amount, + required super.currency, + }); /// Creates an instance from JSON. factory Mt5.fromJson(Map json) => Mt5( @@ -614,7 +577,6 @@ class Mt5 extends Mt5Model { currency: currency ?? this.currency, ); } - /// Mt5 demo model class. abstract class Mt5DemoModel { /// Initializes Mt5 demo model class . @@ -634,12 +596,9 @@ abstract class Mt5DemoModel { class Mt5Demo extends Mt5DemoModel { /// Initializes Mt5 demo class. const Mt5Demo({ - required double amount, - required String currency, - }) : super( - amount: amount, - currency: currency, - ); + required super.amount, + required super.currency, + }); /// Creates an instance from JSON. factory Mt5Demo.fromJson(Map json) => Mt5Demo( @@ -667,7 +626,6 @@ class Mt5Demo extends Mt5DemoModel { currency: currency ?? this.currency, ); } - /// Subscription model class. abstract class SubscriptionModel { /// Initializes Subscription model class . @@ -683,10 +641,8 @@ abstract class SubscriptionModel { class Subscription extends SubscriptionModel { /// Initializes Subscription class. const Subscription({ - required String id, - }) : super( - id: id, - ); + required super.id, + }); /// Creates an instance from JSON. factory Subscription.fromJson(Map json) => Subscription( diff --git a/lib/api/response/buy_contract_for_multiple_accounts_response_result.dart b/lib/api/response/buy_contract_for_multiple_accounts_response_result.dart index cc8c8ebfbc..e561f66899 100644 --- a/lib/api/response/buy_contract_for_multiple_accounts_response_result.dart +++ b/lib/api/response/buy_contract_for_multiple_accounts_response_result.dart @@ -19,10 +19,8 @@ class BuyContractForMultipleAccountsResponse extends BuyContractForMultipleAccountsResponseModel { /// Initializes Buy contract for multiple accounts response class. const BuyContractForMultipleAccountsResponse({ - BuyContractForMultipleAccounts? buyContractForMultipleAccounts, - }) : super( - buyContractForMultipleAccounts: buyContractForMultipleAccounts, - ); + super.buyContractForMultipleAccounts, + }); /// Creates an instance from JSON. factory BuyContractForMultipleAccountsResponse.fromJson( @@ -73,10 +71,8 @@ class BuyContractForMultipleAccounts extends BuyContractForMultipleAccountsModel { /// Initializes Buy contract for multiple accounts class. const BuyContractForMultipleAccounts({ - required List> result, - }) : super( - result: result, - ); + required super.result, + }); /// Creates an instance from JSON. factory BuyContractForMultipleAccounts.fromJson(Map json) => diff --git a/lib/api/response/buy_response_result.dart b/lib/api/response/buy_response_result.dart index 77d11d7a7e..4419933a8b 100644 --- a/lib/api/response/buy_response_result.dart +++ b/lib/api/response/buy_response_result.dart @@ -16,7 +16,6 @@ import 'package:flutter_deriv_api/helpers/helpers.dart'; import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; import 'package:flutter_deriv_api/services/connection/call_manager/base_call_manager.dart'; import 'package:deriv_dependency_injector/dependency_injector.dart'; - /// Buy response model class. abstract class BuyResponseModel { /// Initializes Buy response model class . @@ -36,12 +35,9 @@ abstract class BuyResponseModel { class BuyResponse extends BuyResponseModel { /// Initializes Buy response class. const BuyResponse({ - Buy? buy, - Subscription? subscription, - }) : super( - buy: buy, - subscription: subscription, - ); + super.buy, + super.subscription, + }); /// Creates an instance from JSON. factory BuyResponse.fromJson( @@ -161,7 +157,6 @@ class BuyResponse extends BuyResponseModel { subscription: subscription ?? this.subscription, ); } - /// Buy model class. abstract class BuyModel { /// Initializes Buy model class . @@ -209,26 +204,16 @@ abstract class BuyModel { class Buy extends BuyModel { /// Initializes Buy class. const Buy({ - required double balanceAfter, - required double buyPrice, - required int contractId, - required String longcode, - required double payout, - required DateTime purchaseTime, - required String shortcode, - required DateTime startTime, - required int transactionId, - }) : super( - balanceAfter: balanceAfter, - buyPrice: buyPrice, - contractId: contractId, - longcode: longcode, - payout: payout, - purchaseTime: purchaseTime, - shortcode: shortcode, - startTime: startTime, - transactionId: transactionId, - ); + required super.balanceAfter, + required super.buyPrice, + required super.contractId, + required super.longcode, + required super.payout, + required super.purchaseTime, + required super.shortcode, + required super.startTime, + required super.transactionId, + }); /// Creates an instance from JSON. factory Buy.fromJson(Map json) => Buy( @@ -284,7 +269,6 @@ class Buy extends BuyModel { transactionId: transactionId ?? this.transactionId, ); } - /// Subscription model class. abstract class SubscriptionModel { /// Initializes Subscription model class . @@ -300,10 +284,8 @@ abstract class SubscriptionModel { class Subscription extends SubscriptionModel { /// Initializes Subscription class. const Subscription({ - required String id, - }) : super( - id: id, - ); + required super.id, + }); /// Creates an instance from JSON. factory Subscription.fromJson(Map json) => Subscription( diff --git a/lib/api/response/cancel_response_result.dart b/lib/api/response/cancel_response_result.dart index 5ebcdc8da8..dd005e22a7 100644 --- a/lib/api/response/cancel_response_result.dart +++ b/lib/api/response/cancel_response_result.dart @@ -25,10 +25,8 @@ abstract class CancelResponseModel { class CancelResponse extends CancelResponseModel { /// Initializes Cancel response class. const CancelResponse({ - Cancel? cancel, - }) : super( - cancel: cancel, - ); + super.cancel, + }); /// Creates an instance from JSON. factory CancelResponse.fromJson( @@ -74,7 +72,6 @@ class CancelResponse extends CancelResponseModel { cancel: cancel ?? this.cancel, ); } - /// Cancel model class. abstract class CancelModel { /// Initializes Cancel model class . @@ -106,18 +103,12 @@ abstract class CancelModel { class Cancel extends CancelModel { /// Initializes Cancel class. const Cancel({ - double? balanceAfter, - int? contractId, - int? referenceId, - double? soldFor, - int? transactionId, - }) : super( - balanceAfter: balanceAfter, - contractId: contractId, - referenceId: referenceId, - soldFor: soldFor, - transactionId: transactionId, - ); + super.balanceAfter, + super.contractId, + super.referenceId, + super.soldFor, + super.transactionId, + }); /// Creates an instance from JSON. factory Cancel.fromJson(Map json) => Cancel( diff --git a/lib/api/response/cashier_response_result.dart b/lib/api/response/cashier_response_result.dart index a15605f57b..89c2fefb95 100644 --- a/lib/api/response/cashier_response_result.dart +++ b/lib/api/response/cashier_response_result.dart @@ -29,12 +29,9 @@ abstract class CashierResponseModel { class CashierResponse extends CashierResponseModel { /// Initializes Cashier response class. const CashierResponse({ - String? cashierString, - CashierObject? cashierObject, - }) : super( - cashierString: cashierString, - cashierObject: cashierObject, - ); + super.cashierString, + super.cashierObject, + }); /// Creates an instance from JSON. factory CashierResponse.fromJson( @@ -104,7 +101,6 @@ enum ActionEnum { /// withdraw. withdraw, } - /// Cashier object model class. abstract class CashierObjectModel { /// Initializes Cashier object model class . @@ -128,14 +124,10 @@ abstract class CashierObjectModel { class CashierObject extends CashierObjectModel { /// Initializes Cashier object class. const CashierObject({ - required ActionEnum action, - Deposit? deposit, - Map? withdraw, - }) : super( - action: action, - deposit: deposit, - withdraw: withdraw, - ); + required super.action, + super.deposit, + super.withdraw, + }); /// Creates an instance from JSON. factory CashierObject.fromJson(Map json) => CashierObject( @@ -173,7 +165,6 @@ class CashierObject extends CashierObjectModel { withdraw: withdraw ?? this.withdraw, ); } - /// Deposit model class. abstract class DepositModel { /// Initializes Deposit model class . @@ -189,10 +180,8 @@ abstract class DepositModel { class Deposit extends DepositModel { /// Initializes Deposit class. const Deposit({ - required String address, - }) : super( - address: address, - ); + required super.address, + }); /// Creates an instance from JSON. factory Deposit.fromJson(Map json) => Deposit( diff --git a/lib/api/response/cashier_withdrawal_cancel_response_result.dart b/lib/api/response/cashier_withdrawal_cancel_response_result.dart index faaa3a284c..b00f67da0b 100644 --- a/lib/api/response/cashier_withdrawal_cancel_response_result.dart +++ b/lib/api/response/cashier_withdrawal_cancel_response_result.dart @@ -20,10 +20,8 @@ class CashierWithdrawalCancelResponse extends CashierWithdrawalCancelResponseModel { /// Initializes Cashier withdrawal cancel response class. const CashierWithdrawalCancelResponse({ - CashierWithdrawalCancel? cashierWithdrawalCancel, - }) : super( - cashierWithdrawalCancel: cashierWithdrawalCancel, - ); + super.cashierWithdrawalCancel, + }); /// Creates an instance from JSON. factory CashierWithdrawalCancelResponse.fromJson( @@ -87,12 +85,9 @@ abstract class CashierWithdrawalCancelModel { class CashierWithdrawalCancel extends CashierWithdrawalCancelModel { /// Initializes Cashier withdrawal cancel class. const CashierWithdrawalCancel({ - required String id, - required StatusCodeEnum statusCode, - }) : super( - id: id, - statusCode: statusCode, - ); + required super.id, + required super.statusCode, + }); /// Creates an instance from JSON. factory CashierWithdrawalCancel.fromJson(Map json) => diff --git a/lib/api/response/change_email_response_result.dart b/lib/api/response/change_email_response_result.dart index aef9a64649..c25990df9e 100644 --- a/lib/api/response/change_email_response_result.dart +++ b/lib/api/response/change_email_response_result.dart @@ -19,10 +19,8 @@ abstract class ChangeEmailResponseModel { class ChangeEmailResponse extends ChangeEmailResponseModel { /// Initializes Change email response class. const ChangeEmailResponse({ - bool? changeEmail, - }) : super( - changeEmail: changeEmail, - ); + super.changeEmail, + }); /// Creates an instance from JSON. factory ChangeEmailResponse.fromJson( diff --git a/lib/api/response/change_password_response_result.dart b/lib/api/response/change_password_response_result.dart index 295b07c6dd..02f5e9f41e 100644 --- a/lib/api/response/change_password_response_result.dart +++ b/lib/api/response/change_password_response_result.dart @@ -19,10 +19,8 @@ abstract class ChangePasswordResponseModel { class ChangePasswordResponse extends ChangePasswordResponseModel { /// Initializes Change password response class. const ChangePasswordResponse({ - bool? changePassword, - }) : super( - changePassword: changePassword, - ); + super.changePassword, + }); /// Creates an instance from JSON. factory ChangePasswordResponse.fromJson( diff --git a/lib/api/response/confirm_email_response_result.dart b/lib/api/response/confirm_email_response_result.dart new file mode 100644 index 0000000000..39151eecd4 --- /dev/null +++ b/lib/api/response/confirm_email_response_result.dart @@ -0,0 +1,49 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Confirm email response model class. +abstract class ConfirmEmailResponseModel { + /// Initializes Confirm email response model class . + const ConfirmEmailResponseModel({ + this.confirmEmail, + }); + + /// 1 for success (The verification code has been successfully verified) + final bool? confirmEmail; +} + +/// Confirm email response class. +class ConfirmEmailResponse extends ConfirmEmailResponseModel { + /// Initializes Confirm email response class. + const ConfirmEmailResponse({ + super.confirmEmail, + }); + + /// Creates an instance from JSON. + factory ConfirmEmailResponse.fromJson( + dynamic confirmEmailJson, + ) => + ConfirmEmailResponse( + confirmEmail: getBool(confirmEmailJson), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['confirm_email'] = confirmEmail; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + ConfirmEmailResponse copyWith({ + bool? confirmEmail, + }) => + ConfirmEmailResponse( + confirmEmail: confirmEmail ?? this.confirmEmail, + ); +} diff --git a/lib/api/response/contract_update_history_response_result.dart b/lib/api/response/contract_update_history_response_result.dart index 45bcc33ae2..7a2550c167 100644 --- a/lib/api/response/contract_update_history_response_result.dart +++ b/lib/api/response/contract_update_history_response_result.dart @@ -25,10 +25,8 @@ abstract class ContractUpdateHistoryResponseModel { class ContractUpdateHistoryResponse extends ContractUpdateHistoryResponseModel { /// Initializes Contract update history response class. const ContractUpdateHistoryResponse({ - List? contractUpdateHistory, - }) : super( - contractUpdateHistory: contractUpdateHistory, - ); + super.contractUpdateHistory, + }); /// Creates an instance from JSON. factory ContractUpdateHistoryResponse.fromJson( @@ -89,7 +87,6 @@ class ContractUpdateHistoryResponse extends ContractUpdateHistoryResponseModel { contractUpdateHistory ?? this.contractUpdateHistory, ); } - /// Contract update history item model class. abstract class ContractUpdateHistoryItemModel { /// Initializes Contract update history item model class . @@ -121,18 +118,12 @@ abstract class ContractUpdateHistoryItemModel { class ContractUpdateHistoryItem extends ContractUpdateHistoryItemModel { /// Initializes Contract update history item class. const ContractUpdateHistoryItem({ - String? displayName, - String? orderAmount, - DateTime? orderDate, - String? orderType, - String? value, - }) : super( - displayName: displayName, - orderAmount: orderAmount, - orderDate: orderDate, - orderType: orderType, - value: value, - ); + super.displayName, + super.orderAmount, + super.orderDate, + super.orderType, + super.value, + }); /// Creates an instance from JSON. factory ContractUpdateHistoryItem.fromJson(Map json) => diff --git a/lib/api/response/contract_update_response_result.dart b/lib/api/response/contract_update_response_result.dart index 4eb247d49f..86e983fe3b 100644 --- a/lib/api/response/contract_update_response_result.dart +++ b/lib/api/response/contract_update_response_result.dart @@ -25,10 +25,8 @@ abstract class ContractUpdateResponseModel { class ContractUpdateResponse extends ContractUpdateResponseModel { /// Initializes Contract update response class. const ContractUpdateResponse({ - ContractUpdate? contractUpdate, - }) : super( - contractUpdate: contractUpdate, - ); + super.contractUpdate, + }); /// Creates an instance from JSON. factory ContractUpdateResponse.fromJson( @@ -78,7 +76,6 @@ class ContractUpdateResponse extends ContractUpdateResponseModel { contractUpdate: contractUpdate ?? this.contractUpdate, ); } - /// Contract update model class. abstract class ContractUpdateModel { /// Initializes Contract update model class . @@ -98,12 +95,9 @@ abstract class ContractUpdateModel { class ContractUpdate extends ContractUpdateModel { /// Initializes Contract update class. const ContractUpdate({ - StopLoss? stopLoss, - TakeProfit? takeProfit, - }) : super( - stopLoss: stopLoss, - takeProfit: takeProfit, - ); + super.stopLoss, + super.takeProfit, + }); /// Creates an instance from JSON. factory ContractUpdate.fromJson(Map json) => ContractUpdate( @@ -139,7 +133,6 @@ class ContractUpdate extends ContractUpdateModel { takeProfit: takeProfit ?? this.takeProfit, ); } - /// Stop loss model class. abstract class StopLossModel extends Equatable { /// Initializes Stop loss model class . @@ -167,16 +160,11 @@ abstract class StopLossModel extends Equatable { class StopLoss extends StopLossModel { /// Initializes Stop loss class. const StopLoss({ - String? displayName, - double? orderAmount, - DateTime? orderDate, - String? value, - }) : super( - displayName: displayName, - orderAmount: orderAmount, - orderDate: orderDate, - value: value, - ); + super.displayName, + super.orderAmount, + super.orderDate, + super.value, + }); /// Creates an instance from JSON. factory StopLoss.fromJson(Map json) => StopLoss( @@ -219,7 +207,6 @@ class StopLoss extends StopLossModel { orderAmount, ]; } - /// Take profit model class. abstract class TakeProfitModel extends Equatable { /// Initializes Take profit model class . @@ -247,16 +234,11 @@ abstract class TakeProfitModel extends Equatable { class TakeProfit extends TakeProfitModel { /// Initializes Take profit class. const TakeProfit({ - String? displayName, - double? orderAmount, - DateTime? orderDate, - String? value, - }) : super( - displayName: displayName, - orderAmount: orderAmount, - orderDate: orderDate, - value: value, - ); + super.displayName, + super.orderAmount, + super.orderDate, + super.value, + }); /// Creates an instance from JSON. factory TakeProfit.fromJson(Map json) => TakeProfit( diff --git a/lib/api/response/contracts_for_response_result.dart b/lib/api/response/contracts_for_response_result.dart index c8f9b535de..f088a4d9d4 100644 --- a/lib/api/response/contracts_for_response_result.dart +++ b/lib/api/response/contracts_for_response_result.dart @@ -25,10 +25,8 @@ abstract class ContractsForResponseModel { class ContractsForResponse extends ContractsForResponseModel { /// Initializes Contracts for response class. const ContractsForResponse({ - ContractsFor? contractsFor, - }) : super( - contractsFor: contractsFor, - ); + super.contractsFor, + }); /// Creates an instance from JSON. factory ContractsForResponse.fromJson( @@ -80,7 +78,6 @@ class ContractsForResponse extends ContractsForResponseModel { contractsFor: contractsFor ?? this.contractsFor, ); } - /// Contracts for model class. abstract class ContractsForModel { /// Initializes Contracts for model class . @@ -89,6 +86,7 @@ abstract class ContractsForModel { this.close, this.feedLicense, this.hitCount, + this.nonAvailable, this.open, this.spot, }); @@ -105,6 +103,9 @@ abstract class ContractsForModel { /// Count of contracts available final double? hitCount; + /// Array of non_available contracts details + final List? nonAvailable; + /// Symbol's next market-open time as an epoch value final DateTime? open; @@ -116,20 +117,14 @@ abstract class ContractsForModel { class ContractsFor extends ContractsForModel { /// Initializes Contracts for class. const ContractsFor({ - required List available, - DateTime? close, - String? feedLicense, - double? hitCount, - DateTime? open, - double? spot, - }) : super( - available: available, - close: close, - feedLicense: feedLicense, - hitCount: hitCount, - open: open, - spot: spot, - ); + required super.available, + super.close, + super.feedLicense, + super.hitCount, + super.nonAvailable, + super.open, + super.spot, + }); /// Creates an instance from JSON. factory ContractsFor.fromJson(Map json) => ContractsFor( @@ -141,6 +136,13 @@ class ContractsFor extends ContractsForModel { close: getDateTime(json['close']), feedLicense: json['feed_license'], hitCount: getDouble(json['hit_count']), + nonAvailable: json['non_available'] == null + ? null + : List.from( + json['non_available']?.map( + (dynamic item) => item, + ), + ), open: getDateTime(json['open']), spot: getDouble(json['spot']), ); @@ -158,6 +160,13 @@ class ContractsFor extends ContractsForModel { resultMap['close'] = getSecondsSinceEpochDateTime(close); resultMap['feed_license'] = feedLicense; resultMap['hit_count'] = hitCount; + if (nonAvailable != null) { + resultMap['non_available'] = nonAvailable! + .map( + (dynamic item) => item, + ) + .toList(); + } resultMap['open'] = getSecondsSinceEpochDateTime(open); resultMap['spot'] = spot; @@ -170,6 +179,7 @@ class ContractsFor extends ContractsForModel { DateTime? close, String? feedLicense, double? hitCount, + List? nonAvailable, DateTime? open, double? spot, }) => @@ -178,11 +188,11 @@ class ContractsFor extends ContractsForModel { close: close ?? this.close, feedLicense: feedLicense ?? this.feedLicense, hitCount: hitCount ?? this.hitCount, + nonAvailable: nonAvailable ?? this.nonAvailable, open: open ?? this.open, spot: spot ?? this.spot, ); } - /// Available item model class. abstract class AvailableItemModel { /// Initializes Available item model class . @@ -212,6 +222,8 @@ abstract class AvailableItemModel { this.highBarrier, this.lastDigitRange, this.lowBarrier, + this.maxStake, + this.minStake, this.multiplierRange, this.payoutLimit, this.tradingPeriod, @@ -292,6 +304,12 @@ abstract class AvailableItemModel { /// Low barrier Details. final String? lowBarrier; + /// [Only for turbos options] Maximum contract stake + final double? maxStake; + + /// [Only for turbos options] Minimum contract stake + final double? minStake; + /// Multiplier range. final List? multiplierRange; @@ -306,64 +324,37 @@ abstract class AvailableItemModel { class AvailableItem extends AvailableItemModel { /// Initializes Available item class. const AvailableItem({ - required String barrierCategory, - required double barriers, - required String contractCategory, - required String contractCategoryDisplay, - required String contractType, - required String exchangeName, - required String expiryType, - required String market, - required String maxContractDuration, - required String minContractDuration, - required String sentiment, - required String startType, - required String submarket, - required String underlyingSymbol, - List? availableBarriers, - String? barrier, - List? barrierChoices, - List? cancellationRange, - String? contractDisplay, - List? expiredBarriers, - List? forwardStartingOptions, - List? growthRateRange, - String? highBarrier, - List? lastDigitRange, - String? lowBarrier, - List? multiplierRange, - double? payoutLimit, - Map? tradingPeriod, - }) : super( - barrierCategory: barrierCategory, - barriers: barriers, - contractCategory: contractCategory, - contractCategoryDisplay: contractCategoryDisplay, - contractType: contractType, - exchangeName: exchangeName, - expiryType: expiryType, - market: market, - maxContractDuration: maxContractDuration, - minContractDuration: minContractDuration, - sentiment: sentiment, - startType: startType, - submarket: submarket, - underlyingSymbol: underlyingSymbol, - availableBarriers: availableBarriers, - barrier: barrier, - barrierChoices: barrierChoices, - cancellationRange: cancellationRange, - contractDisplay: contractDisplay, - expiredBarriers: expiredBarriers, - forwardStartingOptions: forwardStartingOptions, - growthRateRange: growthRateRange, - highBarrier: highBarrier, - lastDigitRange: lastDigitRange, - lowBarrier: lowBarrier, - multiplierRange: multiplierRange, - payoutLimit: payoutLimit, - tradingPeriod: tradingPeriod, - ); + required super.barrierCategory, + required super.barriers, + required super.contractCategory, + required super.contractCategoryDisplay, + required super.contractType, + required super.exchangeName, + required super.expiryType, + required super.market, + required super.maxContractDuration, + required super.minContractDuration, + required super.sentiment, + required super.startType, + required super.submarket, + required super.underlyingSymbol, + super.availableBarriers, + super.barrier, + super.barrierChoices, + super.cancellationRange, + super.contractDisplay, + super.expiredBarriers, + super.forwardStartingOptions, + super.growthRateRange, + super.highBarrier, + super.lastDigitRange, + super.lowBarrier, + super.maxStake, + super.minStake, + super.multiplierRange, + super.payoutLimit, + super.tradingPeriod, + }); /// Creates an instance from JSON. factory AvailableItem.fromJson(Map json) => AvailableItem( @@ -434,6 +425,8 @@ class AvailableItem extends AvailableItemModel { ), ), lowBarrier: json['low_barrier'], + maxStake: getDouble(json['max_stake']), + minStake: getDouble(json['min_stake']), multiplierRange: json['multiplier_range'] == null ? null : List.from( @@ -516,6 +509,8 @@ class AvailableItem extends AvailableItemModel { .toList(); } resultMap['low_barrier'] = lowBarrier; + resultMap['max_stake'] = maxStake; + resultMap['min_stake'] = minStake; if (multiplierRange != null) { resultMap['multiplier_range'] = multiplierRange! .map( @@ -556,6 +551,8 @@ class AvailableItem extends AvailableItemModel { String? highBarrier, List? lastDigitRange, String? lowBarrier, + double? maxStake, + double? minStake, List? multiplierRange, double? payoutLimit, Map? tradingPeriod, @@ -588,12 +585,13 @@ class AvailableItem extends AvailableItemModel { highBarrier: highBarrier ?? this.highBarrier, lastDigitRange: lastDigitRange ?? this.lastDigitRange, lowBarrier: lowBarrier ?? this.lowBarrier, + maxStake: maxStake ?? this.maxStake, + minStake: minStake ?? this.minStake, multiplierRange: multiplierRange ?? this.multiplierRange, payoutLimit: payoutLimit ?? this.payoutLimit, tradingPeriod: tradingPeriod ?? this.tradingPeriod, ); } - /// Forward starting options item model class. abstract class ForwardStartingOptionsItemModel { /// Initializes Forward starting options item model class . @@ -621,16 +619,11 @@ abstract class ForwardStartingOptionsItemModel { class ForwardStartingOptionsItem extends ForwardStartingOptionsItemModel { /// Initializes Forward starting options item class. const ForwardStartingOptionsItem({ - List? blackouts, - String? close, - String? date, - String? open, - }) : super( - blackouts: blackouts, - close: close, - date: date, - open: open, - ); + super.blackouts, + super.close, + super.date, + super.open, + }); /// Creates an instance from JSON. factory ForwardStartingOptionsItem.fromJson(Map json) => diff --git a/lib/api/response/copy_start_response_result.dart b/lib/api/response/copy_start_response_result.dart index 9fceb8a8f7..63c5b5c153 100644 --- a/lib/api/response/copy_start_response_result.dart +++ b/lib/api/response/copy_start_response_result.dart @@ -25,10 +25,8 @@ abstract class CopyStartResponseModel { class CopyStartResponse extends CopyStartResponseModel { /// Initializes Copy start response class. const CopyStartResponse({ - int? copyStart, - }) : super( - copyStart: copyStart, - ); + super.copyStart, + }); /// Creates an instance from JSON. factory CopyStartResponse.fromJson( diff --git a/lib/api/response/copy_stop_response_result.dart b/lib/api/response/copy_stop_response_result.dart index d53a3fa34b..9c8e446f98 100644 --- a/lib/api/response/copy_stop_response_result.dart +++ b/lib/api/response/copy_stop_response_result.dart @@ -25,10 +25,8 @@ abstract class CopyStopResponseModel { class CopyStopResponse extends CopyStopResponseModel { /// Initializes Copy stop response class. const CopyStopResponse({ - int? copyStop, - }) : super( - copyStop: copyStop, - ); + super.copyStop, + }); /// Creates an instance from JSON. factory CopyStopResponse.fromJson( diff --git a/lib/api/response/copytrading_list_response_result.dart b/lib/api/response/copytrading_list_response_result.dart index 158d91def9..e4db814cad 100644 --- a/lib/api/response/copytrading_list_response_result.dart +++ b/lib/api/response/copytrading_list_response_result.dart @@ -25,10 +25,8 @@ abstract class CopytradingListResponseModel { class CopytradingListResponse extends CopytradingListResponseModel { /// Initializes Copytrading list response class. const CopytradingListResponse({ - CopytradingList? copytradingList, - }) : super( - copytradingList: copytradingList, - ); + super.copytradingList, + }); /// Creates an instance from JSON. factory CopytradingListResponse.fromJson( @@ -80,7 +78,6 @@ class CopytradingListResponse extends CopytradingListResponseModel { copytradingList: copytradingList ?? this.copytradingList, ); } - /// Copytrading list model class. abstract class CopytradingListModel { /// Initializes Copytrading list model class . @@ -100,12 +97,9 @@ abstract class CopytradingListModel { class CopytradingList extends CopytradingListModel { /// Initializes Copytrading list class. const CopytradingList({ - required List copiers, - required List traders, - }) : super( - copiers: copiers, - traders: traders, - ); + required super.copiers, + required super.traders, + }); /// Creates an instance from JSON. factory CopytradingList.fromJson(Map json) => @@ -151,7 +145,6 @@ class CopytradingList extends CopytradingListModel { traders: traders ?? this.traders, ); } - /// Copiers item model class. abstract class CopiersItemModel { /// Initializes Copiers item model class . @@ -167,10 +160,8 @@ abstract class CopiersItemModel { class CopiersItem extends CopiersItemModel { /// Initializes Copiers item class. const CopiersItem({ - required String loginid, - }) : super( - loginid: loginid, - ); + required super.loginid, + }); /// Creates an instance from JSON. factory CopiersItem.fromJson(Map json) => CopiersItem( @@ -194,7 +185,6 @@ class CopiersItem extends CopiersItemModel { loginid: loginid ?? this.loginid, ); } - /// Traders item model class. abstract class TradersItemModel { /// Initializes Traders item model class . @@ -230,20 +220,13 @@ abstract class TradersItemModel { class TradersItem extends TradersItemModel { /// Initializes Traders item class. const TradersItem({ - List? assets, - String? loginid, - double? maxTradeStake, - double? minTradeStake, - String? token, - List? tradeTypes, - }) : super( - assets: assets, - loginid: loginid, - maxTradeStake: maxTradeStake, - minTradeStake: minTradeStake, - token: token, - tradeTypes: tradeTypes, - ); + super.assets, + super.loginid, + super.maxTradeStake, + super.minTradeStake, + super.token, + super.tradeTypes, + }); /// Creates an instance from JSON. factory TradersItem.fromJson(Map json) => TradersItem( diff --git a/lib/api/response/copytrading_statistics_response_result.dart b/lib/api/response/copytrading_statistics_response_result.dart index 55c3cb30ec..c46b0faa95 100644 --- a/lib/api/response/copytrading_statistics_response_result.dart +++ b/lib/api/response/copytrading_statistics_response_result.dart @@ -25,10 +25,8 @@ abstract class CopytradingStatisticsResponseModel { class CopytradingStatisticsResponse extends CopytradingStatisticsResponseModel { /// Initializes Copytrading statistics response class. const CopytradingStatisticsResponse({ - CopytradingStatistics? copytradingStatistics, - }) : super( - copytradingStatistics: copytradingStatistics, - ); + super.copytradingStatistics, + }); /// Creates an instance from JSON. factory CopytradingStatisticsResponse.fromJson( @@ -82,7 +80,6 @@ class CopytradingStatisticsResponse extends CopytradingStatisticsResponseModel { copytradingStatistics ?? this.copytradingStatistics, ); } - /// Copytrading statistics model class. abstract class CopytradingStatisticsModel { /// Initializes Copytrading statistics model class . @@ -142,32 +139,19 @@ abstract class CopytradingStatisticsModel { class CopytradingStatistics extends CopytradingStatisticsModel { /// Initializes Copytrading statistics class. const CopytradingStatistics({ - required DateTime activeSince, - required int avgDuration, - required double avgLoss, - required double avgProfit, - required double copiers, - required double last12monthsProfitableTrades, - required Map monthlyProfitableTrades, - required double performanceProbability, - required int totalTrades, - required Map tradesBreakdown, - required double tradesProfitable, - Map? yearlyProfitableTrades, - }) : super( - activeSince: activeSince, - avgDuration: avgDuration, - avgLoss: avgLoss, - avgProfit: avgProfit, - copiers: copiers, - last12monthsProfitableTrades: last12monthsProfitableTrades, - monthlyProfitableTrades: monthlyProfitableTrades, - performanceProbability: performanceProbability, - totalTrades: totalTrades, - tradesBreakdown: tradesBreakdown, - tradesProfitable: tradesProfitable, - yearlyProfitableTrades: yearlyProfitableTrades, - ); + required super.activeSince, + required super.avgDuration, + required super.avgLoss, + required super.avgProfit, + required super.copiers, + required super.last12monthsProfitableTrades, + required super.monthlyProfitableTrades, + required super.performanceProbability, + required super.totalTrades, + required super.tradesBreakdown, + required super.tradesProfitable, + super.yearlyProfitableTrades, + }); /// Creates an instance from JSON. factory CopytradingStatistics.fromJson(Map json) => diff --git a/lib/api/response/crypto_config_response_result.dart b/lib/api/response/crypto_config_response_result.dart index f2390679f6..41e901f613 100644 --- a/lib/api/response/crypto_config_response_result.dart +++ b/lib/api/response/crypto_config_response_result.dart @@ -19,10 +19,8 @@ abstract class CryptoConfigResponseModel { class CryptoConfigResponse extends CryptoConfigResponseModel { /// Initializes Crypto config response class. const CryptoConfigResponse({ - CryptoConfig? cryptoConfig, - }) : super( - cryptoConfig: cryptoConfig, - ); + super.cryptoConfig, + }); /// Creates an instance from JSON. factory CryptoConfigResponse.fromJson( @@ -68,10 +66,8 @@ abstract class CryptoConfigModel { class CryptoConfig extends CryptoConfigModel { /// Initializes Crypto config class. const CryptoConfig({ - required Map currenciesConfig, - }) : super( - currenciesConfig: currenciesConfig, - ); + required super.currenciesConfig, + }); /// Creates an instance from JSON. factory CryptoConfig.fromJson(Map json) => CryptoConfig( @@ -120,12 +116,9 @@ abstract class CurrenciesConfigPropertyModel { class CurrenciesConfigProperty extends CurrenciesConfigPropertyModel { /// Initializes Currencies config property class. const CurrenciesConfigProperty({ - double? minimumDeposit, - double? minimumWithdrawal, - }) : super( - minimumDeposit: minimumDeposit, - minimumWithdrawal: minimumWithdrawal, - ); + super.minimumDeposit, + super.minimumWithdrawal, + }); /// Creates an instance from JSON. factory CurrenciesConfigProperty.fromJson(Map json) => diff --git a/lib/api/response/crypto_estimations_response_result.dart b/lib/api/response/crypto_estimations_response_result.dart new file mode 100644 index 0000000000..b3a0d9f66b --- /dev/null +++ b/lib/api/response/crypto_estimations_response_result.dart @@ -0,0 +1,213 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Crypto estimations response model class. +abstract class CryptoEstimationsResponseModel { + /// Initializes Crypto estimations response model class . + const CryptoEstimationsResponseModel({ + this.cryptoEstimations, + this.subscription, + }); + + /// Cryptocurrency estimations. E.g. Withdrawal fee estimations. + final Map? cryptoEstimations; + + /// For subscription requests only. + final Subscription? subscription; +} + +/// Crypto estimations response class. +class CryptoEstimationsResponse extends CryptoEstimationsResponseModel { + /// Initializes Crypto estimations response class. + const CryptoEstimationsResponse({ + super.cryptoEstimations, + super.subscription, + }); + + /// Creates an instance from JSON. + factory CryptoEstimationsResponse.fromJson( + dynamic cryptoEstimationsJson, + dynamic subscriptionJson, + ) => + CryptoEstimationsResponse( + cryptoEstimations: cryptoEstimationsJson == null + ? null + : Map.fromEntries( + cryptoEstimationsJson.entries.map< + MapEntry>( + (MapEntry entry) => + MapEntry(entry.key, + CryptoEstimationsProperty.fromJson(entry.value)))), + subscription: subscriptionJson == null + ? null + : Subscription.fromJson(subscriptionJson), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['crypto_estimations'] = cryptoEstimations; + if (subscription != null) { + resultMap['subscription'] = subscription!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + CryptoEstimationsResponse copyWith({ + Map? cryptoEstimations, + Subscription? subscription, + }) => + CryptoEstimationsResponse( + cryptoEstimations: cryptoEstimations ?? this.cryptoEstimations, + subscription: subscription ?? this.subscription, + ); +} +/// Crypto estimations property model class. +abstract class CryptoEstimationsPropertyModel { + /// Initializes Crypto estimations property model class . + const CryptoEstimationsPropertyModel({ + this.withdrawalFee, + }); + + /// Estimated fee for crypto withdrawal calculated based on the current network conditions. + final WithdrawalFee? withdrawalFee; +} + +/// Crypto estimations property class. +class CryptoEstimationsProperty extends CryptoEstimationsPropertyModel { + /// Initializes Crypto estimations property class. + const CryptoEstimationsProperty({ + super.withdrawalFee, + }); + + /// Creates an instance from JSON. + factory CryptoEstimationsProperty.fromJson(Map json) => + CryptoEstimationsProperty( + withdrawalFee: json['withdrawal_fee'] == null + ? null + : WithdrawalFee.fromJson(json['withdrawal_fee']), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (withdrawalFee != null) { + resultMap['withdrawal_fee'] = withdrawalFee!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + CryptoEstimationsProperty copyWith({ + WithdrawalFee? withdrawalFee, + }) => + CryptoEstimationsProperty( + withdrawalFee: withdrawalFee ?? this.withdrawalFee, + ); +} +/// Withdrawal fee model class. +abstract class WithdrawalFeeModel { + /// Initializes Withdrawal fee model class . + const WithdrawalFeeModel({ + this.expiryTime, + this.uniqueId, + this.value, + }); + + /// Expiry time for the estimated fee in epoch. + final DateTime? expiryTime; + + /// Unique identifier for the estimated fee which allows locking the fee for a client. + final String? uniqueId; + + /// Value of current estimated fee. + final double? value; +} + +/// Withdrawal fee class. +class WithdrawalFee extends WithdrawalFeeModel { + /// Initializes Withdrawal fee class. + const WithdrawalFee({ + super.expiryTime, + super.uniqueId, + super.value, + }); + + /// Creates an instance from JSON. + factory WithdrawalFee.fromJson(Map json) => WithdrawalFee( + expiryTime: getDateTime(json['expiry_time']), + uniqueId: json['unique_id'], + value: getDouble(json['value']), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['expiry_time'] = getSecondsSinceEpochDateTime(expiryTime); + resultMap['unique_id'] = uniqueId; + resultMap['value'] = value; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + WithdrawalFee copyWith({ + DateTime? expiryTime, + String? uniqueId, + double? value, + }) => + WithdrawalFee( + expiryTime: expiryTime ?? this.expiryTime, + uniqueId: uniqueId ?? this.uniqueId, + value: value ?? this.value, + ); +} +/// Subscription model class. +abstract class SubscriptionModel { + /// Initializes Subscription model class . + const SubscriptionModel({ + required this.id, + }); + + /// A per-connection unique identifier. Can be passed to the `forget` API call to unsubscribe. + final String id; +} + +/// Subscription class. +class Subscription extends SubscriptionModel { + /// Initializes Subscription class. + const Subscription({ + required super.id, + }); + + /// Creates an instance from JSON. + factory Subscription.fromJson(Map json) => Subscription( + id: json['id'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['id'] = id; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + Subscription copyWith({ + String? id, + }) => + Subscription( + id: id ?? this.id, + ); +} diff --git a/lib/api/response/document_upload_response_result.dart b/lib/api/response/document_upload_response_result.dart index de689ddf13..fe2365ec76 100644 --- a/lib/api/response/document_upload_response_result.dart +++ b/lib/api/response/document_upload_response_result.dart @@ -18,10 +18,8 @@ abstract class DocumentUploadResponseModel { class DocumentUploadResponse extends DocumentUploadResponseModel { /// Initializes Document upload response class. const DocumentUploadResponse({ - DocumentUpload? documentUpload, - }) : super( - documentUpload: documentUpload, - ); + super.documentUpload, + }); /// Creates an instance from JSON. factory DocumentUploadResponse.fromJson( @@ -87,20 +85,13 @@ abstract class DocumentUploadModel { class DocumentUpload extends DocumentUploadModel { /// Initializes Document upload class. const DocumentUpload({ - required double callType, - required double uploadId, - String? checksum, - String? documentIssuingCountry, - double? size, - String? status, - }) : super( - callType: callType, - uploadId: uploadId, - checksum: checksum, - documentIssuingCountry: documentIssuingCountry, - size: size, - status: status, - ); + required super.callType, + required super.uploadId, + super.checksum, + super.documentIssuingCountry, + super.size, + super.status, + }); /// Creates an instance from JSON. factory DocumentUpload.fromJson(Map json) => DocumentUpload( diff --git a/lib/api/response/economic_calendar_response_result.dart b/lib/api/response/economic_calendar_response_result.dart index 537ae6e6e9..aa91d3d8db 100644 --- a/lib/api/response/economic_calendar_response_result.dart +++ b/lib/api/response/economic_calendar_response_result.dart @@ -18,10 +18,8 @@ abstract class EconomicCalendarResponseModel { class EconomicCalendarResponse extends EconomicCalendarResponseModel { /// Initializes Economic calendar response class. const EconomicCalendarResponse({ - EconomicCalendar? economicCalendar, - }) : super( - economicCalendar: economicCalendar, - ); + super.economicCalendar, + }); /// Creates an instance from JSON. factory EconomicCalendarResponse.fromJson( @@ -67,10 +65,8 @@ abstract class EconomicCalendarModel { class EconomicCalendar extends EconomicCalendarModel { /// Initializes Economic calendar class. const EconomicCalendar({ - List? events, - }) : super( - events: events, - ); + super.events, + }); /// Creates an instance from JSON. factory EconomicCalendar.fromJson(Map json) => @@ -146,22 +142,14 @@ abstract class EventsItemModel { class EventsItem extends EventsItemModel { /// Initializes Events item class. const EventsItem({ - Actual? actual, - String? currency, - String? eventName, - Forecast? forecast, - int? impact, - Previous? previous, - DateTime? releaseDate, - }) : super( - actual: actual, - currency: currency, - eventName: eventName, - forecast: forecast, - impact: impact, - previous: previous, - releaseDate: releaseDate, - ); + super.actual, + super.currency, + super.eventName, + super.forecast, + super.impact, + super.previous, + super.releaseDate, + }); /// Creates an instance from JSON. factory EventsItem.fromJson(Map json) => EventsItem( @@ -234,10 +222,8 @@ abstract class ActualModel { class Actual extends ActualModel { /// Initializes Actual class. const Actual({ - String? displayValue, - }) : super( - displayValue: displayValue, - ); + super.displayValue, + }); /// Creates an instance from JSON. factory Actual.fromJson(Map json) => Actual( @@ -276,10 +262,8 @@ abstract class ForecastModel { class Forecast extends ForecastModel { /// Initializes Forecast class. const Forecast({ - String? displayValue, - }) : super( - displayValue: displayValue, - ); + super.displayValue, + }); /// Creates an instance from JSON. factory Forecast.fromJson(Map json) => Forecast( @@ -318,10 +302,8 @@ abstract class PreviousModel { class Previous extends PreviousModel { /// Initializes Previous class. const Previous({ - String? displayValue, - }) : super( - displayValue: displayValue, - ); + super.displayValue, + }); /// Creates an instance from JSON. factory Previous.fromJson(Map json) => Previous( diff --git a/lib/api/response/exchange_rates_response_result.dart b/lib/api/response/exchange_rates_response_result.dart index 110f256561..d6585ce550 100644 --- a/lib/api/response/exchange_rates_response_result.dart +++ b/lib/api/response/exchange_rates_response_result.dart @@ -9,7 +9,6 @@ import 'package:flutter_deriv_api/basic_api/generated/exchange_rates_send.dart'; import 'package:flutter_deriv_api/helpers/helpers.dart'; import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; import 'package:deriv_dependency_injector/dependency_injector.dart'; -import 'package:flutter_deriv_api/api/response/exchange_rates_response_extended.dart'; /// Exchange rates response model class. abstract class ExchangeRatesResponseModel { @@ -19,26 +18,20 @@ abstract class ExchangeRatesResponseModel { this.subscription, }); - /// Exchange rate values from base to all other currencies + /// Exchange rate values from base to target currency final ExchangeRates? exchangeRates; /// For subscription requests only. final Subscription? subscription; } -/// Exchange rates response class.
-/// -/// DeveloperNote: In case of adding new functionality to this class, please use the extended version of the class i.e [ExchangeRatesResponseExtended] - +/// Exchange rates response class. class ExchangeRatesResponse extends ExchangeRatesResponseModel { /// Initializes Exchange rates response class. const ExchangeRatesResponse({ - ExchangeRates? exchangeRates, - Subscription? subscription, - }) : super( - exchangeRates: exchangeRates, - subscription: subscription, - ); + super.exchangeRates, + super.subscription, + }); /// Creates an instance from JSON. factory ExchangeRatesResponse.fromJson( @@ -92,7 +85,6 @@ class ExchangeRatesResponse extends ExchangeRatesResponseModel { /// /// For parameters information refer to [ExchangeRatesRequest]. /// Throws an [BaseAPIException] if API response contains an error. - /// Developer NOTE: to use the realtime update to exchange rates please refer to [ExchangeRatesResponseExtended.subscribeToExchangeRates] method. static Future fetchExchangeRates( ExchangeRatesRequest request, ) async { @@ -111,7 +103,6 @@ class ExchangeRatesResponse extends ExchangeRatesResponseModel { subscription: subscription ?? this.subscription, ); } - /// Exchange rates model class. abstract class ExchangeRatesModel { /// Initializes Exchange rates model class . @@ -127,7 +118,7 @@ abstract class ExchangeRatesModel { /// Date retrieval epoch time represented as an integer number final DateTime? date; - /// Rates of exchanging a unit of base currency into the target currencies + /// Rate of exchanging a unit of base currency into a target currency final Map? rates; } @@ -135,14 +126,10 @@ abstract class ExchangeRatesModel { class ExchangeRates extends ExchangeRatesModel { /// Initializes Exchange rates class. const ExchangeRates({ - String? baseCurrency, - DateTime? date, - Map? rates, - }) : super( - baseCurrency: baseCurrency, - date: date, - rates: rates, - ); + super.baseCurrency, + super.date, + super.rates, + }); /// Creates an instance from JSON. factory ExchangeRates.fromJson(Map json) => ExchangeRates( @@ -181,7 +168,6 @@ class ExchangeRates extends ExchangeRatesModel { rates: rates ?? this.rates, ); } - /// Subscription model class. abstract class SubscriptionModel { /// Initializes Subscription model class . @@ -197,10 +183,8 @@ abstract class SubscriptionModel { class Subscription extends SubscriptionModel { /// Initializes Subscription class. const Subscription({ - required String id, - }) : super( - id: id, - ); + required super.id, + }); /// Creates an instance from JSON. factory Subscription.fromJson(Map json) => Subscription( diff --git a/lib/api/response/forget_all_response_result.dart b/lib/api/response/forget_all_response_result.dart index 849c6ac321..55dcffc0d7 100644 --- a/lib/api/response/forget_all_response_result.dart +++ b/lib/api/response/forget_all_response_result.dart @@ -25,10 +25,8 @@ abstract class ForgetAllResponseModel { class ForgetAllResponse extends ForgetAllResponseModel { /// Initializes Forget all response class. const ForgetAllResponse({ - List? forgetAll, - }) : super( - forgetAll: forgetAll, - ); + super.forgetAll, + }); /// Creates an instance from JSON. factory ForgetAllResponse.fromJson( diff --git a/lib/api/response/forget_response_result.dart b/lib/api/response/forget_response_result.dart index 96087b4812..fbd86779ed 100644 --- a/lib/api/response/forget_response_result.dart +++ b/lib/api/response/forget_response_result.dart @@ -25,10 +25,8 @@ abstract class ForgetResponseModel { class ForgetResponse extends ForgetResponseModel { /// Initializes Forget response class. const ForgetResponse({ - bool? forget, - }) : super( - forget: forget, - ); + super.forget, + }); /// Creates an instance from JSON. factory ForgetResponse.fromJson( diff --git a/lib/api/response/get_account_status_response_result.dart b/lib/api/response/get_account_status_response_result.dart index 8b1e4185fd..ff9472e4cb 100644 --- a/lib/api/response/get_account_status_response_result.dart +++ b/lib/api/response/get_account_status_response_result.dart @@ -25,10 +25,8 @@ abstract class GetAccountStatusResponseModel { class GetAccountStatusResponse extends GetAccountStatusResponseModel { /// Initializes Get account status response class. const GetAccountStatusResponse({ - GetAccountStatus? getAccountStatus, - }) : super( - getAccountStatus: getAccountStatus, - ); + super.getAccountStatus, + }); /// Creates an instance from JSON. factory GetAccountStatusResponse.fromJson( @@ -95,6 +93,8 @@ final Map statusEnumMapper = { "verified": StatusEnum.verified, "rejected": StatusEnum.rejected, "pending": StatusEnum.pending, + "expired": StatusEnum.expired, + "none": StatusEnum.none, }; /// Status Enum. @@ -107,6 +107,12 @@ enum StatusEnum { /// pending. pending, + + /// expired. + expired, + + /// none. + none, } /// DocumentStatusEnum mapper. @@ -220,6 +226,29 @@ enum OwnershipStatusEnum { verified, } +/// P2pStatusEnum mapper. +final Map p2pStatusEnumMapper = { + "none": P2pStatusEnum.none, + "active": P2pStatusEnum.active, + "temp_ban": P2pStatusEnum.tempBan, + "perm_ban": P2pStatusEnum.permBan, +}; + +/// P2pStatus Enum. +enum P2pStatusEnum { + /// none. + none, + + /// active. + active, + + /// temp_ban. + tempBan, + + /// perm_ban. + permBan, +} + /// SocialIdentityProviderEnum mapper. final Map socialIdentityProviderEnumMapper = { @@ -239,7 +268,6 @@ enum SocialIdentityProviderEnum { /// apple. apple, } - /// Get account status model class. abstract class GetAccountStatusModel { /// Initializes Get account status model class . @@ -247,6 +275,8 @@ abstract class GetAccountStatusModel { required this.status, required this.riskClassification, required this.promptClientToAuthenticate, + required this.p2pStatus, + required this.p2pPoaRequired, required this.currencyConfig, this.authentication, this.cashierMissingFields, @@ -294,6 +324,11 @@ abstract class GetAccountStatusModel { /// - `personal_details_locked`: client is not allowed to edit personal profile details. /// - `transfers_blocked`: it block any transfer between two accounts. /// - `df_deposit_requires_poi`: the DF deposit will be blocked until the client gets age verified. + /// - `authenticated_with_idv_photoid`: the client has been fully authenticated by IDV. + /// - `idv_revoked`: the client used to be fully authenticated by IDV but it was taken away due to compliance criteria. + /// - `mt5_additional_kyc_required`: client tax information, place of birth and account opening reason is missing. + /// - `poi_expiring_soon`: the POI documents of the client will get expired soon, allow them to reupload POI documents. + /// - `poa_expiring_soon`: the POA documents of the client will get outdated soon, allow them to reupload POA documents. final List status; /// Client risk classification: `low`, `standard`, `high`. @@ -302,6 +337,12 @@ abstract class GetAccountStatusModel { /// Indicates whether the client should be prompted to authenticate their account. final bool promptClientToAuthenticate; + /// Current P2P status of client. + final P2pStatusEnum p2pStatus; + + /// P2P requires proof of address. + final bool p2pPoaRequired; + /// Provides cashier details for client currency. final Map currencyConfig; @@ -322,24 +363,17 @@ abstract class GetAccountStatusModel { class GetAccountStatus extends GetAccountStatusModel { /// Initializes Get account status class. const GetAccountStatus({ - required Map currencyConfig, - required bool promptClientToAuthenticate, - required String riskClassification, - required List status, - Authentication? authentication, - List? cashierMissingFields, - List? cashierValidation, - SocialIdentityProviderEnum? socialIdentityProvider, - }) : super( - currencyConfig: currencyConfig, - promptClientToAuthenticate: promptClientToAuthenticate, - riskClassification: riskClassification, - status: status, - authentication: authentication, - cashierMissingFields: cashierMissingFields, - cashierValidation: cashierValidation, - socialIdentityProvider: socialIdentityProvider, - ); + required super.currencyConfig, + required super.p2pPoaRequired, + required super.p2pStatus, + required super.promptClientToAuthenticate, + required super.riskClassification, + required super.status, + super.authentication, + super.cashierMissingFields, + super.cashierValidation, + super.socialIdentityProvider, + }); /// Creates an instance from JSON. factory GetAccountStatus.fromJson(Map json) => @@ -351,6 +385,8 @@ class GetAccountStatus extends GetAccountStatusModel { (MapEntry entry) => MapEntry(entry.key, CurrencyConfigProperty.fromJson(entry.value)))), + p2pPoaRequired: getBool(json['p2p_poa_required'])!, + p2pStatus: p2pStatusEnumMapper[json['p2p_status']]!, promptClientToAuthenticate: getBool(json['prompt_client_to_authenticate'])!, riskClassification: json['risk_classification'], @@ -387,6 +423,11 @@ class GetAccountStatus extends GetAccountStatusModel { final Map resultMap = {}; resultMap['currency_config'] = currencyConfig; + resultMap['p2p_poa_required'] = p2pPoaRequired; + resultMap['p2p_status'] = p2pStatusEnumMapper.entries + .firstWhere( + (MapEntry entry) => entry.value == p2pStatus) + .key; resultMap['prompt_client_to_authenticate'] = promptClientToAuthenticate; resultMap['risk_classification'] = riskClassification; resultMap['status'] = status @@ -424,6 +465,8 @@ class GetAccountStatus extends GetAccountStatusModel { /// Creates a copy of instance with given parameters. GetAccountStatus copyWith({ Map? currencyConfig, + bool? p2pPoaRequired, + P2pStatusEnum? p2pStatus, bool? promptClientToAuthenticate, String? riskClassification, List? status, @@ -434,6 +477,8 @@ class GetAccountStatus extends GetAccountStatusModel { }) => GetAccountStatus( currencyConfig: currencyConfig ?? this.currencyConfig, + p2pPoaRequired: p2pPoaRequired ?? this.p2pPoaRequired, + p2pStatus: p2pStatus ?? this.p2pStatus, promptClientToAuthenticate: promptClientToAuthenticate ?? this.promptClientToAuthenticate, riskClassification: riskClassification ?? this.riskClassification, @@ -445,7 +490,6 @@ class GetAccountStatus extends GetAccountStatusModel { socialIdentityProvider ?? this.socialIdentityProvider, ); } - /// Currency config property model class. abstract class CurrencyConfigPropertyModel { /// Initializes Currency config property model class . @@ -465,12 +509,9 @@ abstract class CurrencyConfigPropertyModel { class CurrencyConfigProperty extends CurrencyConfigPropertyModel { /// Initializes Currency config property class. const CurrencyConfigProperty({ - bool? isDepositSuspended, - bool? isWithdrawalSuspended, - }) : super( - isDepositSuspended: isDepositSuspended, - isWithdrawalSuspended: isWithdrawalSuspended, - ); + super.isDepositSuspended, + super.isWithdrawalSuspended, + }); /// Creates an instance from JSON. factory CurrencyConfigProperty.fromJson(Map json) => @@ -500,7 +541,6 @@ class CurrencyConfigProperty extends CurrencyConfigPropertyModel { isWithdrawalSuspended ?? this.isWithdrawalSuspended, ); } - /// Authentication model class. abstract class AuthenticationModel { /// Initializes Authentication model class . @@ -536,20 +576,13 @@ abstract class AuthenticationModel { class Authentication extends AuthenticationModel { /// Initializes Authentication class. const Authentication({ - required List needsVerification, - Attempts? attempts, - Document? document, - Identity? identity, - Income? income, - Ownership? ownership, - }) : super( - needsVerification: needsVerification, - attempts: attempts, - document: document, - identity: identity, - income: income, - ownership: ownership, - ); + required super.needsVerification, + super.attempts, + super.document, + super.identity, + super.income, + super.ownership, + }); /// Creates an instance from JSON. factory Authentication.fromJson(Map json) => Authentication( @@ -620,7 +653,6 @@ class Authentication extends AuthenticationModel { ownership: ownership ?? this.ownership, ); } - /// Attempts model class. abstract class AttemptsModel { /// Initializes Attempts model class . @@ -644,14 +676,10 @@ abstract class AttemptsModel { class Attempts extends AttemptsModel { /// Initializes Attempts class. const Attempts({ - int? count, - List? history, - Map? latest, - }) : super( - count: count, - history: history, - latest: latest, - ); + super.count, + super.history, + super.latest, + }); /// Creates an instance from JSON. factory Attempts.fromJson(Map json) => Attempts( @@ -695,12 +723,12 @@ class Attempts extends AttemptsModel { latest: latest ?? this.latest, ); } - /// History item model class. abstract class HistoryItemModel { /// Initializes History item model class . const HistoryItemModel({ this.countryCode, + this.documentType, this.id, this.service, this.status, @@ -710,6 +738,9 @@ abstract class HistoryItemModel { /// 2-letter country code used to request the attempt. final String? countryCode; + /// The document type of the attempt. + final String? documentType; + /// The id of the attempt. final String? id; @@ -727,22 +758,18 @@ abstract class HistoryItemModel { class HistoryItem extends HistoryItemModel { /// Initializes History item class. const HistoryItem({ - String? countryCode, - String? id, - String? service, - StatusEnum? status, - DateTime? timestamp, - }) : super( - countryCode: countryCode, - id: id, - service: service, - status: status, - timestamp: timestamp, - ); + super.countryCode, + super.documentType, + super.id, + super.service, + super.status, + super.timestamp, + }); /// Creates an instance from JSON. factory HistoryItem.fromJson(Map json) => HistoryItem( countryCode: json['country_code'], + documentType: json['document_type'], id: json['id'], service: json['service'], status: @@ -755,6 +782,7 @@ class HistoryItem extends HistoryItemModel { final Map resultMap = {}; resultMap['country_code'] = countryCode; + resultMap['document_type'] = documentType; resultMap['id'] = id; resultMap['service'] = service; resultMap['status'] = statusEnumMapper.entries @@ -769,6 +797,7 @@ class HistoryItem extends HistoryItemModel { /// Creates a copy of instance with given parameters. HistoryItem copyWith({ String? countryCode, + String? documentType, String? id, String? service, StatusEnum? status, @@ -776,21 +805,25 @@ class HistoryItem extends HistoryItemModel { }) => HistoryItem( countryCode: countryCode ?? this.countryCode, + documentType: documentType ?? this.documentType, id: id ?? this.id, service: service ?? this.service, status: status ?? this.status, timestamp: timestamp ?? this.timestamp, ); } - /// Document model class. abstract class DocumentModel { /// Initializes Document model class . const DocumentModel({ + this.authenticatedWithIdv, this.expiryDate, this.status, }); + /// This represents the current status of idv authentication for each mt5 jurisdiction. + final AuthenticatedWithIdv? authenticatedWithIdv; + /// This is the epoch of the document expiry date. final DateTime? expiryDate; @@ -802,15 +835,16 @@ abstract class DocumentModel { class Document extends DocumentModel { /// Initializes Document class. const Document({ - DateTime? expiryDate, - DocumentStatusEnum? status, - }) : super( - expiryDate: expiryDate, - status: status, - ); + super.authenticatedWithIdv, + super.expiryDate, + super.status, + }); /// Creates an instance from JSON. factory Document.fromJson(Map json) => Document( + authenticatedWithIdv: json['authenticated_with_idv'] == null + ? null + : AuthenticatedWithIdv.fromJson(json['authenticated_with_idv']), expiryDate: getDateTime(json['expiry_date']), status: json['status'] == null ? null @@ -821,6 +855,9 @@ class Document extends DocumentModel { Map toJson() { final Map resultMap = {}; + if (authenticatedWithIdv != null) { + resultMap['authenticated_with_idv'] = authenticatedWithIdv!.toJson(); + } resultMap['expiry_date'] = getSecondsSinceEpochDateTime(expiryDate); resultMap['status'] = documentStatusEnumMapper.entries .firstWhere((MapEntry entry) => @@ -832,15 +869,147 @@ class Document extends DocumentModel { /// Creates a copy of instance with given parameters. Document copyWith({ + AuthenticatedWithIdv? authenticatedWithIdv, DateTime? expiryDate, DocumentStatusEnum? status, }) => Document( + authenticatedWithIdv: authenticatedWithIdv ?? this.authenticatedWithIdv, expiryDate: expiryDate ?? this.expiryDate, status: status ?? this.status, ); } +/// Authenticated with idv model class. +abstract class AuthenticatedWithIdvModel { + /// Initializes Authenticated with idv model class . + const AuthenticatedWithIdvModel({ + this.bvi, + this.dsl, + this.iom, + this.labuan, + this.malta, + this.maltainvest, + this.samoa, + this.samoaVirtual, + this.svg, + this.vanuatu, + this.virtual, + }); + + /// This represents whether the client is allowed or not to create an account under this jurisdiction + final bool? bvi; + + /// This represents whether the client is allowed or not to create an account under this jurisdiction + final bool? dsl; + + /// This represents whether the client is allowed or not to create an account under this jurisdiction + final bool? iom; + + /// This represents whether the client is allowed or not to create an account under this jurisdiction + final bool? labuan; + + /// This represents whether the client is allowed or not to create an account under this jurisdiction + final bool? malta; + + /// This represents whether the client is allowed or not to create an account under this jurisdiction + final bool? maltainvest; + + /// This represents whether the client is allowed or not to create an account under this jurisdiction + final bool? samoa; + /// This represents whether the client is allowed or not to create an account under this jurisdiction + final bool? samoaVirtual; + + /// This represents whether the client is allowed or not to create an account under this jurisdiction + final bool? svg; + + /// This represents whether the client is allowed or not to create an account under this jurisdiction + final bool? vanuatu; + + /// This represents whether the client is allowed or not to create an account under this jurisdiction + final bool? virtual; +} + +/// Authenticated with idv class. +class AuthenticatedWithIdv extends AuthenticatedWithIdvModel { + /// Initializes Authenticated with idv class. + const AuthenticatedWithIdv({ + super.bvi, + super.dsl, + super.iom, + super.labuan, + super.malta, + super.maltainvest, + super.samoa, + super.samoaVirtual, + super.svg, + super.vanuatu, + super.virtual, + }); + + /// Creates an instance from JSON. + factory AuthenticatedWithIdv.fromJson(Map json) => + AuthenticatedWithIdv( + bvi: getBool(json['bvi']), + dsl: getBool(json['dsl']), + iom: getBool(json['iom']), + labuan: getBool(json['labuan']), + malta: getBool(json['malta']), + maltainvest: getBool(json['maltainvest']), + samoa: getBool(json['samoa']), + samoaVirtual: getBool(json['samoa-virtual']), + svg: getBool(json['svg']), + vanuatu: getBool(json['vanuatu']), + virtual: getBool(json['virtual']), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['bvi'] = bvi; + resultMap['dsl'] = dsl; + resultMap['iom'] = iom; + resultMap['labuan'] = labuan; + resultMap['malta'] = malta; + resultMap['maltainvest'] = maltainvest; + resultMap['samoa'] = samoa; + resultMap['samoa-virtual'] = samoaVirtual; + resultMap['svg'] = svg; + resultMap['vanuatu'] = vanuatu; + resultMap['virtual'] = virtual; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + AuthenticatedWithIdv copyWith({ + bool? bvi, + bool? dsl, + bool? iom, + bool? labuan, + bool? malta, + bool? maltainvest, + bool? samoa, + bool? samoaVirtual, + bool? svg, + bool? vanuatu, + bool? virtual, + }) => + AuthenticatedWithIdv( + bvi: bvi ?? this.bvi, + dsl: dsl ?? this.dsl, + iom: iom ?? this.iom, + labuan: labuan ?? this.labuan, + malta: malta ?? this.malta, + maltainvest: maltainvest ?? this.maltainvest, + samoa: samoa ?? this.samoa, + samoaVirtual: samoaVirtual ?? this.samoaVirtual, + svg: svg ?? this.svg, + vanuatu: vanuatu ?? this.vanuatu, + virtual: virtual ?? this.virtual, + ); +} /// Identity model class. abstract class IdentityModel { /// Initializes Identity model class . @@ -864,14 +1033,10 @@ abstract class IdentityModel { class Identity extends IdentityModel { /// Initializes Identity class. const Identity({ - DateTime? expiryDate, - Services? services, - DocumentStatusEnum? status, - }) : super( - expiryDate: expiryDate, - services: services, - status: status, - ); + super.expiryDate, + super.services, + super.status, + }); /// Creates an instance from JSON. factory Identity.fromJson(Map json) => Identity( @@ -912,7 +1077,6 @@ class Identity extends IdentityModel { status: status ?? this.status, ); } - /// Services model class. abstract class ServicesModel { /// Initializes Services model class . @@ -936,14 +1100,10 @@ abstract class ServicesModel { class Services extends ServicesModel { /// Initializes Services class. const Services({ - Idv? idv, - Manual? manual, - Onfido? onfido, - }) : super( - idv: idv, - manual: manual, - onfido: onfido, - ); + super.idv, + super.manual, + super.onfido, + }); /// Creates an instance from JSON. factory Services.fromJson(Map json) => Services( @@ -981,7 +1141,6 @@ class Services extends ServicesModel { onfido: onfido ?? this.onfido, ); } - /// Idv model class. abstract class IdvModel { /// Initializes Idv model class . @@ -1013,18 +1172,12 @@ abstract class IdvModel { class Idv extends IdvModel { /// Initializes Idv class. const Idv({ - DateTime? expiryDate, - List? lastRejected, - Map? reportedProperties, - IdvStatusEnum? status, - int? submissionsLeft, - }) : super( - expiryDate: expiryDate, - lastRejected: lastRejected, - reportedProperties: reportedProperties, - status: status, - submissionsLeft: submissionsLeft, - ); + super.expiryDate, + super.lastRejected, + super.reportedProperties, + super.status, + super.submissionsLeft, + }); /// Creates an instance from JSON. factory Idv.fromJson(Map json) => Idv( @@ -1080,7 +1233,6 @@ class Idv extends IdvModel { submissionsLeft: submissionsLeft ?? this.submissionsLeft, ); } - /// Manual model class. abstract class ManualModel { /// Initializes Manual model class . @@ -1096,10 +1248,8 @@ abstract class ManualModel { class Manual extends ManualModel { /// Initializes Manual class. const Manual({ - DocumentStatusEnum? status, - }) : super( - status: status, - ); + super.status, + }); /// Creates an instance from JSON. factory Manual.fromJson(Map json) => Manual( @@ -1128,7 +1278,6 @@ class Manual extends ManualModel { status: status ?? this.status, ); } - /// Onfido model class. abstract class OnfidoModel { /// Initializes Onfido model class . @@ -1172,24 +1321,15 @@ abstract class OnfidoModel { class Onfido extends OnfidoModel { /// Initializes Onfido class. const Onfido({ - String? countryCode, - List? documents, - List? documentsSupported, - bool? isCountrySupported, - List? lastRejected, - Map? reportedProperties, - DocumentStatusEnum? status, - int? submissionsLeft, - }) : super( - countryCode: countryCode, - documents: documents, - documentsSupported: documentsSupported, - isCountrySupported: isCountrySupported, - lastRejected: lastRejected, - reportedProperties: reportedProperties, - status: status, - submissionsLeft: submissionsLeft, - ); + super.countryCode, + super.documents, + super.documentsSupported, + super.isCountrySupported, + super.lastRejected, + super.reportedProperties, + super.status, + super.submissionsLeft, + }); /// Creates an instance from JSON. factory Onfido.fromJson(Map json) => Onfido( @@ -1282,7 +1422,6 @@ class Onfido extends OnfidoModel { submissionsLeft: submissionsLeft ?? this.submissionsLeft, ); } - /// Income model class. abstract class IncomeModel { /// Initializes Income model class . @@ -1302,12 +1441,9 @@ abstract class IncomeModel { class Income extends IncomeModel { /// Initializes Income class. const Income({ - DateTime? expiryDate, - IncomeStatusEnum? status, - }) : super( - expiryDate: expiryDate, - status: status, - ); + super.expiryDate, + super.status, + }); /// Creates an instance from JSON. factory Income.fromJson(Map json) => Income( @@ -1340,7 +1476,6 @@ class Income extends IncomeModel { status: status ?? this.status, ); } - /// Ownership model class. abstract class OwnershipModel { /// Initializes Ownership model class . @@ -1360,12 +1495,9 @@ abstract class OwnershipModel { class Ownership extends OwnershipModel { /// Initializes Ownership class. const Ownership({ - List? requests, - OwnershipStatusEnum? status, - }) : super( - requests: requests, - status: status, - ); + super.requests, + super.status, + }); /// Creates an instance from JSON. factory Ownership.fromJson(Map json) => Ownership( @@ -1410,7 +1542,6 @@ class Ownership extends OwnershipModel { status: status ?? this.status, ); } - /// Requests item model class. abstract class RequestsItemModel { /// Initializes Requests item model class . @@ -1438,16 +1569,11 @@ abstract class RequestsItemModel { class RequestsItem extends RequestsItemModel { /// Initializes Requests item class. const RequestsItem({ - String? creationTime, - double? documentsRequired, - double? id, - String? paymentMethod, - }) : super( - creationTime: creationTime, - documentsRequired: documentsRequired, - id: id, - paymentMethod: paymentMethod, - ); + super.creationTime, + super.documentsRequired, + super.id, + super.paymentMethod, + }); /// Creates an instance from JSON. factory RequestsItem.fromJson(Map json) => RequestsItem( diff --git a/lib/api/response/get_self_exclusion_response_result.dart b/lib/api/response/get_self_exclusion_response_result.dart index 6a963c40dc..0612425f43 100644 --- a/lib/api/response/get_self_exclusion_response_result.dart +++ b/lib/api/response/get_self_exclusion_response_result.dart @@ -27,10 +27,8 @@ abstract class GetSelfExclusionResponseModel { class GetSelfExclusionResponse extends GetSelfExclusionResponseModel { /// Initializes Get self exclusion response class. const GetSelfExclusionResponse({ - GetSelfExclusion? getSelfExclusion, - }) : super( - getSelfExclusion: getSelfExclusion, - ); + super.getSelfExclusion, + }); /// Creates an instance from JSON. factory GetSelfExclusionResponse.fromJson( @@ -135,7 +133,6 @@ class GetSelfExclusionResponse extends GetSelfExclusionResponseModel { getSelfExclusion: getSelfExclusion ?? this.getSelfExclusion, ); } - /// Get self exclusion model class. abstract class GetSelfExclusionModel { /// Initializes Get self exclusion model class . @@ -203,36 +200,21 @@ abstract class GetSelfExclusionModel { class GetSelfExclusion extends GetSelfExclusionModel { /// Initializes Get self exclusion class. const GetSelfExclusion({ - String? excludeUntil, - double? max30dayDeposit, - double? max30dayLosses, - double? max30dayTurnover, - double? max7dayDeposit, - double? max7dayLosses, - double? max7dayTurnover, - double? maxBalance, - double? maxDeposit, - double? maxLosses, - int? maxOpenBets, - double? maxTurnover, - int? sessionDurationLimit, - DateTime? timeoutUntil, - }) : super( - excludeUntil: excludeUntil, - max30dayDeposit: max30dayDeposit, - max30dayLosses: max30dayLosses, - max30dayTurnover: max30dayTurnover, - max7dayDeposit: max7dayDeposit, - max7dayLosses: max7dayLosses, - max7dayTurnover: max7dayTurnover, - maxBalance: maxBalance, - maxDeposit: maxDeposit, - maxLosses: maxLosses, - maxOpenBets: maxOpenBets, - maxTurnover: maxTurnover, - sessionDurationLimit: sessionDurationLimit, - timeoutUntil: timeoutUntil, - ); + super.excludeUntil, + super.max30dayDeposit, + super.max30dayLosses, + super.max30dayTurnover, + super.max7dayDeposit, + super.max7dayLosses, + super.max7dayTurnover, + super.maxBalance, + super.maxDeposit, + super.maxLosses, + super.maxOpenBets, + super.maxTurnover, + super.sessionDurationLimit, + super.timeoutUntil, + }); /// Creates an instance from JSON. factory GetSelfExclusion.fromJson(Map json) => diff --git a/lib/api/response/get_settings_response_result.dart b/lib/api/response/get_settings_response_result.dart index 1489031c2d..b126471624 100644 --- a/lib/api/response/get_settings_response_result.dart +++ b/lib/api/response/get_settings_response_result.dart @@ -130,7 +130,6 @@ class GetSettingsResponse extends GetSettingsResponseModel { allowCopiers: getSettings?.allowCopiers, citizen: getSettings?.citizen, dateOfBirth: getStringFromDateTime(getSettings?.dateOfBirth), - dxtradeUserException: getSettings?.dxtradeUserException, emailConsent: getSettings?.emailConsent, firstName: getSettings?.firstName, lastName: getSettings?.lastName, @@ -183,7 +182,6 @@ enum EmploymentStatusEnum { /// Unemployed. unemployed, } - /// Get settings model class. abstract class GetSettingsModel { /// Initializes Get settings model class . @@ -549,7 +547,6 @@ class GetSettings extends GetSettingsModel { userHash: userHash ?? this.userHash, ); } - /// Feature flag model class. abstract class FeatureFlagModel { /// Initializes Feature flag model class . diff --git a/lib/api/response/identity_verification_document_add_response_result.dart b/lib/api/response/identity_verification_document_add_response_result.dart index dc9c822273..a1e39d4467 100644 --- a/lib/api/response/identity_verification_document_add_response_result.dart +++ b/lib/api/response/identity_verification_document_add_response_result.dart @@ -19,10 +19,8 @@ class IdentityVerificationDocumentAddResponse extends IdentityVerificationDocumentAddResponseModel { /// Initializes Identity verification document add response class. const IdentityVerificationDocumentAddResponse({ - int? identityVerificationDocumentAdd, - }) : super( - identityVerificationDocumentAdd: identityVerificationDocumentAdd, - ); + super.identityVerificationDocumentAdd, + }); /// Creates an instance from JSON. factory IdentityVerificationDocumentAddResponse.fromJson( diff --git a/lib/api/response/jtoken_create_response_result.dart b/lib/api/response/jtoken_create_response_result.dart new file mode 100644 index 0000000000..177d09a5fd --- /dev/null +++ b/lib/api/response/jtoken_create_response_result.dart @@ -0,0 +1,49 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Jtoken create response model class. +abstract class JtokenCreateResponseModel { + /// Initializes Jtoken create response model class . + const JtokenCreateResponseModel({ + this.jtokenCreate, + }); + + /// The JToken created. + final String? jtokenCreate; +} + +/// Jtoken create response class. +class JtokenCreateResponse extends JtokenCreateResponseModel { + /// Initializes Jtoken create response class. + const JtokenCreateResponse({ + super.jtokenCreate, + }); + + /// Creates an instance from JSON. + factory JtokenCreateResponse.fromJson( + dynamic jtokenCreateJson, + ) => + JtokenCreateResponse( + jtokenCreate: jtokenCreateJson, + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['jtoken_create'] = jtokenCreate; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + JtokenCreateResponse copyWith({ + String? jtokenCreate, + }) => + JtokenCreateResponse( + jtokenCreate: jtokenCreate ?? this.jtokenCreate, + ); +} diff --git a/lib/api/response/kyc_auth_status_response_result.dart b/lib/api/response/kyc_auth_status_response_result.dart new file mode 100644 index 0000000000..e6b6050d5e --- /dev/null +++ b/lib/api/response/kyc_auth_status_response_result.dart @@ -0,0 +1,49 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Kyc auth status response model class. +abstract class KycAuthStatusResponseModel { + /// Initializes Kyc auth status response model class . + const KycAuthStatusResponseModel({ + this.kycAuthStatus, + }); + + /// Proof of Identity (POI) and Proof of Address (POA) authentication status details. + final Map? kycAuthStatus; +} + +/// Kyc auth status response class. +class KycAuthStatusResponse extends KycAuthStatusResponseModel { + /// Initializes Kyc auth status response class. + const KycAuthStatusResponse({ + super.kycAuthStatus, + }); + + /// Creates an instance from JSON. + factory KycAuthStatusResponse.fromJson( + dynamic kycAuthStatusJson, + ) => + KycAuthStatusResponse( + kycAuthStatus: kycAuthStatusJson, + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['kyc_auth_status'] = kycAuthStatus; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + KycAuthStatusResponse copyWith({ + Map? kycAuthStatus, + }) => + KycAuthStatusResponse( + kycAuthStatus: kycAuthStatus ?? this.kycAuthStatus, + ); +} diff --git a/lib/api/response/landing_company_response_result.dart b/lib/api/response/landing_company_response_result.dart index 009547c9ae..bd3a8c73f7 100644 --- a/lib/api/response/landing_company_response_result.dart +++ b/lib/api/response/landing_company_response_result.dart @@ -186,7 +186,7 @@ abstract class LandingCompanyModel { /// Available Deriv X financial account types (all except Synthetic Indices). final DxtradeFinancialCompany? dxtradeFinancialCompany; - /// Available Deriv X gaming account types (Synthetic Indices). + /// Available Deriv X derived account types (Synthetic Indices). final DxtradeGamingCompany? dxtradeGamingCompany; /// Landing Company for financial contracts (all except Synthetic Indices) @@ -195,7 +195,7 @@ abstract class LandingCompanyModel { /// Forbidden postcode pattern final String? forbiddenPostcodePattern; - /// Landing Company for gaming contracts (Synthetic Indices) + /// Landing Company for derived contracts (Synthetic Indices) final GamingCompany? gamingCompany; /// Country code @@ -219,7 +219,7 @@ abstract class LandingCompanyModel { /// Landing Company for MT5 financial contracts (all except Synthetic Indices), currently divided into Financial STP, Financial (standard) as subtypes. final MtFinancialCompany? mtFinancialCompany; - /// Landing Company for MT5 standard gaming contracts (Synthetic Indices), currently has Financial as subtype. + /// Landing Company for MT5 standard derived contracts (Synthetic Indices), currently has Financial as subtype. final MtGamingCompany? mtGamingCompany; /// Country name @@ -4440,7 +4440,7 @@ abstract class MtGamingCompanyModel { this.financial, }); - /// Landing Company for MT5 gaming contracts (Synthetic Indices) + /// Landing Company for MT5 derived contracts (Synthetic Indices) final MtGamingCompanyFinancial? financial; } diff --git a/lib/api/response/login_history_response_result.dart b/lib/api/response/login_history_response_result.dart index 90f67743d8..54ee1c5706 100644 --- a/lib/api/response/login_history_response_result.dart +++ b/lib/api/response/login_history_response_result.dart @@ -25,10 +25,8 @@ abstract class LoginHistoryResponseModel { class LoginHistoryResponse extends LoginHistoryResponseModel { /// Initializes Login history response class. const LoginHistoryResponse({ - List? loginHistory, - }) : super( - loginHistory: loginHistory, - ); + super.loginHistory, + }); /// Creates an instance from JSON. factory LoginHistoryResponse.fromJson( @@ -89,7 +87,6 @@ class LoginHistoryResponse extends LoginHistoryResponseModel { loginHistory: loginHistory ?? this.loginHistory, ); } - /// Login history item model class. abstract class LoginHistoryItemModel { /// Initializes Login history item model class . @@ -117,16 +114,11 @@ abstract class LoginHistoryItemModel { class LoginHistoryItem extends LoginHistoryItemModel { /// Initializes Login history item class. const LoginHistoryItem({ - required String action, - required String environment, - required bool status, - required DateTime time, - }) : super( - action: action, - environment: environment, - status: status, - time: time, - ); + required super.action, + required super.environment, + required super.status, + required super.time, + }); /// Creates an instance from JSON. factory LoginHistoryItem.fromJson(Map json) => diff --git a/lib/api/response/logout_response_result.dart b/lib/api/response/logout_response_result.dart index c72f0a1235..fec1f5f334 100644 --- a/lib/api/response/logout_response_result.dart +++ b/lib/api/response/logout_response_result.dart @@ -25,10 +25,8 @@ abstract class LogoutResponseModel { class LogoutResponse extends LogoutResponseModel { /// Initializes Logout response class. const LogoutResponse({ - int? logout, - }) : super( - logout: logout, - ); + super.logout, + }); /// Creates an instance from JSON. factory LogoutResponse.fromJson( diff --git a/lib/api/response/mt5_deposit_response_result.dart b/lib/api/response/mt5_deposit_response_result.dart index 594ba1936d..9ff4dbe331 100644 --- a/lib/api/response/mt5_deposit_response_result.dart +++ b/lib/api/response/mt5_deposit_response_result.dart @@ -29,12 +29,9 @@ abstract class Mt5DepositResponseModel { class Mt5DepositResponse extends Mt5DepositResponseModel { /// Initializes Mt5 deposit response class. const Mt5DepositResponse({ - int? mt5Deposit, - int? binaryTransactionId, - }) : super( - mt5Deposit: mt5Deposit, - binaryTransactionId: binaryTransactionId, - ); + super.mt5Deposit, + super.binaryTransactionId, + }); /// Creates an instance from JSON. factory Mt5DepositResponse.fromJson( diff --git a/lib/api/response/mt5_new_account_response_result.dart b/lib/api/response/mt5_new_account_response_result.dart index 3e3d158412..22f8638c01 100644 --- a/lib/api/response/mt5_new_account_response_result.dart +++ b/lib/api/response/mt5_new_account_response_result.dart @@ -38,10 +38,8 @@ abstract class Mt5NewAccountResponseModel { class Mt5NewAccountResponse extends Mt5NewAccountResponseModel { /// Initializes Mt5 new account response class. const Mt5NewAccountResponse({ - Mt5NewAccount? mt5NewAccount, - }) : super( - mt5NewAccount: mt5NewAccount, - ); + super.mt5NewAccount, + }); /// Creates an instance from JSON. factory Mt5NewAccountResponse.fromJson( @@ -185,6 +183,7 @@ final Map accountTypeEnumMapper = "demo": AccountTypeEnum.demo, "gaming": AccountTypeEnum.gaming, "financial": AccountTypeEnum.financial, + "all": AccountTypeEnum.all, }; /// AccountType Enum. @@ -197,18 +196,25 @@ enum AccountTypeEnum { /// financial. financial, + + /// all. + all, } /// Mt5AccountCategoryEnum mapper. final Map mt5AccountCategoryEnumMapper = { "conventional": Mt5AccountCategoryEnum.conventional, + "swap_free": Mt5AccountCategoryEnum.swapFree, }; /// Mt5AccountCategory Enum. enum Mt5AccountCategoryEnum { /// conventional. conventional, + + /// swap_free. + swapFree, } /// Mt5AccountTypeEnum mapper. @@ -216,6 +222,7 @@ final Map mt5AccountTypeEnumMapper = { "financial": Mt5AccountTypeEnum.financial, "financial_stp": Mt5AccountTypeEnum.financialStp, + "standard": Mt5AccountTypeEnum.standard, }; /// Mt5AccountType Enum. @@ -225,8 +232,10 @@ enum Mt5AccountTypeEnum { /// financial_stp. financialStp, -} + /// standard. + standard, +} /// Mt5 new account model class. abstract class Mt5NewAccountModel { /// Initializes Mt5 new account model class . @@ -262,7 +271,7 @@ abstract class Mt5NewAccountModel { /// With default value of conventional, unavailable for `financial_stp` sub account type. final Mt5AccountCategoryEnum? mt5AccountCategory; - /// Sub account type, present only when account type is either `demo` or `financial`. + /// Sub account type for classic MT5 account. final Mt5AccountTypeEnum? mt5AccountType; } @@ -270,24 +279,15 @@ abstract class Mt5NewAccountModel { class Mt5NewAccount extends Mt5NewAccountModel { /// Initializes Mt5 new account class. const Mt5NewAccount({ - AccountTypeEnum? accountType, - String? agent, - double? balance, - String? currency, - String? displayBalance, - String? login, - Mt5AccountCategoryEnum? mt5AccountCategory, - Mt5AccountTypeEnum? mt5AccountType, - }) : super( - accountType: accountType, - agent: agent, - balance: balance, - currency: currency, - displayBalance: displayBalance, - login: login, - mt5AccountCategory: mt5AccountCategory, - mt5AccountType: mt5AccountType, - ); + super.accountType, + super.agent, + super.balance, + super.currency, + super.displayBalance, + super.login, + super.mt5AccountCategory, + super.mt5AccountType, + }); /// Creates an instance from JSON. factory Mt5NewAccount.fromJson(Map json) => Mt5NewAccount( diff --git a/lib/api/response/mt5_password_change_response_result.dart b/lib/api/response/mt5_password_change_response_result.dart index a6ac7e462e..f3235644e7 100644 --- a/lib/api/response/mt5_password_change_response_result.dart +++ b/lib/api/response/mt5_password_change_response_result.dart @@ -25,10 +25,8 @@ abstract class Mt5PasswordChangeResponseModel { class Mt5PasswordChangeResponse extends Mt5PasswordChangeResponseModel { /// Initializes Mt5 password change response class. const Mt5PasswordChangeResponse({ - int? mt5PasswordChange, - }) : super( - mt5PasswordChange: mt5PasswordChange, - ); + super.mt5PasswordChange, + }); /// Creates an instance from JSON. factory Mt5PasswordChangeResponse.fromJson( diff --git a/lib/api/response/mt5_password_check_response_result.dart b/lib/api/response/mt5_password_check_response_result.dart index b534d8f80a..e2d17f74c6 100644 --- a/lib/api/response/mt5_password_check_response_result.dart +++ b/lib/api/response/mt5_password_check_response_result.dart @@ -25,10 +25,8 @@ abstract class Mt5PasswordCheckResponseModel { class Mt5PasswordCheckResponse extends Mt5PasswordCheckResponseModel { /// Initializes Mt5 password check response class. const Mt5PasswordCheckResponse({ - int? mt5PasswordCheck, - }) : super( - mt5PasswordCheck: mt5PasswordCheck, - ); + super.mt5PasswordCheck, + }); /// Creates an instance from JSON. factory Mt5PasswordCheckResponse.fromJson( diff --git a/lib/api/response/mt5_password_reset_response_result.dart b/lib/api/response/mt5_password_reset_response_result.dart index f83a757c16..39d86ce3c2 100644 --- a/lib/api/response/mt5_password_reset_response_result.dart +++ b/lib/api/response/mt5_password_reset_response_result.dart @@ -25,10 +25,8 @@ abstract class Mt5PasswordResetResponseModel { class Mt5PasswordResetResponse extends Mt5PasswordResetResponseModel { /// Initializes Mt5 password reset response class. const Mt5PasswordResetResponse({ - int? mt5PasswordReset, - }) : super( - mt5PasswordReset: mt5PasswordReset, - ); + super.mt5PasswordReset, + }); /// Creates an instance from JSON. factory Mt5PasswordResetResponse.fromJson( diff --git a/lib/api/response/mt5_withdrawal_response_result.dart b/lib/api/response/mt5_withdrawal_response_result.dart index c123ca54b2..624088a88f 100644 --- a/lib/api/response/mt5_withdrawal_response_result.dart +++ b/lib/api/response/mt5_withdrawal_response_result.dart @@ -29,12 +29,9 @@ abstract class Mt5WithdrawalResponseModel { class Mt5WithdrawalResponse extends Mt5WithdrawalResponseModel { /// Initializes Mt5 withdrawal response class. const Mt5WithdrawalResponse({ - int? mt5Withdrawal, - int? binaryTransactionId, - }) : super( - mt5Withdrawal: mt5Withdrawal, - binaryTransactionId: binaryTransactionId, - ); + super.mt5Withdrawal, + super.binaryTransactionId, + }); /// Creates an instance from JSON. factory Mt5WithdrawalResponse.fromJson( diff --git a/lib/api/response/new_account_maltainvest_response_result.dart b/lib/api/response/new_account_maltainvest_response_result.dart index 1bf27a9e81..f72578d7df 100644 --- a/lib/api/response/new_account_maltainvest_response_result.dart +++ b/lib/api/response/new_account_maltainvest_response_result.dart @@ -18,10 +18,8 @@ abstract class NewAccountMaltainvestResponseModel { class NewAccountMaltainvestResponse extends NewAccountMaltainvestResponseModel { /// Initializes New account maltainvest response class. const NewAccountMaltainvestResponse({ - NewAccountMaltainvest? newAccountMaltainvest, - }) : super( - newAccountMaltainvest: newAccountMaltainvest, - ); + super.newAccountMaltainvest, + }); /// Creates an instance from JSON. factory NewAccountMaltainvestResponse.fromJson( @@ -84,18 +82,12 @@ abstract class NewAccountMaltainvestModel { class NewAccountMaltainvest extends NewAccountMaltainvestModel { /// Initializes New account maltainvest class. const NewAccountMaltainvest({ - required String clientId, - required String landingCompany, - required String oauthToken, - String? landingCompanyShort, - String? landingCompanyShortcode, - }) : super( - clientId: clientId, - landingCompany: landingCompany, - oauthToken: oauthToken, - landingCompanyShort: landingCompanyShort, - landingCompanyShortcode: landingCompanyShortcode, - ); + required super.clientId, + required super.landingCompany, + required super.oauthToken, + super.landingCompanyShort, + super.landingCompanyShortcode, + }); /// Creates an instance from JSON. factory NewAccountMaltainvest.fromJson(Map json) => diff --git a/lib/api/response/new_account_real_response_result.dart b/lib/api/response/new_account_real_response_result.dart index aa47f00328..584f8ebbc5 100644 --- a/lib/api/response/new_account_real_response_result.dart +++ b/lib/api/response/new_account_real_response_result.dart @@ -25,10 +25,8 @@ abstract class NewAccountRealResponseModel { class NewAccountRealResponse extends NewAccountRealResponseModel { /// Initializes New account real response class. const NewAccountRealResponse({ - NewAccountReal? newAccountReal, - }) : super( - newAccountReal: newAccountReal, - ); + super.newAccountReal, + }); /// Creates an instance from JSON. factory NewAccountRealResponse.fromJson( @@ -79,7 +77,6 @@ class NewAccountRealResponse extends NewAccountRealResponseModel { newAccountReal: newAccountReal ?? this.newAccountReal, ); } - /// New account real model class. abstract class NewAccountRealModel { /// Initializes New account real model class . @@ -115,20 +112,13 @@ abstract class NewAccountRealModel { class NewAccountReal extends NewAccountRealModel { /// Initializes New account real class. const NewAccountReal({ - required String clientId, - required String landingCompany, - required String oauthToken, - String? currency, - String? landingCompanyShort, - String? landingCompanyShortcode, - }) : super( - clientId: clientId, - landingCompany: landingCompany, - oauthToken: oauthToken, - currency: currency, - landingCompanyShort: landingCompanyShort, - landingCompanyShortcode: landingCompanyShortcode, - ); + required super.clientId, + required super.landingCompany, + required super.oauthToken, + super.currency, + super.landingCompanyShort, + super.landingCompanyShortcode, + }); /// Creates an instance from JSON. factory NewAccountReal.fromJson(Map json) => NewAccountReal( diff --git a/lib/api/response/new_account_virtual_response_result.dart b/lib/api/response/new_account_virtual_response_result.dart index 2b87d4a37b..f5e09cec28 100644 --- a/lib/api/response/new_account_virtual_response_result.dart +++ b/lib/api/response/new_account_virtual_response_result.dart @@ -25,10 +25,8 @@ abstract class NewAccountVirtualResponseModel { class NewAccountVirtualResponse extends NewAccountVirtualResponseModel { /// Initializes New account virtual response class. const NewAccountVirtualResponse({ - NewAccountVirtual? newAccountVirtual, - }) : super( - newAccountVirtual: newAccountVirtual, - ); + super.newAccountVirtual, + }); /// Creates an instance from JSON. factory NewAccountVirtualResponse.fromJson( @@ -94,7 +92,6 @@ enum TypeEnum { /// wallet. wallet, } - /// New account virtual model class. abstract class NewAccountVirtualModel { /// Initializes New account virtual model class . @@ -134,22 +131,14 @@ abstract class NewAccountVirtualModel { class NewAccountVirtual extends NewAccountVirtualModel { /// Initializes New account virtual class. const NewAccountVirtual({ - required double balance, - required String clientId, - required String currency, - required String email, - required String oauthToken, - String? refreshToken, - TypeEnum? type, - }) : super( - balance: balance, - clientId: clientId, - currency: currency, - email: email, - oauthToken: oauthToken, - refreshToken: refreshToken, - type: type, - ); + required super.balance, + required super.clientId, + required super.currency, + required super.email, + required super.oauthToken, + super.refreshToken, + super.type, + }); /// Creates an instance from JSON. factory NewAccountVirtual.fromJson(Map json) => diff --git a/lib/api/response/notification_event_response_result.dart b/lib/api/response/notification_event_response_result.dart index 71d092f709..e88943e5f2 100644 --- a/lib/api/response/notification_event_response_result.dart +++ b/lib/api/response/notification_event_response_result.dart @@ -19,10 +19,8 @@ abstract class NotificationEventResponseModel { class NotificationEventResponse extends NotificationEventResponseModel { /// Initializes Notification event response class. const NotificationEventResponse({ - bool? notificationEvent, - }) : super( - notificationEvent: notificationEvent, - ); + super.notificationEvent, + }); /// Creates an instance from JSON. factory NotificationEventResponse.fromJson( diff --git a/lib/api/response/oauth_apps_response_result.dart b/lib/api/response/oauth_apps_response_result.dart index 3da3325f49..1e75c1d474 100644 --- a/lib/api/response/oauth_apps_response_result.dart +++ b/lib/api/response/oauth_apps_response_result.dart @@ -17,7 +17,7 @@ abstract class OauthAppsResponseModel { this.oauthApps, }); - /// List of OAuth applications that used for the authorized account. + /// List of 3rd party OAuth applications that used for the authorized account. final List? oauthApps; } @@ -25,10 +25,8 @@ abstract class OauthAppsResponseModel { class OauthAppsResponse extends OauthAppsResponseModel { /// Initializes Oauth apps response class. const OauthAppsResponse({ - List? oauthApps, - }) : super( - oauthApps: oauthApps, - ); + super.oauthApps, + }); /// Creates an instance from JSON. factory OauthAppsResponse.fromJson( @@ -88,12 +86,12 @@ class OauthAppsResponse extends OauthAppsResponseModel { oauthApps: oauthApps ?? this.oauthApps, ); } - /// Oauth apps item model class. abstract class OauthAppsItemModel { /// Initializes Oauth apps item model class . const OauthAppsItemModel({ required this.scopes, + required this.official, required this.name, required this.appMarkupPercentage, required this.appId, @@ -103,6 +101,9 @@ abstract class OauthAppsItemModel { /// The list of permission scopes grant for each app. final List scopes; + /// Boolean value: `true` or `false`, indicating `true` if app is an official app and `false` incase of unofficial app + final bool official; + /// Application name final String name; @@ -120,24 +121,20 @@ abstract class OauthAppsItemModel { class OauthAppsItem extends OauthAppsItemModel { /// Initializes Oauth apps item class. const OauthAppsItem({ - required int appId, - required double appMarkupPercentage, - required String name, - required List scopes, - String? lastUsed, - }) : super( - appId: appId, - appMarkupPercentage: appMarkupPercentage, - name: name, - scopes: scopes, - lastUsed: lastUsed, - ); + required super.appId, + required super.appMarkupPercentage, + required super.name, + required super.official, + required super.scopes, + super.lastUsed, + }); /// Creates an instance from JSON. factory OauthAppsItem.fromJson(Map json) => OauthAppsItem( appId: json['app_id'], appMarkupPercentage: getDouble(json['app_markup_percentage'])!, name: json['name'], + official: getBool(json['official'])!, scopes: List.from( json['scopes'].map( (dynamic item) => item, @@ -153,6 +150,7 @@ class OauthAppsItem extends OauthAppsItemModel { resultMap['app_id'] = appId; resultMap['app_markup_percentage'] = appMarkupPercentage; resultMap['name'] = name; + resultMap['official'] = official; resultMap['scopes'] = scopes .map( (String item) => item, @@ -169,6 +167,7 @@ class OauthAppsItem extends OauthAppsItemModel { int? appId, double? appMarkupPercentage, String? name, + bool? official, List? scopes, String? lastUsed, }) => @@ -176,6 +175,7 @@ class OauthAppsItem extends OauthAppsItemModel { appId: appId ?? this.appId, appMarkupPercentage: appMarkupPercentage ?? this.appMarkupPercentage, name: name ?? this.name, + official: official ?? this.official, scopes: scopes ?? this.scopes, lastUsed: lastUsed ?? this.lastUsed, ); diff --git a/lib/api/response/p2p_advert_create_response_result.dart b/lib/api/response/p2p_advert_create_response_result.dart index 6cdd91498f..cae00b3e42 100644 --- a/lib/api/response/p2p_advert_create_response_result.dart +++ b/lib/api/response/p2p_advert_create_response_result.dart @@ -2,7 +2,7 @@ import 'package:equatable/equatable.dart'; -import 'package:flutter_deriv_api/api/exceptions/base_api_exception.dart'; +import 'package:flutter_deriv_api/api/exceptions/p2p_advert_exception.dart'; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_receive.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_send.dart'; @@ -221,7 +221,6 @@ enum VisibilityStatusItemEnum { /// advertiser_temp_ban. advertiserTempBan, } - /// P2p advert create model class. abstract class P2pAdvertCreateModel { /// Initializes P2p advert create model class . @@ -258,6 +257,10 @@ abstract class P2pAdvertCreateModel { this.contactInfo, this.effectiveRate, this.effectiveRateDisplay, + this.eligibleCountries, + this.minCompletionRate, + this.minJoinDays, + this.minRating, this.paymentInfo, this.paymentMethod, this.paymentMethodDetails, @@ -363,6 +366,18 @@ abstract class P2pAdvertCreateModel { /// Conversion rate from account currency to local currency, using current market rate if applicable, formatted to appropriate decimal places. final String? effectiveRateDisplay; + /// 2 letter country codes. Counterparties who do not live in these countries are not allowed to place orders against this advert. + final List? eligibleCountries; + + /// Counterparties who have a 30 day completion rate less than this value are not allowed to place orders against this advert. + final double? minCompletionRate; + + /// Counterparties who joined less than this number of days ago are not allowed to place orders against this advert. + final int? minJoinDays; + + /// Counterparties who have an average rating less than this value are not allowed to place orders against this advert. + final double? minRating; + /// Payment instructions. Only applicable for 'sell adverts'. final String? paymentInfo; @@ -431,6 +446,10 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { super.contactInfo, super.effectiveRate, super.effectiveRateDisplay, + super.eligibleCountries, + super.minCompletionRate, + super.minJoinDays, + super.minRating, super.paymentInfo, super.paymentMethod, super.paymentMethodDetails, @@ -477,6 +496,16 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { contactInfo: json['contact_info'], effectiveRate: getDouble(json['effective_rate']), effectiveRateDisplay: json['effective_rate_display'], + eligibleCountries: json['eligible_countries'] == null + ? null + : List.from( + json['eligible_countries']?.map( + (dynamic item) => item, + ), + ), + minCompletionRate: getDouble(json['min_completion_rate']), + minJoinDays: json['min_join_days'], + minRating: getDouble(json['min_rating']), paymentInfo: json['payment_info'], paymentMethod: json['payment_method'], paymentMethodDetails: json['payment_method_details'] == null @@ -556,6 +585,16 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { resultMap['contact_info'] = contactInfo; resultMap['effective_rate'] = effectiveRate; resultMap['effective_rate_display'] = effectiveRateDisplay; + if (eligibleCountries != null) { + resultMap['eligible_countries'] = eligibleCountries! + .map( + (String item) => item, + ) + .toList(); + } + resultMap['min_completion_rate'] = minCompletionRate; + resultMap['min_join_days'] = minJoinDays; + resultMap['min_rating'] = minRating; resultMap['payment_info'] = paymentInfo; resultMap['payment_method'] = paymentMethod; resultMap['payment_method_details'] = paymentMethodDetails; @@ -618,6 +657,10 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { String? contactInfo, double? effectiveRate, String? effectiveRateDisplay, + List? eligibleCountries, + double? minCompletionRate, + int? minJoinDays, + double? minRating, String? paymentInfo, String? paymentMethod, Map? paymentMethodDetails, @@ -664,6 +707,10 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { contactInfo: contactInfo ?? this.contactInfo, effectiveRate: effectiveRate ?? this.effectiveRate, effectiveRateDisplay: effectiveRateDisplay ?? this.effectiveRateDisplay, + eligibleCountries: eligibleCountries ?? this.eligibleCountries, + minCompletionRate: minCompletionRate ?? this.minCompletionRate, + minJoinDays: minJoinDays ?? this.minJoinDays, + minRating: minRating ?? this.minRating, paymentInfo: paymentInfo ?? this.paymentInfo, paymentMethod: paymentMethod ?? this.paymentMethod, paymentMethodDetails: paymentMethodDetails ?? this.paymentMethodDetails, @@ -673,7 +720,6 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { visibilityStatus: visibilityStatus ?? this.visibilityStatus, ); } - /// Advertiser details model class. abstract class AdvertiserDetailsModel { /// Initializes Advertiser details model class . @@ -815,7 +861,6 @@ class AdvertiserDetails extends AdvertiserDetailsModel { totalCompletionRate: totalCompletionRate ?? this.totalCompletionRate, ); } - /// Payment method details property model class. abstract class PaymentMethodDetailsPropertyModel { /// Initializes Payment method details property model class . @@ -944,7 +989,6 @@ class PaymentMethodDetailsProperty extends PaymentMethodDetailsPropertyModel { usedByOrders: usedByOrders ?? this.usedByOrders, ); } - /// Fields property model class. abstract class FieldsPropertyModel { /// Initializes Fields property model class . diff --git a/lib/api/response/p2p_advert_info_response_result.dart b/lib/api/response/p2p_advert_info_response_result.dart index eac7137470..b4cb703daf 100644 --- a/lib/api/response/p2p_advert_info_response_result.dart +++ b/lib/api/response/p2p_advert_info_response_result.dart @@ -236,6 +236,30 @@ enum CounterpartyTypeEnum { sell, } +/// EligibilityStatusItemEnum mapper. +final Map eligibilityStatusItemEnumMapper = + { + "completion_rate": EligibilityStatusItemEnum.completionRate, + "country": EligibilityStatusItemEnum.country, + "join_date": EligibilityStatusItemEnum.joinDate, + "rating_average": EligibilityStatusItemEnum.ratingAverage, +}; + +/// EligibilityStatusItem Enum. +enum EligibilityStatusItemEnum { + /// completion_rate. + completionRate, + + /// country. + country, + + /// join_date. + joinDate, + + /// rating_average. + ratingAverage, +} + /// TypeEnum mapper. final Map typeEnumMapper = { "text": TypeEnum.text, @@ -370,18 +394,24 @@ abstract class P2pAdvertInfoModel { this.description, this.effectiveRate, this.effectiveRateDisplay, + this.eligibilityStatus, + this.eligibleCountries, this.id, this.isActive, + this.isEligible, this.isVisible, this.localCurrency, this.maxOrderAmount, this.maxOrderAmountDisplay, this.maxOrderAmountLimit, this.maxOrderAmountLimitDisplay, + this.minCompletionRate, + this.minJoinDays, this.minOrderAmount, this.minOrderAmountDisplay, this.minOrderAmountLimit, this.minOrderAmountLimitDisplay, + this.minRating, this.orderExpiryPeriod, this.paymentInfo, this.paymentMethod, @@ -443,12 +473,25 @@ abstract class P2pAdvertInfoModel { /// Conversion rate from account currency to local currency, using current market rate if applicable, formatted to appropriate decimal places. final String? effectiveRateDisplay; + /// Reasons why the counterparty terms do not allow the current user to place orders against this advert. Possible values: + /// - `completion_rate`: current user's 30 day completion rate is less than `min_completion_rate`. + /// - `country`: current user's residence is not in `eligible_countries`. + /// - `join_date`: current user registered on P2P less than `min_join_days` in the past. + /// - `rating`: current user's average review rating is less than `min_rating`. + final List? eligibilityStatus; + + /// 2 letter country codes. Counterparties who do not live in these countries are not allowed to place orders against this advert. + final List? eligibleCountries; + /// The unique identifier for this advert. final String? id; /// The activation status of the advert. final bool? isActive; + /// Indicates that the current user meets the counterparty terms for placing orders against this advert. + final bool? isEligible; + /// Indicates that this advert will appear on the main advert list. It is only visible to the advert owner. final bool? isVisible; @@ -467,6 +510,12 @@ abstract class P2pAdvertInfoModel { /// Maximum order amount at this time, in `account_currency`, formatted to appropriate decimal places. final String? maxOrderAmountLimitDisplay; + /// Counterparties who have a 30 day completion rate less than this value are not allowed to place orders against this advert. + final double? minCompletionRate; + + /// Counterparties who joined less than this number of days ago are not allowed to place orders against this advert. + final int? minJoinDays; + /// Minimum order amount specified in advert, in `account_currency`. It is only visible for advertisers. final double? minOrderAmount; @@ -479,6 +528,9 @@ abstract class P2pAdvertInfoModel { /// Minimum order amount at this time, in `account_currency`, formatted to appropriate decimal places. final String? minOrderAmountLimitDisplay; + /// Counterparties who have an average rating less than this value are not allowed to place orders against this advert. + final double? minRating; + /// Expiry period (seconds) for order created against this ad. final int? orderExpiryPeriod; @@ -551,18 +603,24 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { super.description, super.effectiveRate, super.effectiveRateDisplay, + super.eligibilityStatus, + super.eligibleCountries, super.id, super.isActive, + super.isEligible, super.isVisible, super.localCurrency, super.maxOrderAmount, super.maxOrderAmountDisplay, super.maxOrderAmountLimit, super.maxOrderAmountLimitDisplay, + super.minCompletionRate, + super.minJoinDays, super.minOrderAmount, super.minOrderAmountDisplay, super.minOrderAmountLimit, super.minOrderAmountLimitDisplay, + super.minRating, super.orderExpiryPeriod, super.paymentInfo, super.paymentMethod, @@ -600,18 +658,38 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { description: json['description'], effectiveRate: getDouble(json['effective_rate']), effectiveRateDisplay: json['effective_rate_display'], + eligibilityStatus: json['eligibility_status'] == null + ? null + : List.from( + json['eligibility_status']?.map( + (dynamic item) => item == null + ? null + : eligibilityStatusItemEnumMapper[item], + ), + ), + eligibleCountries: json['eligible_countries'] == null + ? null + : List.from( + json['eligible_countries']?.map( + (dynamic item) => item, + ), + ), id: json['id'], isActive: getBool(json['is_active']), + isEligible: getBool(json['is_eligible']), isVisible: getBool(json['is_visible']), localCurrency: json['local_currency'], maxOrderAmount: getDouble(json['max_order_amount']), maxOrderAmountDisplay: json['max_order_amount_display'], maxOrderAmountLimit: getDouble(json['max_order_amount_limit']), maxOrderAmountLimitDisplay: json['max_order_amount_limit_display'], + minCompletionRate: getDouble(json['min_completion_rate']), + minJoinDays: json['min_join_days'], minOrderAmount: getDouble(json['min_order_amount']), minOrderAmountDisplay: json['min_order_amount_display'], minOrderAmountLimit: getDouble(json['min_order_amount_limit']), minOrderAmountLimitDisplay: json['min_order_amount_limit_display'], + minRating: getDouble(json['min_rating']), orderExpiryPeriod: json['order_expiry_period'], paymentInfo: json['payment_info'], paymentMethod: json['payment_method'], @@ -680,18 +758,41 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { resultMap['description'] = description; resultMap['effective_rate'] = effectiveRate; resultMap['effective_rate_display'] = effectiveRateDisplay; + if (eligibilityStatus != null) { + resultMap['eligibility_status'] = eligibilityStatus! + .map( + (EligibilityStatusItemEnum item) => eligibilityStatusItemEnumMapper + .entries + .firstWhere( + (MapEntry entry) => + entry.value == item) + .key, + ) + .toList(); + } + if (eligibleCountries != null) { + resultMap['eligible_countries'] = eligibleCountries! + .map( + (String item) => item, + ) + .toList(); + } resultMap['id'] = id; resultMap['is_active'] = isActive; + resultMap['is_eligible'] = isEligible; resultMap['is_visible'] = isVisible; resultMap['local_currency'] = localCurrency; resultMap['max_order_amount'] = maxOrderAmount; resultMap['max_order_amount_display'] = maxOrderAmountDisplay; resultMap['max_order_amount_limit'] = maxOrderAmountLimit; resultMap['max_order_amount_limit_display'] = maxOrderAmountLimitDisplay; + resultMap['min_completion_rate'] = minCompletionRate; + resultMap['min_join_days'] = minJoinDays; resultMap['min_order_amount'] = minOrderAmount; resultMap['min_order_amount_display'] = minOrderAmountDisplay; resultMap['min_order_amount_limit'] = minOrderAmountLimit; resultMap['min_order_amount_limit_display'] = minOrderAmountLimitDisplay; + resultMap['min_rating'] = minRating; resultMap['order_expiry_period'] = orderExpiryPeriod; resultMap['payment_info'] = paymentInfo; resultMap['payment_method'] = paymentMethod; @@ -750,18 +851,24 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { String? description, double? effectiveRate, String? effectiveRateDisplay, + List? eligibilityStatus, + List? eligibleCountries, String? id, bool? isActive, + bool? isEligible, bool? isVisible, String? localCurrency, double? maxOrderAmount, String? maxOrderAmountDisplay, double? maxOrderAmountLimit, String? maxOrderAmountLimitDisplay, + double? minCompletionRate, + int? minJoinDays, double? minOrderAmount, String? minOrderAmountDisplay, double? minOrderAmountLimit, String? minOrderAmountLimitDisplay, + double? minRating, int? orderExpiryPeriod, String? paymentInfo, String? paymentMethod, @@ -793,8 +900,11 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { description: description ?? this.description, effectiveRate: effectiveRate ?? this.effectiveRate, effectiveRateDisplay: effectiveRateDisplay ?? this.effectiveRateDisplay, + eligibilityStatus: eligibilityStatus ?? this.eligibilityStatus, + eligibleCountries: eligibleCountries ?? this.eligibleCountries, id: id ?? this.id, isActive: isActive ?? this.isActive, + isEligible: isEligible ?? this.isEligible, isVisible: isVisible ?? this.isVisible, localCurrency: localCurrency ?? this.localCurrency, maxOrderAmount: maxOrderAmount ?? this.maxOrderAmount, @@ -803,12 +913,15 @@ class P2pAdvertInfo extends P2pAdvertInfoModel { maxOrderAmountLimit: maxOrderAmountLimit ?? this.maxOrderAmountLimit, maxOrderAmountLimitDisplay: maxOrderAmountLimitDisplay ?? this.maxOrderAmountLimitDisplay, + minCompletionRate: minCompletionRate ?? this.minCompletionRate, + minJoinDays: minJoinDays ?? this.minJoinDays, minOrderAmount: minOrderAmount ?? this.minOrderAmount, minOrderAmountDisplay: minOrderAmountDisplay ?? this.minOrderAmountDisplay, minOrderAmountLimit: minOrderAmountLimit ?? this.minOrderAmountLimit, minOrderAmountLimitDisplay: minOrderAmountLimitDisplay ?? this.minOrderAmountLimitDisplay, + minRating: minRating ?? this.minRating, orderExpiryPeriod: orderExpiryPeriod ?? this.orderExpiryPeriod, paymentInfo: paymentInfo ?? this.paymentInfo, paymentMethod: paymentMethod ?? this.paymentMethod, diff --git a/lib/api/response/p2p_advert_list_response_result.dart b/lib/api/response/p2p_advert_list_response_result.dart index 2f4d2bf0a2..d3dc565671 100644 --- a/lib/api/response/p2p_advert_list_response_result.dart +++ b/lib/api/response/p2p_advert_list_response_result.dart @@ -2,7 +2,7 @@ import 'package:equatable/equatable.dart'; -import 'package:flutter_deriv_api/api/exceptions/base_api_exception.dart'; +import 'package:flutter_deriv_api/api/exceptions/p2p_advert_exception.dart'; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_receive.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_send.dart'; @@ -106,6 +106,30 @@ enum CounterpartyTypeEnum { sell, } +/// EligibilityStatusItemEnum mapper. +final Map eligibilityStatusItemEnumMapper = + { + "completion_rate": EligibilityStatusItemEnum.completionRate, + "country": EligibilityStatusItemEnum.country, + "join_date": EligibilityStatusItemEnum.joinDate, + "rating_average": EligibilityStatusItemEnum.ratingAverage, +}; + +/// EligibilityStatusItem Enum. +enum EligibilityStatusItemEnum { + /// completion_rate. + completionRate, + + /// country. + country, + + /// join_date. + joinDate, + + /// rating_average. + ratingAverage, +} + /// RateTypeEnum mapper. final Map rateTypeEnumMapper = { "fixed": RateTypeEnum.fixed, @@ -184,7 +208,6 @@ enum VisibilityStatusItemEnum { /// advertiser_temp_ban. advertiserTempBan, } - /// P2p advert list model class. abstract class P2pAdvertListModel { /// Initializes P2p advert list model class . @@ -233,7 +256,6 @@ class P2pAdvertList extends P2pAdvertListModel { list: list ?? this.list, ); } - /// List item model class. abstract class ListItemModel { /// Initializes List item model class . @@ -265,10 +287,16 @@ abstract class ListItemModel { this.daysUntilArchive, this.effectiveRate, this.effectiveRateDisplay, + this.eligibilityStatus, + this.eligibleCountries, + this.isEligible, this.maxOrderAmount, this.maxOrderAmountDisplay, + this.minCompletionRate, + this.minJoinDays, this.minOrderAmount, this.minOrderAmountDisplay, + this.minRating, this.paymentInfo, this.paymentMethod, this.paymentMethodNames, @@ -360,18 +388,40 @@ abstract class ListItemModel { /// Conversion rate from account currency to local currency, using current market rate if applicable, formatted to appropriate decimal places. final String? effectiveRateDisplay; + /// Reasons why the counterparty terms do not allow the current user to place orders against this advert. Possible values: + /// - `completion_rate`: current user's 30 day completion rate is less than `min_completion_rate`. + /// - `country`: current user's residence is not in `eligible_countries`. + /// - `join_date`: current user registered on P2P less than `min_join_days` in the past. + /// - `rating`: current user's average review rating is less than `min_rating`. + final List? eligibilityStatus; + + /// 2 letter country codes. Counterparties who do not live in these countries are not allowed to place orders against this advert. + final List? eligibleCountries; + + /// Indicates that the current user meets the counterparty terms for placing an order. + final bool? isEligible; + /// Maximum order amount specified in advert, in `account_currency`. It is only visible for advertisers. final double? maxOrderAmount; /// Maximum order amount specified in advert, in `account_currency`, formatted to appropriate decimal places. It is only visible to the advert owner. final String? maxOrderAmountDisplay; + /// Counterparties who have a 30 day completion rate less than this value are not allowed to place orders against this advert. + final double? minCompletionRate; + + /// Counterparties who joined less than this number of days ago are not allowed to place orders against this advert. + final int? minJoinDays; + /// Minimum order amount specified in advert, in `account_currency`. It is only visible for advertisers. final double? minOrderAmount; /// Minimum order amount specified in advert, in `account_currency`, formatted to appropriate decimal places. It is only visible to the advert owner. final String? minOrderAmountDisplay; + /// Counterparties who have an average rating less than this value are not allowed to place orders against this advert. + final double? minRating; + /// Payment instructions. Only applicable for 'sell adverts'. final String? paymentInfo; @@ -438,10 +488,16 @@ class ListItem extends ListItemModel { super.daysUntilArchive, super.effectiveRate, super.effectiveRateDisplay, + super.eligibilityStatus, + super.eligibleCountries, + super.isEligible, super.maxOrderAmount, super.maxOrderAmountDisplay, + super.minCompletionRate, + super.minJoinDays, super.minOrderAmount, super.minOrderAmountDisplay, + super.minRating, super.paymentInfo, super.paymentMethod, super.paymentMethodNames, @@ -483,10 +539,30 @@ class ListItem extends ListItemModel { daysUntilArchive: json['days_until_archive'], effectiveRate: getDouble(json['effective_rate']), effectiveRateDisplay: json['effective_rate_display'], + eligibilityStatus: json['eligibility_status'] == null + ? null + : List.from( + json['eligibility_status']?.map( + (dynamic item) => item == null + ? null + : eligibilityStatusItemEnumMapper[item], + ), + ), + eligibleCountries: json['eligible_countries'] == null + ? null + : List.from( + json['eligible_countries']?.map( + (dynamic item) => item, + ), + ), + isEligible: getBool(json['is_eligible']), maxOrderAmount: getDouble(json['max_order_amount']), maxOrderAmountDisplay: json['max_order_amount_display'], + minCompletionRate: getDouble(json['min_completion_rate']), + minJoinDays: json['min_join_days'], minOrderAmount: getDouble(json['min_order_amount']), minOrderAmountDisplay: json['min_order_amount_display'], + minRating: getDouble(json['min_rating']), paymentInfo: json['payment_info'], paymentMethod: json['payment_method'], paymentMethodNames: json['payment_method_names'] == null @@ -551,10 +627,33 @@ class ListItem extends ListItemModel { resultMap['days_until_archive'] = daysUntilArchive; resultMap['effective_rate'] = effectiveRate; resultMap['effective_rate_display'] = effectiveRateDisplay; + if (eligibilityStatus != null) { + resultMap['eligibility_status'] = eligibilityStatus! + .map( + (EligibilityStatusItemEnum item) => eligibilityStatusItemEnumMapper + .entries + .firstWhere( + (MapEntry entry) => + entry.value == item) + .key, + ) + .toList(); + } + if (eligibleCountries != null) { + resultMap['eligible_countries'] = eligibleCountries! + .map( + (String item) => item, + ) + .toList(); + } + resultMap['is_eligible'] = isEligible; resultMap['max_order_amount'] = maxOrderAmount; resultMap['max_order_amount_display'] = maxOrderAmountDisplay; + resultMap['min_completion_rate'] = minCompletionRate; + resultMap['min_join_days'] = minJoinDays; resultMap['min_order_amount'] = minOrderAmount; resultMap['min_order_amount_display'] = minOrderAmountDisplay; + resultMap['min_rating'] = minRating; resultMap['payment_info'] = paymentInfo; resultMap['payment_method'] = paymentMethod; if (paymentMethodNames != null) { @@ -613,10 +712,16 @@ class ListItem extends ListItemModel { int? daysUntilArchive, double? effectiveRate, String? effectiveRateDisplay, + List? eligibilityStatus, + List? eligibleCountries, + bool? isEligible, double? maxOrderAmount, String? maxOrderAmountDisplay, + double? minCompletionRate, + int? minJoinDays, double? minOrderAmount, String? minOrderAmountDisplay, + double? minRating, String? paymentInfo, String? paymentMethod, List? paymentMethodNames, @@ -656,12 +761,18 @@ class ListItem extends ListItemModel { daysUntilArchive: daysUntilArchive ?? this.daysUntilArchive, effectiveRate: effectiveRate ?? this.effectiveRate, effectiveRateDisplay: effectiveRateDisplay ?? this.effectiveRateDisplay, + eligibilityStatus: eligibilityStatus ?? this.eligibilityStatus, + eligibleCountries: eligibleCountries ?? this.eligibleCountries, + isEligible: isEligible ?? this.isEligible, maxOrderAmount: maxOrderAmount ?? this.maxOrderAmount, maxOrderAmountDisplay: maxOrderAmountDisplay ?? this.maxOrderAmountDisplay, + minCompletionRate: minCompletionRate ?? this.minCompletionRate, + minJoinDays: minJoinDays ?? this.minJoinDays, minOrderAmount: minOrderAmount ?? this.minOrderAmount, minOrderAmountDisplay: minOrderAmountDisplay ?? this.minOrderAmountDisplay, + minRating: minRating ?? this.minRating, paymentInfo: paymentInfo ?? this.paymentInfo, paymentMethod: paymentMethod ?? this.paymentMethod, paymentMethodNames: paymentMethodNames ?? this.paymentMethodNames, @@ -673,7 +784,6 @@ class ListItem extends ListItemModel { visibilityStatus: visibilityStatus ?? this.visibilityStatus, ); } - /// Advertiser details model class. abstract class AdvertiserDetailsModel { /// Initializes Advertiser details model class . diff --git a/lib/api/response/p2p_advert_update_response_result.dart b/lib/api/response/p2p_advert_update_response_result.dart index 29dda903dd..a41f4f1541 100644 --- a/lib/api/response/p2p_advert_update_response_result.dart +++ b/lib/api/response/p2p_advert_update_response_result.dart @@ -241,6 +241,7 @@ abstract class P2pAdvertUpdateModel { this.description, this.effectiveRate, this.effectiveRateDisplay, + this.eligibleCountries, this.isActive, this.isVisible, this.localCurrency, @@ -248,10 +249,13 @@ abstract class P2pAdvertUpdateModel { this.maxOrderAmountDisplay, this.maxOrderAmountLimit, this.maxOrderAmountLimitDisplay, + this.minCompletionRate, + this.minJoinDays, this.minOrderAmount, this.minOrderAmountDisplay, this.minOrderAmountLimit, this.minOrderAmountLimitDisplay, + this.minRating, this.orderExpiryPeriod, this.paymentInfo, this.paymentMethod, @@ -316,6 +320,9 @@ abstract class P2pAdvertUpdateModel { /// Conversion rate from account currency to local currency, using current market rate if applicable, formatted to appropriate decimal places. final String? effectiveRateDisplay; + /// 2 letter country codes. Counterparties who do not live in these countries are not allowed to place orders against this advert + final List? eligibleCountries; + /// The activation status of the advert. final bool? isActive; @@ -337,6 +344,12 @@ abstract class P2pAdvertUpdateModel { /// Maximum order amount at this time, in `account_currency`, formatted to appropriate decimal places. final String? maxOrderAmountLimitDisplay; + /// Counterparties who have a 30 day completion rate less than this value are not allowed to place orders against this advert. + final double? minCompletionRate; + + /// Counterparties who joined less than this number of days ago are not allowed to place orders against this advert. + final int? minJoinDays; + /// Minimum order amount specified in advert, in `account_currency`. It is only visible to the advert owner. final double? minOrderAmount; @@ -349,6 +362,9 @@ abstract class P2pAdvertUpdateModel { /// Minimum order amount at this time, in `account_currency`, formatted to appropriate decimal places. final String? minOrderAmountLimitDisplay; + /// Counterparties who have an average rating less than this value are not allowed to place orders against this advert. + final double? minRating; + /// Expiry period (seconds) for order created against this ad. final int? orderExpiryPeriod; @@ -422,6 +438,7 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { super.description, super.effectiveRate, super.effectiveRateDisplay, + super.eligibleCountries, super.isActive, super.isVisible, super.localCurrency, @@ -429,10 +446,13 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { super.maxOrderAmountDisplay, super.maxOrderAmountLimit, super.maxOrderAmountLimitDisplay, + super.minCompletionRate, + super.minJoinDays, super.minOrderAmount, super.minOrderAmountDisplay, super.minOrderAmountLimit, super.minOrderAmountLimitDisplay, + super.minRating, super.orderExpiryPeriod, super.paymentInfo, super.paymentMethod, @@ -472,6 +492,13 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { description: json['description'], effectiveRate: getDouble(json['effective_rate']), effectiveRateDisplay: json['effective_rate_display'], + eligibleCountries: json['eligible_countries'] == null + ? null + : List.from( + json['eligible_countries']?.map( + (dynamic item) => item, + ), + ), isActive: getBool(json['is_active']), isVisible: getBool(json['is_visible']), localCurrency: json['local_currency'], @@ -479,10 +506,13 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { maxOrderAmountDisplay: json['max_order_amount_display'], maxOrderAmountLimit: getDouble(json['max_order_amount_limit']), maxOrderAmountLimitDisplay: json['max_order_amount_limit_display'], + minCompletionRate: getDouble(json['min_completion_rate']), + minJoinDays: json['min_join_days'], minOrderAmount: getDouble(json['min_order_amount']), minOrderAmountDisplay: json['min_order_amount_display'], minOrderAmountLimit: getDouble(json['min_order_amount_limit']), minOrderAmountLimitDisplay: json['min_order_amount_limit_display'], + minRating: getDouble(json['min_rating']), orderExpiryPeriod: json['order_expiry_period'], paymentInfo: json['payment_info'], paymentMethod: json['payment_method'], @@ -552,6 +582,13 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { resultMap['description'] = description; resultMap['effective_rate'] = effectiveRate; resultMap['effective_rate_display'] = effectiveRateDisplay; + if (eligibleCountries != null) { + resultMap['eligible_countries'] = eligibleCountries! + .map( + (String item) => item, + ) + .toList(); + } resultMap['is_active'] = isActive; resultMap['is_visible'] = isVisible; resultMap['local_currency'] = localCurrency; @@ -559,10 +596,13 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { resultMap['max_order_amount_display'] = maxOrderAmountDisplay; resultMap['max_order_amount_limit'] = maxOrderAmountLimit; resultMap['max_order_amount_limit_display'] = maxOrderAmountLimitDisplay; + resultMap['min_completion_rate'] = minCompletionRate; + resultMap['min_join_days'] = minJoinDays; resultMap['min_order_amount'] = minOrderAmount; resultMap['min_order_amount_display'] = minOrderAmountDisplay; resultMap['min_order_amount_limit'] = minOrderAmountLimit; resultMap['min_order_amount_limit_display'] = minOrderAmountLimitDisplay; + resultMap['min_rating'] = minRating; resultMap['order_expiry_period'] = orderExpiryPeriod; resultMap['payment_info'] = paymentInfo; resultMap['payment_method'] = paymentMethod; @@ -622,6 +662,7 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { String? description, double? effectiveRate, String? effectiveRateDisplay, + List? eligibleCountries, bool? isActive, bool? isVisible, String? localCurrency, @@ -629,10 +670,13 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { String? maxOrderAmountDisplay, double? maxOrderAmountLimit, String? maxOrderAmountLimitDisplay, + double? minCompletionRate, + int? minJoinDays, double? minOrderAmount, String? minOrderAmountDisplay, double? minOrderAmountLimit, String? minOrderAmountLimitDisplay, + double? minRating, int? orderExpiryPeriod, String? paymentInfo, String? paymentMethod, @@ -665,6 +709,7 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { description: description ?? this.description, effectiveRate: effectiveRate ?? this.effectiveRate, effectiveRateDisplay: effectiveRateDisplay ?? this.effectiveRateDisplay, + eligibleCountries: eligibleCountries ?? this.eligibleCountries, isActive: isActive ?? this.isActive, isVisible: isVisible ?? this.isVisible, localCurrency: localCurrency ?? this.localCurrency, @@ -674,12 +719,15 @@ class P2pAdvertUpdate extends P2pAdvertUpdateModel { maxOrderAmountLimit: maxOrderAmountLimit ?? this.maxOrderAmountLimit, maxOrderAmountLimitDisplay: maxOrderAmountLimitDisplay ?? this.maxOrderAmountLimitDisplay, + minCompletionRate: minCompletionRate ?? this.minCompletionRate, + minJoinDays: minJoinDays ?? this.minJoinDays, minOrderAmount: minOrderAmount ?? this.minOrderAmount, minOrderAmountDisplay: minOrderAmountDisplay ?? this.minOrderAmountDisplay, minOrderAmountLimit: minOrderAmountLimit ?? this.minOrderAmountLimit, minOrderAmountLimitDisplay: minOrderAmountLimitDisplay ?? this.minOrderAmountLimitDisplay, + minRating: minRating ?? this.minRating, orderExpiryPeriod: orderExpiryPeriod ?? this.orderExpiryPeriod, paymentInfo: paymentInfo ?? this.paymentInfo, paymentMethod: paymentMethod ?? this.paymentMethod, diff --git a/lib/api/response/p2p_advertiser_adverts_response_result.dart b/lib/api/response/p2p_advertiser_adverts_response_result.dart index 89334957f2..d7ba72e949 100644 --- a/lib/api/response/p2p_advertiser_adverts_response_result.dart +++ b/lib/api/response/p2p_advertiser_adverts_response_result.dart @@ -271,6 +271,10 @@ abstract class ListItemModel { this.daysUntilArchive, this.effectiveRate, this.effectiveRateDisplay, + this.eligibleCountries, + this.minCompletionRate, + this.minJoinDays, + this.minRating, this.paymentMethod, this.paymentMethodNames, this.price, @@ -380,6 +384,18 @@ abstract class ListItemModel { /// Conversion rate from account currency to local currency, using current market rate if applicable, formatted to appropriate decimal places. final String? effectiveRateDisplay; + /// 2 letter country codes. Counterparties who do not live in these countries are not allowed to place orders. + final List? eligibleCountries; + + /// Counterparties who have a 30 day completion rate less than this value are not allowed to place orders. + final double? minCompletionRate; + + /// Counterparties who joined less than this number of days ago are not allowed to place orders. + final int? minJoinDays; + + /// Counterparties who have an average rating less than this value are not allowed to place orders. + final double? minRating; + /// Payment method name (deprecated). final String? paymentMethod; @@ -444,6 +460,10 @@ class ListItem extends ListItemModel { super.daysUntilArchive, super.effectiveRate, super.effectiveRateDisplay, + super.eligibleCountries, + super.minCompletionRate, + super.minJoinDays, + super.minRating, super.paymentMethod, super.paymentMethodNames, super.price, @@ -489,6 +509,16 @@ class ListItem extends ListItemModel { daysUntilArchive: json['days_until_archive'], effectiveRate: getDouble(json['effective_rate']), effectiveRateDisplay: json['effective_rate_display'], + eligibleCountries: json['eligible_countries'] == null + ? null + : List.from( + json['eligible_countries']?.map( + (dynamic item) => item, + ), + ), + minCompletionRate: getDouble(json['min_completion_rate']), + minJoinDays: json['min_join_days'], + minRating: getDouble(json['min_rating']), paymentMethod: json['payment_method'], paymentMethodNames: json['payment_method_names'] == null ? null @@ -557,6 +587,16 @@ class ListItem extends ListItemModel { resultMap['days_until_archive'] = daysUntilArchive; resultMap['effective_rate'] = effectiveRate; resultMap['effective_rate_display'] = effectiveRateDisplay; + if (eligibleCountries != null) { + resultMap['eligible_countries'] = eligibleCountries! + .map( + (String item) => item, + ) + .toList(); + } + resultMap['min_completion_rate'] = minCompletionRate; + resultMap['min_join_days'] = minJoinDays; + resultMap['min_rating'] = minRating; resultMap['payment_method'] = paymentMethod; if (paymentMethodNames != null) { resultMap['payment_method_names'] = paymentMethodNames! @@ -619,6 +659,10 @@ class ListItem extends ListItemModel { int? daysUntilArchive, double? effectiveRate, String? effectiveRateDisplay, + List? eligibleCountries, + double? minCompletionRate, + int? minJoinDays, + double? minRating, String? paymentMethod, List? paymentMethodNames, double? price, @@ -665,6 +709,10 @@ class ListItem extends ListItemModel { daysUntilArchive: daysUntilArchive ?? this.daysUntilArchive, effectiveRate: effectiveRate ?? this.effectiveRate, effectiveRateDisplay: effectiveRateDisplay ?? this.effectiveRateDisplay, + eligibleCountries: eligibleCountries ?? this.eligibleCountries, + minCompletionRate: minCompletionRate ?? this.minCompletionRate, + minJoinDays: minJoinDays ?? this.minJoinDays, + minRating: minRating ?? this.minRating, paymentMethod: paymentMethod ?? this.paymentMethod, paymentMethodNames: paymentMethodNames ?? this.paymentMethodNames, price: price ?? this.price, diff --git a/lib/api/response/p2p_advertiser_create_response_result.dart b/lib/api/response/p2p_advertiser_create_response_result.dart index abb9fc5f7f..85b5050ace 100644 --- a/lib/api/response/p2p_advertiser_create_response_result.dart +++ b/lib/api/response/p2p_advertiser_create_response_result.dart @@ -31,12 +31,9 @@ abstract class P2pAdvertiserCreateResponseModel { class P2pAdvertiserCreateResponse extends P2pAdvertiserCreateResponseModel { /// Initializes P2p advertiser create response class. const P2pAdvertiserCreateResponse({ - P2pAdvertiserCreate? p2pAdvertiserCreate, - Subscription? subscription, - }) : super( - p2pAdvertiserCreate: p2pAdvertiserCreate, - subscription: subscription, - ); + super.p2pAdvertiserCreate, + super.subscription, + }); /// Creates an instance from JSON. factory P2pAdvertiserCreateResponse.fromJson( @@ -146,7 +143,6 @@ class P2pAdvertiserCreateResponse extends P2pAdvertiserCreateResponseModel { subscription: subscription ?? this.subscription, ); } - /// P2p advertiser create model class. abstract class P2pAdvertiserCreateModel { /// Initializes P2p advertiser create model class . @@ -168,8 +164,6 @@ abstract class P2pAdvertiserCreateModel { required this.defaultAdvertDescription, required this.createdTime, required this.contactInfo, - required this.chatUserId, - required this.chatToken, required this.cancelsRemaining, required this.buyOrdersCount, required this.buyOrdersAmount, @@ -180,6 +174,8 @@ abstract class P2pAdvertiserCreateModel { this.buyCompletionRate, this.buyTimeAvg, this.cancelTimeAvg, + this.chatToken, + this.chatUserId, this.dailyBuy, this.dailyBuyLimit, this.dailySell, @@ -248,12 +244,6 @@ abstract class P2pAdvertiserCreateModel { /// Advertiser's contact information. final String contactInfo; - /// The unique identifier for the chat user. - final String chatUserId; - - /// The token to be used for authenticating the client for chat. - final String chatToken; - /// The number of times the user may cancel orders before being temporarily blocked. final int cancelsRemaining; @@ -284,6 +274,12 @@ abstract class P2pAdvertiserCreateModel { /// The average time in seconds taken to cancel orders as a buyer within the past 30 days. final int? cancelTimeAvg; + /// The token to be used for authenticating the client for chat. + final String? chatToken; + + /// The unique identifier for the chat user. + final String? chatUserId; + /// Total value of P2P buy transactions in the past 24 hours. final String? dailyBuy; @@ -334,96 +330,51 @@ abstract class P2pAdvertiserCreateModel { class P2pAdvertiserCreate extends P2pAdvertiserCreateModel { /// Initializes P2p advertiser create class. const P2pAdvertiserCreate({ - required double balanceAvailable, - required bool basicVerification, - required int blockedByCount, - required String buyOrdersAmount, - required int buyOrdersCount, - required int cancelsRemaining, - required String chatToken, - required String chatUserId, - required String contactInfo, - required DateTime createdTime, - required String defaultAdvertDescription, - required bool fullVerification, - required String id, - required bool isApproved, - required bool isListed, - required bool isOnline, - required String name, - required int partnerCount, - required String paymentInfo, - required int ratingCount, - required String sellOrdersAmount, - required int sellOrdersCount, - required bool showName, - required int totalOrdersCount, - required String totalTurnover, - double? advertRates, - double? buyCompletionRate, - int? buyTimeAvg, - int? cancelTimeAvg, - String? dailyBuy, - String? dailyBuyLimit, - String? dailySell, - String? dailySellLimit, - DateTime? lastOnlineTime, - String? maxOrderAmount, - String? minBalance, - String? minOrderAmount, - double? ratingAverage, - double? recommendedAverage, - int? recommendedCount, - int? releaseTimeAvg, - double? sellCompletionRate, - double? totalCompletionRate, - String? withdrawalLimit, - }) : super( - balanceAvailable: balanceAvailable, - basicVerification: basicVerification, - blockedByCount: blockedByCount, - buyOrdersAmount: buyOrdersAmount, - buyOrdersCount: buyOrdersCount, - cancelsRemaining: cancelsRemaining, - chatToken: chatToken, - chatUserId: chatUserId, - contactInfo: contactInfo, - createdTime: createdTime, - defaultAdvertDescription: defaultAdvertDescription, - fullVerification: fullVerification, - id: id, - isApproved: isApproved, - isListed: isListed, - isOnline: isOnline, - name: name, - partnerCount: partnerCount, - paymentInfo: paymentInfo, - ratingCount: ratingCount, - sellOrdersAmount: sellOrdersAmount, - sellOrdersCount: sellOrdersCount, - showName: showName, - totalOrdersCount: totalOrdersCount, - totalTurnover: totalTurnover, - advertRates: advertRates, - buyCompletionRate: buyCompletionRate, - buyTimeAvg: buyTimeAvg, - cancelTimeAvg: cancelTimeAvg, - dailyBuy: dailyBuy, - dailyBuyLimit: dailyBuyLimit, - dailySell: dailySell, - dailySellLimit: dailySellLimit, - lastOnlineTime: lastOnlineTime, - maxOrderAmount: maxOrderAmount, - minBalance: minBalance, - minOrderAmount: minOrderAmount, - ratingAverage: ratingAverage, - recommendedAverage: recommendedAverage, - recommendedCount: recommendedCount, - releaseTimeAvg: releaseTimeAvg, - sellCompletionRate: sellCompletionRate, - totalCompletionRate: totalCompletionRate, - withdrawalLimit: withdrawalLimit, - ); + required super.balanceAvailable, + required super.basicVerification, + required super.blockedByCount, + required super.buyOrdersAmount, + required super.buyOrdersCount, + required super.cancelsRemaining, + required super.contactInfo, + required super.createdTime, + required super.defaultAdvertDescription, + required super.fullVerification, + required super.id, + required super.isApproved, + required super.isListed, + required super.isOnline, + required super.name, + required super.partnerCount, + required super.paymentInfo, + required super.ratingCount, + required super.sellOrdersAmount, + required super.sellOrdersCount, + required super.showName, + required super.totalOrdersCount, + required super.totalTurnover, + super.advertRates, + super.buyCompletionRate, + super.buyTimeAvg, + super.cancelTimeAvg, + super.chatToken, + super.chatUserId, + super.dailyBuy, + super.dailyBuyLimit, + super.dailySell, + super.dailySellLimit, + super.lastOnlineTime, + super.maxOrderAmount, + super.minBalance, + super.minOrderAmount, + super.ratingAverage, + super.recommendedAverage, + super.recommendedCount, + super.releaseTimeAvg, + super.sellCompletionRate, + super.totalCompletionRate, + super.withdrawalLimit, + }); /// Creates an instance from JSON. factory P2pAdvertiserCreate.fromJson(Map json) => @@ -434,8 +385,6 @@ class P2pAdvertiserCreate extends P2pAdvertiserCreateModel { buyOrdersAmount: json['buy_orders_amount'], buyOrdersCount: json['buy_orders_count'], cancelsRemaining: json['cancels_remaining'], - chatToken: json['chat_token'], - chatUserId: json['chat_user_id'], contactInfo: json['contact_info'], createdTime: getDateTime(json['created_time'])!, defaultAdvertDescription: json['default_advert_description'], @@ -457,6 +406,8 @@ class P2pAdvertiserCreate extends P2pAdvertiserCreateModel { buyCompletionRate: getDouble(json['buy_completion_rate']), buyTimeAvg: json['buy_time_avg'], cancelTimeAvg: json['cancel_time_avg'], + chatToken: json['chat_token'], + chatUserId: json['chat_user_id'], dailyBuy: json['daily_buy'], dailyBuyLimit: json['daily_buy_limit'], dailySell: json['daily_sell'], @@ -484,8 +435,6 @@ class P2pAdvertiserCreate extends P2pAdvertiserCreateModel { resultMap['buy_orders_amount'] = buyOrdersAmount; resultMap['buy_orders_count'] = buyOrdersCount; resultMap['cancels_remaining'] = cancelsRemaining; - resultMap['chat_token'] = chatToken; - resultMap['chat_user_id'] = chatUserId; resultMap['contact_info'] = contactInfo; resultMap['created_time'] = getSecondsSinceEpochDateTime(createdTime); resultMap['default_advert_description'] = defaultAdvertDescription; @@ -507,6 +456,8 @@ class P2pAdvertiserCreate extends P2pAdvertiserCreateModel { resultMap['buy_completion_rate'] = buyCompletionRate; resultMap['buy_time_avg'] = buyTimeAvg; resultMap['cancel_time_avg'] = cancelTimeAvg; + resultMap['chat_token'] = chatToken; + resultMap['chat_user_id'] = chatUserId; resultMap['daily_buy'] = dailyBuy; resultMap['daily_buy_limit'] = dailyBuyLimit; resultMap['daily_sell'] = dailySell; @@ -535,8 +486,6 @@ class P2pAdvertiserCreate extends P2pAdvertiserCreateModel { String? buyOrdersAmount, int? buyOrdersCount, int? cancelsRemaining, - String? chatToken, - String? chatUserId, String? contactInfo, DateTime? createdTime, String? defaultAdvertDescription, @@ -558,6 +507,8 @@ class P2pAdvertiserCreate extends P2pAdvertiserCreateModel { double? buyCompletionRate, int? buyTimeAvg, int? cancelTimeAvg, + String? chatToken, + String? chatUserId, String? dailyBuy, String? dailyBuyLimit, String? dailySell, @@ -581,8 +532,6 @@ class P2pAdvertiserCreate extends P2pAdvertiserCreateModel { buyOrdersAmount: buyOrdersAmount ?? this.buyOrdersAmount, buyOrdersCount: buyOrdersCount ?? this.buyOrdersCount, cancelsRemaining: cancelsRemaining ?? this.cancelsRemaining, - chatToken: chatToken ?? this.chatToken, - chatUserId: chatUserId ?? this.chatUserId, contactInfo: contactInfo ?? this.contactInfo, createdTime: createdTime ?? this.createdTime, defaultAdvertDescription: @@ -605,6 +554,8 @@ class P2pAdvertiserCreate extends P2pAdvertiserCreateModel { buyCompletionRate: buyCompletionRate ?? this.buyCompletionRate, buyTimeAvg: buyTimeAvg ?? this.buyTimeAvg, cancelTimeAvg: cancelTimeAvg ?? this.cancelTimeAvg, + chatToken: chatToken ?? this.chatToken, + chatUserId: chatUserId ?? this.chatUserId, dailyBuy: dailyBuy ?? this.dailyBuy, dailyBuyLimit: dailyBuyLimit ?? this.dailyBuyLimit, dailySell: dailySell ?? this.dailySell, @@ -622,7 +573,6 @@ class P2pAdvertiserCreate extends P2pAdvertiserCreateModel { withdrawalLimit: withdrawalLimit ?? this.withdrawalLimit, ); } - /// Subscription model class. abstract class SubscriptionModel { /// Initializes Subscription model class . @@ -638,10 +588,8 @@ abstract class SubscriptionModel { class Subscription extends SubscriptionModel { /// Initializes Subscription class. const Subscription({ - required String id, - }) : super( - id: id, - ); + required super.id, + }); /// Creates an instance from JSON. factory Subscription.fromJson(Map json) => Subscription( diff --git a/lib/api/response/p2p_advertiser_info_response_result.dart b/lib/api/response/p2p_advertiser_info_response_result.dart index 7d0da5dc1e..dc9b53ae3b 100644 --- a/lib/api/response/p2p_advertiser_info_response_result.dart +++ b/lib/api/response/p2p_advertiser_info_response_result.dart @@ -36,12 +36,9 @@ abstract class P2pAdvertiserInfoResponseModel { class P2pAdvertiserInfoResponse extends P2pAdvertiserInfoResponseModel { /// Initializes P2p advertiser info response class. const P2pAdvertiserInfoResponse({ - P2pAdvertiserInfo? p2pAdvertiserInfo, - Subscription? subscription, - }) : super( - p2pAdvertiserInfo: p2pAdvertiserInfo, - subscription: subscription, - ); + super.p2pAdvertiserInfo, + super.subscription, + }); /// Creates an instance from JSON. factory P2pAdvertiserInfoResponse.fromJson( @@ -185,7 +182,6 @@ class P2pAdvertiserInfoResponse extends P2pAdvertiserInfoResponseModel { subscription: subscription ?? this.subscription, ); } - /// P2p advertiser info model class. abstract class P2pAdvertiserInfoModel { /// Initializes P2p advertiser info model class . @@ -211,6 +207,7 @@ abstract class P2pAdvertiserInfoModel { this.activeFloatAds, this.advertRates, this.balanceAvailable, + this.blockTrade, this.blockedByCount, this.blockedUntil, this.buyCompletionRate, @@ -241,6 +238,7 @@ abstract class P2pAdvertiserInfoModel { this.sellCompletionRate, this.showName, this.totalCompletionRate, + this.upgradableDailyLimits, this.withdrawalLimit, }); @@ -307,6 +305,9 @@ abstract class P2pAdvertiserInfoModel { /// Amount of funds available to sell on P2P. May be less than account balance according to deposit methods used. final double? balanceAvailable; + /// Block trading limits, if block trading is allowed. + final BlockTrade? blockTrade; + /// The number of P2P users who have blocked this advertiser. final int? blockedByCount; @@ -397,6 +398,9 @@ abstract class P2pAdvertiserInfoModel { /// The percentage of completed orders out of all orders within the past 30 days. final double? totalCompletionRate; + /// New daily limits available. + final UpgradableDailyLimits? upgradableDailyLimits; + /// Remaining withdrawal_limit of a non-fully authenticated advertiser. final String? withdrawalLimit; } @@ -405,112 +409,61 @@ abstract class P2pAdvertiserInfoModel { class P2pAdvertiserInfo extends P2pAdvertiserInfoModel { /// Initializes P2p advertiser info class. const P2pAdvertiserInfo({ - required bool basicVerification, - required String buyOrdersAmount, - required int buyOrdersCount, - required DateTime createdTime, - required String defaultAdvertDescription, - required bool fullVerification, - required String id, - required bool isApproved, - required bool isListed, - required bool isOnline, - required String name, - required int partnerCount, - required int ratingCount, - required String sellOrdersAmount, - required int sellOrdersCount, - required int totalOrdersCount, - required String totalTurnover, - int? activeFixedAds, - int? activeFloatAds, - double? advertRates, - double? balanceAvailable, - int? blockedByCount, - DateTime? blockedUntil, - double? buyCompletionRate, - int? buyTimeAvg, - int? cancelTimeAvg, - int? cancelsRemaining, - String? chatToken, - String? chatUserId, - String? contactInfo, - String? dailyBuy, - String? dailyBuyLimit, - String? dailySell, - String? dailySellLimit, - String? firstName, - bool? isBlocked, - bool? isFavourite, - int? isRecommended, - String? lastName, - DateTime? lastOnlineTime, - String? maxOrderAmount, - String? minBalance, - String? minOrderAmount, - String? paymentInfo, - double? ratingAverage, - double? recommendedAverage, - int? recommendedCount, - int? releaseTimeAvg, - double? sellCompletionRate, - bool? showName, - double? totalCompletionRate, - String? withdrawalLimit, - }) : super( - basicVerification: basicVerification, - buyOrdersAmount: buyOrdersAmount, - buyOrdersCount: buyOrdersCount, - createdTime: createdTime, - defaultAdvertDescription: defaultAdvertDescription, - fullVerification: fullVerification, - id: id, - isApproved: isApproved, - isListed: isListed, - isOnline: isOnline, - name: name, - partnerCount: partnerCount, - ratingCount: ratingCount, - sellOrdersAmount: sellOrdersAmount, - sellOrdersCount: sellOrdersCount, - totalOrdersCount: totalOrdersCount, - totalTurnover: totalTurnover, - activeFixedAds: activeFixedAds, - activeFloatAds: activeFloatAds, - advertRates: advertRates, - balanceAvailable: balanceAvailable, - blockedByCount: blockedByCount, - blockedUntil: blockedUntil, - buyCompletionRate: buyCompletionRate, - buyTimeAvg: buyTimeAvg, - cancelTimeAvg: cancelTimeAvg, - cancelsRemaining: cancelsRemaining, - chatToken: chatToken, - chatUserId: chatUserId, - contactInfo: contactInfo, - dailyBuy: dailyBuy, - dailyBuyLimit: dailyBuyLimit, - dailySell: dailySell, - dailySellLimit: dailySellLimit, - firstName: firstName, - isBlocked: isBlocked, - isFavourite: isFavourite, - isRecommended: isRecommended, - lastName: lastName, - lastOnlineTime: lastOnlineTime, - maxOrderAmount: maxOrderAmount, - minBalance: minBalance, - minOrderAmount: minOrderAmount, - paymentInfo: paymentInfo, - ratingAverage: ratingAverage, - recommendedAverage: recommendedAverage, - recommendedCount: recommendedCount, - releaseTimeAvg: releaseTimeAvg, - sellCompletionRate: sellCompletionRate, - showName: showName, - totalCompletionRate: totalCompletionRate, - withdrawalLimit: withdrawalLimit, - ); + required super.basicVerification, + required super.buyOrdersAmount, + required super.buyOrdersCount, + required super.createdTime, + required super.defaultAdvertDescription, + required super.fullVerification, + required super.id, + required super.isApproved, + required super.isListed, + required super.isOnline, + required super.name, + required super.partnerCount, + required super.ratingCount, + required super.sellOrdersAmount, + required super.sellOrdersCount, + required super.totalOrdersCount, + required super.totalTurnover, + super.activeFixedAds, + super.activeFloatAds, + super.advertRates, + super.balanceAvailable, + super.blockTrade, + super.blockedByCount, + super.blockedUntil, + super.buyCompletionRate, + super.buyTimeAvg, + super.cancelTimeAvg, + super.cancelsRemaining, + super.chatToken, + super.chatUserId, + super.contactInfo, + super.dailyBuy, + super.dailyBuyLimit, + super.dailySell, + super.dailySellLimit, + super.firstName, + super.isBlocked, + super.isFavourite, + super.isRecommended, + super.lastName, + super.lastOnlineTime, + super.maxOrderAmount, + super.minBalance, + super.minOrderAmount, + super.paymentInfo, + super.ratingAverage, + super.recommendedAverage, + super.recommendedCount, + super.releaseTimeAvg, + super.sellCompletionRate, + super.showName, + super.totalCompletionRate, + super.upgradableDailyLimits, + super.withdrawalLimit, + }); /// Creates an instance from JSON. factory P2pAdvertiserInfo.fromJson(Map json) => @@ -536,6 +489,9 @@ class P2pAdvertiserInfo extends P2pAdvertiserInfoModel { activeFloatAds: json['active_float_ads'], advertRates: getDouble(json['advert_rates']), balanceAvailable: getDouble(json['balance_available']), + blockTrade: json['block_trade'] == null + ? null + : BlockTrade.fromJson(json['block_trade']), blockedByCount: json['blocked_by_count'], blockedUntil: getDateTime(json['blocked_until']), buyCompletionRate: getDouble(json['buy_completion_rate']), @@ -566,6 +522,9 @@ class P2pAdvertiserInfo extends P2pAdvertiserInfoModel { sellCompletionRate: getDouble(json['sell_completion_rate']), showName: getBool(json['show_name']), totalCompletionRate: getDouble(json['total_completion_rate']), + upgradableDailyLimits: json['upgradable_daily_limits'] == null + ? null + : UpgradableDailyLimits.fromJson(json['upgradable_daily_limits']), withdrawalLimit: json['withdrawal_limit'], ); @@ -594,6 +553,9 @@ class P2pAdvertiserInfo extends P2pAdvertiserInfoModel { resultMap['active_float_ads'] = activeFloatAds; resultMap['advert_rates'] = advertRates; resultMap['balance_available'] = balanceAvailable; + if (blockTrade != null) { + resultMap['block_trade'] = blockTrade!.toJson(); + } resultMap['blocked_by_count'] = blockedByCount; resultMap['blocked_until'] = getSecondsSinceEpochDateTime(blockedUntil); resultMap['buy_completion_rate'] = buyCompletionRate; @@ -625,6 +587,9 @@ class P2pAdvertiserInfo extends P2pAdvertiserInfoModel { resultMap['sell_completion_rate'] = sellCompletionRate; resultMap['show_name'] = showName; resultMap['total_completion_rate'] = totalCompletionRate; + if (upgradableDailyLimits != null) { + resultMap['upgradable_daily_limits'] = upgradableDailyLimits!.toJson(); + } resultMap['withdrawal_limit'] = withdrawalLimit; return resultMap; @@ -653,6 +618,7 @@ class P2pAdvertiserInfo extends P2pAdvertiserInfoModel { int? activeFloatAds, double? advertRates, double? balanceAvailable, + BlockTrade? blockTrade, int? blockedByCount, DateTime? blockedUntil, double? buyCompletionRate, @@ -683,6 +649,7 @@ class P2pAdvertiserInfo extends P2pAdvertiserInfoModel { double? sellCompletionRate, bool? showName, double? totalCompletionRate, + UpgradableDailyLimits? upgradableDailyLimits, String? withdrawalLimit, }) => P2pAdvertiserInfo( @@ -708,6 +675,7 @@ class P2pAdvertiserInfo extends P2pAdvertiserInfoModel { activeFloatAds: activeFloatAds ?? this.activeFloatAds, advertRates: advertRates ?? this.advertRates, balanceAvailable: balanceAvailable ?? this.balanceAvailable, + blockTrade: blockTrade ?? this.blockTrade, blockedByCount: blockedByCount ?? this.blockedByCount, blockedUntil: blockedUntil ?? this.blockedUntil, buyCompletionRate: buyCompletionRate ?? this.buyCompletionRate, @@ -738,10 +706,119 @@ class P2pAdvertiserInfo extends P2pAdvertiserInfoModel { sellCompletionRate: sellCompletionRate ?? this.sellCompletionRate, showName: showName ?? this.showName, totalCompletionRate: totalCompletionRate ?? this.totalCompletionRate, + upgradableDailyLimits: + upgradableDailyLimits ?? this.upgradableDailyLimits, withdrawalLimit: withdrawalLimit ?? this.withdrawalLimit, ); } +/// Block trade model class. +abstract class BlockTradeModel { + /// Initializes Block trade model class . + const BlockTradeModel({ + required this.minOrderAmount, + required this.maxOrderAmount, + }); + + /// Minimum order amount for block trade adverts. + final String minOrderAmount; + + /// Maximum order amount for block trade adverts. + final String maxOrderAmount; +} +/// Block trade class. +class BlockTrade extends BlockTradeModel { + /// Initializes Block trade class. + const BlockTrade({ + required super.maxOrderAmount, + required super.minOrderAmount, + }); + + /// Creates an instance from JSON. + factory BlockTrade.fromJson(Map json) => BlockTrade( + maxOrderAmount: json['max_order_amount'], + minOrderAmount: json['min_order_amount'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['max_order_amount'] = maxOrderAmount; + resultMap['min_order_amount'] = minOrderAmount; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + BlockTrade copyWith({ + String? maxOrderAmount, + String? minOrderAmount, + }) => + BlockTrade( + maxOrderAmount: maxOrderAmount ?? this.maxOrderAmount, + minOrderAmount: minOrderAmount ?? this.minOrderAmount, + ); +} +/// Upgradable daily limits model class. +abstract class UpgradableDailyLimitsModel { + /// Initializes Upgradable daily limits model class . + const UpgradableDailyLimitsModel({ + required this.maxDailySell, + required this.maxDailyBuy, + this.blockTrade, + }); + + /// Upgradable daily sell limit. + final String maxDailySell; + + /// Upgradable daily buy limit. + final String maxDailyBuy; + + /// When `true`, upgrade will provide block trading. + final bool? blockTrade; +} + +/// Upgradable daily limits class. +class UpgradableDailyLimits extends UpgradableDailyLimitsModel { + /// Initializes Upgradable daily limits class. + const UpgradableDailyLimits({ + required super.maxDailyBuy, + required super.maxDailySell, + super.blockTrade, + }); + + /// Creates an instance from JSON. + factory UpgradableDailyLimits.fromJson(Map json) => + UpgradableDailyLimits( + maxDailyBuy: json['max_daily_buy'], + maxDailySell: json['max_daily_sell'], + blockTrade: getBool(json['block_trade']), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['max_daily_buy'] = maxDailyBuy; + resultMap['max_daily_sell'] = maxDailySell; + resultMap['block_trade'] = blockTrade; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + UpgradableDailyLimits copyWith({ + String? maxDailyBuy, + String? maxDailySell, + bool? blockTrade, + }) => + UpgradableDailyLimits( + maxDailyBuy: maxDailyBuy ?? this.maxDailyBuy, + maxDailySell: maxDailySell ?? this.maxDailySell, + blockTrade: blockTrade ?? this.blockTrade, + ); +} /// Subscription model class. abstract class SubscriptionModel { /// Initializes Subscription model class . @@ -757,10 +834,8 @@ abstract class SubscriptionModel { class Subscription extends SubscriptionModel { /// Initializes Subscription class. const Subscription({ - required String id, - }) : super( - id: id, - ); + required super.id, + }); /// Creates an instance from JSON. factory Subscription.fromJson(Map json) => Subscription( diff --git a/lib/api/response/p2p_advertiser_list_response_result.dart b/lib/api/response/p2p_advertiser_list_response_result.dart index 3f08084852..7339b167f1 100644 --- a/lib/api/response/p2p_advertiser_list_response_result.dart +++ b/lib/api/response/p2p_advertiser_list_response_result.dart @@ -2,12 +2,11 @@ import 'package:equatable/equatable.dart'; -import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; -import 'package:flutter_deriv_api/basic_api/generated/api.dart'; -import 'package:flutter_deriv_api/helpers/helpers.dart'; -import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/basic_api/generated/api.dart'; +import 'package:flutter_deriv_api/helpers/helpers.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; import 'package:deriv_dependency_injector/dependency_injector.dart'; - /// P2p advertiser list response model class. abstract class P2pAdvertiserListResponseModel { /// Initializes P2p advertiser list response model class . @@ -23,10 +22,8 @@ abstract class P2pAdvertiserListResponseModel { class P2pAdvertiserListResponse extends P2pAdvertiserListResponseModel { /// Initializes P2p advertiser list response class. const P2pAdvertiserListResponse({ - P2pAdvertiserList? p2pAdvertiserList, - }) : super( - p2pAdvertiserList: p2pAdvertiserList, - ); + super.p2pAdvertiserList, + }); /// Creates an instance from JSON. factory P2pAdvertiserListResponse.fromJson( @@ -88,7 +85,6 @@ class P2pAdvertiserListResponse extends P2pAdvertiserListResponseModel { p2pAdvertiserList: p2pAdvertiserList ?? this.p2pAdvertiserList, ); } - /// P2p advertiser list model class. abstract class P2pAdvertiserListModel { /// Initializes P2p advertiser list model class . @@ -104,10 +100,8 @@ abstract class P2pAdvertiserListModel { class P2pAdvertiserList extends P2pAdvertiserListModel { /// Initializes P2p advertiser list class. const P2pAdvertiserList({ - required List list, - }) : super( - list: list, - ); + required super.list, + }); /// Creates an instance from JSON. factory P2pAdvertiserList.fromJson(Map json) => @@ -140,7 +134,6 @@ class P2pAdvertiserList extends P2pAdvertiserListModel { list: list ?? this.list, ); } - /// List item model class. abstract class ListItemModel { /// Initializes List item model class . @@ -284,74 +277,40 @@ abstract class ListItemModel { class ListItem extends ListItemModel { /// Initializes List item class. const ListItem({ - required bool basicVerification, - required String buyOrdersAmount, - required int buyOrdersCount, - required DateTime createdTime, - required String defaultAdvertDescription, - required bool fullVerification, - required String id, - required bool isApproved, - required bool isBlocked, - required bool isListed, - required bool isOnline, - required String name, - required int partnerCount, - required int ratingCount, - required String sellOrdersAmount, - required int sellOrdersCount, - required int totalOrdersCount, - required String totalTurnover, - double? advertRates, - double? buyCompletionRate, - int? buyTimeAvg, - int? cancelTimeAvg, - String? firstName, - bool? isFavourite, - bool? isRecommended, - String? lastName, - DateTime? lastOnlineTime, - double? ratingAverage, - double? recommendedAverage, - int? recommendedCount, - int? releaseTimeAvg, - double? sellCompletionRate, - double? totalCompletionRate, - }) : super( - basicVerification: basicVerification, - buyOrdersAmount: buyOrdersAmount, - buyOrdersCount: buyOrdersCount, - createdTime: createdTime, - defaultAdvertDescription: defaultAdvertDescription, - fullVerification: fullVerification, - id: id, - isApproved: isApproved, - isBlocked: isBlocked, - isListed: isListed, - isOnline: isOnline, - name: name, - partnerCount: partnerCount, - ratingCount: ratingCount, - sellOrdersAmount: sellOrdersAmount, - sellOrdersCount: sellOrdersCount, - totalOrdersCount: totalOrdersCount, - totalTurnover: totalTurnover, - advertRates: advertRates, - buyCompletionRate: buyCompletionRate, - buyTimeAvg: buyTimeAvg, - cancelTimeAvg: cancelTimeAvg, - firstName: firstName, - isFavourite: isFavourite, - isRecommended: isRecommended, - lastName: lastName, - lastOnlineTime: lastOnlineTime, - ratingAverage: ratingAverage, - recommendedAverage: recommendedAverage, - recommendedCount: recommendedCount, - releaseTimeAvg: releaseTimeAvg, - sellCompletionRate: sellCompletionRate, - totalCompletionRate: totalCompletionRate, - ); + required super.basicVerification, + required super.buyOrdersAmount, + required super.buyOrdersCount, + required super.createdTime, + required super.defaultAdvertDescription, + required super.fullVerification, + required super.id, + required super.isApproved, + required super.isBlocked, + required super.isListed, + required super.isOnline, + required super.name, + required super.partnerCount, + required super.ratingCount, + required super.sellOrdersAmount, + required super.sellOrdersCount, + required super.totalOrdersCount, + required super.totalTurnover, + super.advertRates, + super.buyCompletionRate, + super.buyTimeAvg, + super.cancelTimeAvg, + super.firstName, + super.isFavourite, + super.isRecommended, + super.lastName, + super.lastOnlineTime, + super.ratingAverage, + super.recommendedAverage, + super.recommendedCount, + super.releaseTimeAvg, + super.sellCompletionRate, + super.totalCompletionRate, + }); /// Creates an instance from JSON. factory ListItem.fromJson(Map json) => ListItem( diff --git a/lib/api/response/p2p_advertiser_payment_methods_response_result.dart b/lib/api/response/p2p_advertiser_payment_methods_response_result.dart index 5b86419857..4fca2314aa 100644 --- a/lib/api/response/p2p_advertiser_payment_methods_response_result.dart +++ b/lib/api/response/p2p_advertiser_payment_methods_response_result.dart @@ -2,14 +2,13 @@ import 'package:equatable/equatable.dart'; -import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; -import 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_payment_methods_receive.dart'; -import 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_payment_methods_send.dart'; -import 'package:flutter_deriv_api/helpers/helpers.dart'; -import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; +import 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_payment_methods_receive.dart'; +import 'package:flutter_deriv_api/basic_api/generated/p2p_advertiser_payment_methods_send.dart'; +import 'package:flutter_deriv_api/helpers/helpers.dart'; +import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; import 'package:deriv_dependency_injector/dependency_injector.dart'; - /// P2p advertiser payment methods response model class. abstract class P2pAdvertiserPaymentMethodsResponseModel { /// Initializes P2p advertiser payment methods response model class . @@ -27,11 +26,8 @@ class P2pAdvertiserPaymentMethodsResponse extends P2pAdvertiserPaymentMethodsResponseModel { /// Initializes P2p advertiser payment methods response class. const P2pAdvertiserPaymentMethodsResponse({ - Map? - p2pAdvertiserPaymentMethods, - }) : super( - p2pAdvertiserPaymentMethods: p2pAdvertiserPaymentMethods, - ); + super.p2pAdvertiserPaymentMethods, + }); /// Creates an instance from JSON. factory P2pAdvertiserPaymentMethodsResponse.fromJson( @@ -141,7 +137,6 @@ enum P2pAdvertiserPaymentMethodsPropertyTypeEnum { /// other. other, } - /// P2p advertiser payment methods property model class. abstract class P2pAdvertiserPaymentMethodsPropertyModel { /// Initializes P2p advertiser payment methods property model class . @@ -182,22 +177,14 @@ class P2pAdvertiserPaymentMethodsProperty extends P2pAdvertiserPaymentMethodsPropertyModel { /// Initializes P2p advertiser payment methods property class. const P2pAdvertiserPaymentMethodsProperty({ - required Map fields, - required bool isEnabled, - required String method, - required P2pAdvertiserPaymentMethodsPropertyTypeEnum type, - String? displayName, - List? usedByAdverts, - List? usedByOrders, - }) : super( - fields: fields, - isEnabled: isEnabled, - method: method, - type: type, - displayName: displayName, - usedByAdverts: usedByAdverts, - usedByOrders: usedByOrders, - ); + required super.fields, + required super.isEnabled, + required super.method, + required super.type, + super.displayName, + super.usedByAdverts, + super.usedByOrders, + }); /// Creates an instance from JSON. factory P2pAdvertiserPaymentMethodsProperty.fromJson( @@ -282,7 +269,6 @@ class P2pAdvertiserPaymentMethodsProperty usedByOrders: usedByOrders ?? this.usedByOrders, ); } - /// Fields property model class. abstract class FieldsPropertyModel { /// Initializes Fields property model class . @@ -310,16 +296,11 @@ abstract class FieldsPropertyModel { class FieldsProperty extends FieldsPropertyModel { /// Initializes Fields property class. const FieldsProperty({ - required String displayName, - required int required, - required TypeEnum type, - required String value, - }) : super( - displayName: displayName, - required: required, - type: type, - value: value, - ); + required super.displayName, + required super.required, + required super.type, + required super.value, + }); /// Creates an instance from JSON. factory FieldsProperty.fromJson(Map json) => FieldsProperty( diff --git a/lib/api/response/p2p_advertiser_relations_response_result.dart b/lib/api/response/p2p_advertiser_relations_response_result.dart index aebad9df82..e602cd1fad 100644 --- a/lib/api/response/p2p_advertiser_relations_response_result.dart +++ b/lib/api/response/p2p_advertiser_relations_response_result.dart @@ -26,10 +26,8 @@ class P2pAdvertiserRelationsResponse extends P2pAdvertiserRelationsResponseModel { /// Initializes P2p advertiser relations response class. const P2pAdvertiserRelationsResponse({ - P2pAdvertiserRelations? p2pAdvertiserRelations, - }) : super( - p2pAdvertiserRelations: p2pAdvertiserRelations, - ); + super.p2pAdvertiserRelations, + }); /// Creates an instance from JSON. factory P2pAdvertiserRelationsResponse.fromJson( @@ -95,7 +93,6 @@ class P2pAdvertiserRelationsResponse p2pAdvertiserRelations ?? this.p2pAdvertiserRelations, ); } - /// P2p advertiser relations model class. abstract class P2pAdvertiserRelationsModel { /// Initializes P2p advertiser relations model class . @@ -115,12 +112,9 @@ abstract class P2pAdvertiserRelationsModel { class P2pAdvertiserRelations extends P2pAdvertiserRelationsModel { /// Initializes P2p advertiser relations class. const P2pAdvertiserRelations({ - required List blockedAdvertisers, - required List favouriteAdvertisers, - }) : super( - blockedAdvertisers: blockedAdvertisers, - favouriteAdvertisers: favouriteAdvertisers, - ); + required super.blockedAdvertisers, + required super.favouriteAdvertisers, + }); /// Creates an instance from JSON. factory P2pAdvertiserRelations.fromJson(Map json) => @@ -166,7 +160,6 @@ class P2pAdvertiserRelations extends P2pAdvertiserRelationsModel { favouriteAdvertisers: favouriteAdvertisers ?? this.favouriteAdvertisers, ); } - /// Blocked advertisers item model class. abstract class BlockedAdvertisersItemModel { /// Initializes Blocked advertisers item model class . @@ -190,14 +183,10 @@ abstract class BlockedAdvertisersItemModel { class BlockedAdvertisersItem extends BlockedAdvertisersItemModel { /// Initializes Blocked advertisers item class. const BlockedAdvertisersItem({ - DateTime? createdTime, - String? id, - String? name, - }) : super( - createdTime: createdTime, - id: id, - name: name, - ); + super.createdTime, + super.id, + super.name, + }); /// Creates an instance from JSON. factory BlockedAdvertisersItem.fromJson(Map json) => @@ -230,7 +219,6 @@ class BlockedAdvertisersItem extends BlockedAdvertisersItemModel { name: name ?? this.name, ); } - /// Favourite advertisers item model class. abstract class FavouriteAdvertisersItemModel { /// Initializes Favourite advertisers item model class . @@ -254,14 +242,10 @@ abstract class FavouriteAdvertisersItemModel { class FavouriteAdvertisersItem extends FavouriteAdvertisersItemModel { /// Initializes Favourite advertisers item class. const FavouriteAdvertisersItem({ - DateTime? createdTime, - String? id, - String? name, - }) : super( - createdTime: createdTime, - id: id, - name: name, - ); + super.createdTime, + super.id, + super.name, + }); /// Creates an instance from JSON. factory FavouriteAdvertisersItem.fromJson(Map json) => diff --git a/lib/api/response/p2p_advertiser_update_response_result.dart b/lib/api/response/p2p_advertiser_update_response_result.dart index c6c470e5f5..a673845825 100644 --- a/lib/api/response/p2p_advertiser_update_response_result.dart +++ b/lib/api/response/p2p_advertiser_update_response_result.dart @@ -25,10 +25,8 @@ abstract class P2pAdvertiserUpdateResponseModel { class P2pAdvertiserUpdateResponse extends P2pAdvertiserUpdateResponseModel { /// Initializes P2p advertiser update response class. const P2pAdvertiserUpdateResponse({ - P2pAdvertiserUpdate? p2pAdvertiserUpdate, - }) : super( - p2pAdvertiserUpdate: p2pAdvertiserUpdate, - ); + super.p2pAdvertiserUpdate, + }); /// Creates an instance from JSON. factory P2pAdvertiserUpdateResponse.fromJson( @@ -91,7 +89,6 @@ class P2pAdvertiserUpdateResponse extends P2pAdvertiserUpdateResponseModel { p2pAdvertiserUpdate: p2pAdvertiserUpdate ?? this.p2pAdvertiserUpdate, ); } - /// P2p advertiser update model class. abstract class P2pAdvertiserUpdateModel { /// Initializes P2p advertiser update model class . @@ -122,6 +119,7 @@ abstract class P2pAdvertiserUpdateModel { this.activeFixedAds, this.activeFloatAds, this.advertRates, + this.blockTrade, this.blockedUntil, this.buyCompletionRate, this.buyTimeAvg, @@ -226,6 +224,9 @@ abstract class P2pAdvertiserUpdateModel { /// Average difference of advert rate compared to the market rate over the past 30 days. final double? advertRates; + /// Block trading limits, if block trading is allowed. + final BlockTrade? blockTrade; + /// If a temporary bar was placed, this is the epoch time at which it will end. final DateTime? blockedUntil; @@ -303,108 +304,58 @@ abstract class P2pAdvertiserUpdateModel { class P2pAdvertiserUpdate extends P2pAdvertiserUpdateModel { /// Initializes P2p advertiser update class. const P2pAdvertiserUpdate({ - required double balanceAvailable, - required bool basicVerification, - required int blockedByCount, - required String buyOrdersAmount, - required int buyOrdersCount, - required int cancelsRemaining, - required String contactInfo, - required DateTime createdTime, - required String defaultAdvertDescription, - required bool fullVerification, - required String id, - required bool isApproved, - required bool isListed, - required bool isOnline, - required String name, - required int partnerCount, - required String paymentInfo, - required int ratingCount, - required String sellOrdersAmount, - required int sellOrdersCount, - required bool showName, - required int totalOrdersCount, - required String totalTurnover, - int? activeFixedAds, - int? activeFloatAds, - double? advertRates, - DateTime? blockedUntil, - double? buyCompletionRate, - int? buyTimeAvg, - int? cancelTimeAvg, - String? chatToken, - String? chatUserId, - String? dailyBuy, - String? dailyBuyLimit, - String? dailySell, - String? dailySellLimit, - String? firstName, - String? lastName, - DateTime? lastOnlineTime, - String? maxOrderAmount, - String? minBalance, - String? minOrderAmount, - double? ratingAverage, - double? recommendedAverage, - int? recommendedCount, - int? releaseTimeAvg, - double? sellCompletionRate, - double? totalCompletionRate, - UpgradableDailyLimits? upgradableDailyLimits, - String? withdrawalLimit, - }) : super( - balanceAvailable: balanceAvailable, - basicVerification: basicVerification, - blockedByCount: blockedByCount, - buyOrdersAmount: buyOrdersAmount, - buyOrdersCount: buyOrdersCount, - cancelsRemaining: cancelsRemaining, - contactInfo: contactInfo, - createdTime: createdTime, - defaultAdvertDescription: defaultAdvertDescription, - fullVerification: fullVerification, - id: id, - isApproved: isApproved, - isListed: isListed, - isOnline: isOnline, - name: name, - partnerCount: partnerCount, - paymentInfo: paymentInfo, - ratingCount: ratingCount, - sellOrdersAmount: sellOrdersAmount, - sellOrdersCount: sellOrdersCount, - showName: showName, - totalOrdersCount: totalOrdersCount, - totalTurnover: totalTurnover, - activeFixedAds: activeFixedAds, - activeFloatAds: activeFloatAds, - advertRates: advertRates, - blockedUntil: blockedUntil, - buyCompletionRate: buyCompletionRate, - buyTimeAvg: buyTimeAvg, - cancelTimeAvg: cancelTimeAvg, - chatToken: chatToken, - chatUserId: chatUserId, - dailyBuy: dailyBuy, - dailyBuyLimit: dailyBuyLimit, - dailySell: dailySell, - dailySellLimit: dailySellLimit, - firstName: firstName, - lastName: lastName, - lastOnlineTime: lastOnlineTime, - maxOrderAmount: maxOrderAmount, - minBalance: minBalance, - minOrderAmount: minOrderAmount, - ratingAverage: ratingAverage, - recommendedAverage: recommendedAverage, - recommendedCount: recommendedCount, - releaseTimeAvg: releaseTimeAvg, - sellCompletionRate: sellCompletionRate, - totalCompletionRate: totalCompletionRate, - upgradableDailyLimits: upgradableDailyLimits, - withdrawalLimit: withdrawalLimit, - ); + required super.balanceAvailable, + required super.basicVerification, + required super.blockedByCount, + required super.buyOrdersAmount, + required super.buyOrdersCount, + required super.cancelsRemaining, + required super.contactInfo, + required super.createdTime, + required super.defaultAdvertDescription, + required super.fullVerification, + required super.id, + required super.isApproved, + required super.isListed, + required super.isOnline, + required super.name, + required super.partnerCount, + required super.paymentInfo, + required super.ratingCount, + required super.sellOrdersAmount, + required super.sellOrdersCount, + required super.showName, + required super.totalOrdersCount, + required super.totalTurnover, + super.activeFixedAds, + super.activeFloatAds, + super.advertRates, + super.blockTrade, + super.blockedUntil, + super.buyCompletionRate, + super.buyTimeAvg, + super.cancelTimeAvg, + super.chatToken, + super.chatUserId, + super.dailyBuy, + super.dailyBuyLimit, + super.dailySell, + super.dailySellLimit, + super.firstName, + super.lastName, + super.lastOnlineTime, + super.maxOrderAmount, + super.minBalance, + super.minOrderAmount, + super.ratingAverage, + super.recommendedAverage, + super.recommendedCount, + super.releaseTimeAvg, + super.sellCompletionRate, + super.totalCompletionRate, + super.upgradableDailyLimits, + super.withdrawalLimit, + }); /// Creates an instance from JSON. factory P2pAdvertiserUpdate.fromJson(Map json) => @@ -435,6 +386,9 @@ class P2pAdvertiserUpdate extends P2pAdvertiserUpdateModel { activeFixedAds: json['active_fixed_ads'], activeFloatAds: json['active_float_ads'], advertRates: getDouble(json['advert_rates']), + blockTrade: json['block_trade'] == null + ? null + : BlockTrade.fromJson(json['block_trade']), blockedUntil: getDateTime(json['blocked_until']), buyCompletionRate: getDouble(json['buy_completion_rate']), buyTimeAvg: json['buy_time_avg'], @@ -493,6 +447,9 @@ class P2pAdvertiserUpdate extends P2pAdvertiserUpdateModel { resultMap['active_fixed_ads'] = activeFixedAds; resultMap['active_float_ads'] = activeFloatAds; resultMap['advert_rates'] = advertRates; + if (blockTrade != null) { + resultMap['block_trade'] = blockTrade!.toJson(); + } resultMap['blocked_until'] = getSecondsSinceEpochDateTime(blockedUntil); resultMap['buy_completion_rate'] = buyCompletionRate; resultMap['buy_time_avg'] = buyTimeAvg; @@ -552,6 +509,7 @@ class P2pAdvertiserUpdate extends P2pAdvertiserUpdateModel { int? activeFixedAds, int? activeFloatAds, double? advertRates, + BlockTrade? blockTrade, DateTime? blockedUntil, double? buyCompletionRate, int? buyTimeAvg, @@ -605,6 +563,7 @@ class P2pAdvertiserUpdate extends P2pAdvertiserUpdateModel { activeFixedAds: activeFixedAds ?? this.activeFixedAds, activeFloatAds: activeFloatAds ?? this.activeFloatAds, advertRates: advertRates ?? this.advertRates, + blockTrade: blockTrade ?? this.blockTrade, blockedUntil: blockedUntil ?? this.blockedUntil, buyCompletionRate: buyCompletionRate ?? this.buyCompletionRate, buyTimeAvg: buyTimeAvg ?? this.buyTimeAvg, @@ -632,13 +591,62 @@ class P2pAdvertiserUpdate extends P2pAdvertiserUpdateModel { withdrawalLimit: withdrawalLimit ?? this.withdrawalLimit, ); } +/// Block trade model class. +abstract class BlockTradeModel { + /// Initializes Block trade model class . + const BlockTradeModel({ + required this.minOrderAmount, + required this.maxOrderAmount, + }); + + /// Minimum order amount for block trade adverts. + final String minOrderAmount; + + /// Maximum order amount for block trade adverts. + final String maxOrderAmount; +} + +/// Block trade class. +class BlockTrade extends BlockTradeModel { + /// Initializes Block trade class. + const BlockTrade({ + required super.maxOrderAmount, + required super.minOrderAmount, + }); + + /// Creates an instance from JSON. + factory BlockTrade.fromJson(Map json) => BlockTrade( + maxOrderAmount: json['max_order_amount'], + minOrderAmount: json['min_order_amount'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + resultMap['max_order_amount'] = maxOrderAmount; + resultMap['min_order_amount'] = minOrderAmount; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + BlockTrade copyWith({ + String? maxOrderAmount, + String? minOrderAmount, + }) => + BlockTrade( + maxOrderAmount: maxOrderAmount ?? this.maxOrderAmount, + minOrderAmount: minOrderAmount ?? this.minOrderAmount, + ); +} /// Upgradable daily limits model class. abstract class UpgradableDailyLimitsModel { /// Initializes Upgradable daily limits model class . const UpgradableDailyLimitsModel({ required this.maxDailySell, required this.maxDailyBuy, + this.blockTrade, }); /// Upgradable daily sell limit. @@ -646,24 +654,26 @@ abstract class UpgradableDailyLimitsModel { /// Upgradable daily buy limit. final String maxDailyBuy; + + /// When `true`, upgrade will provide block trading. + final bool? blockTrade; } /// Upgradable daily limits class. class UpgradableDailyLimits extends UpgradableDailyLimitsModel { /// Initializes Upgradable daily limits class. const UpgradableDailyLimits({ - required String maxDailyBuy, - required String maxDailySell, - }) : super( - maxDailyBuy: maxDailyBuy, - maxDailySell: maxDailySell, - ); + required super.maxDailyBuy, + required super.maxDailySell, + super.blockTrade, + }); /// Creates an instance from JSON. factory UpgradableDailyLimits.fromJson(Map json) => UpgradableDailyLimits( maxDailyBuy: json['max_daily_buy'], maxDailySell: json['max_daily_sell'], + blockTrade: getBool(json['block_trade']), ); /// Converts an instance to JSON. @@ -672,6 +682,7 @@ class UpgradableDailyLimits extends UpgradableDailyLimitsModel { resultMap['max_daily_buy'] = maxDailyBuy; resultMap['max_daily_sell'] = maxDailySell; + resultMap['block_trade'] = blockTrade; return resultMap; } @@ -680,9 +691,11 @@ class UpgradableDailyLimits extends UpgradableDailyLimitsModel { UpgradableDailyLimits copyWith({ String? maxDailyBuy, String? maxDailySell, + bool? blockTrade, }) => UpgradableDailyLimits( maxDailyBuy: maxDailyBuy ?? this.maxDailyBuy, maxDailySell: maxDailySell ?? this.maxDailySell, + blockTrade: blockTrade ?? this.blockTrade, ); } diff --git a/lib/api/response/p2p_chat_create_response_result.dart b/lib/api/response/p2p_chat_create_response_result.dart index 7a9764e85c..785ceaddc0 100644 --- a/lib/api/response/p2p_chat_create_response_result.dart +++ b/lib/api/response/p2p_chat_create_response_result.dart @@ -25,10 +25,8 @@ abstract class P2pChatCreateResponseModel { class P2pChatCreateResponse extends P2pChatCreateResponseModel { /// Initializes P2p chat create response class. const P2pChatCreateResponse({ - P2pChatCreate? p2pChatCreate, - }) : super( - p2pChatCreate: p2pChatCreate, - ); + super.p2pChatCreate, + }); /// Creates an instance from JSON. factory P2pChatCreateResponse.fromJson( @@ -91,7 +89,6 @@ class P2pChatCreateResponse extends P2pChatCreateResponseModel { p2pChatCreate: p2pChatCreate ?? this.p2pChatCreate, ); } - /// P2p chat create model class. abstract class P2pChatCreateModel { /// Initializes P2p chat create model class . @@ -111,12 +108,9 @@ abstract class P2pChatCreateModel { class P2pChatCreate extends P2pChatCreateModel { /// Initializes P2p chat create class. const P2pChatCreate({ - required String channelUrl, - required String orderId, - }) : super( - channelUrl: channelUrl, - orderId: orderId, - ); + required super.channelUrl, + required super.orderId, + }); /// Creates an instance from JSON. factory P2pChatCreate.fromJson(Map json) => P2pChatCreate( diff --git a/lib/api/response/p2p_order_cancel_response_result.dart b/lib/api/response/p2p_order_cancel_response_result.dart index b38f92e2c4..26ee394468 100644 --- a/lib/api/response/p2p_order_cancel_response_result.dart +++ b/lib/api/response/p2p_order_cancel_response_result.dart @@ -24,10 +24,8 @@ abstract class P2pOrderCancelResponseModel { class P2pOrderCancelResponse extends P2pOrderCancelResponseModel { /// Initializes P2p order cancel response class. const P2pOrderCancelResponse({ - P2pOrderCancel? p2pOrderCancel, - }) : super( - p2pOrderCancel: p2pOrderCancel, - ); + super.p2pOrderCancel, + }); /// Creates an instance from JSON. factory P2pOrderCancelResponse.fromJson( @@ -101,7 +99,6 @@ enum StatusEnum { /// cancelled. cancelled, } - /// P2p order cancel model class. abstract class P2pOrderCancelModel { /// Initializes P2p order cancel model class . @@ -121,12 +118,9 @@ abstract class P2pOrderCancelModel { class P2pOrderCancel extends P2pOrderCancelModel { /// Initializes P2p order cancel class. const P2pOrderCancel({ - required String id, - required StatusEnum status, - }) : super( - id: id, - status: status, - ); + required super.id, + required super.status, + }); /// Creates an instance from JSON. factory P2pOrderCancel.fromJson(Map json) => P2pOrderCancel( diff --git a/lib/api/response/p2p_order_confirm_response_result.dart b/lib/api/response/p2p_order_confirm_response_result.dart index e0fc40b8b2..a5d0c15328 100644 --- a/lib/api/response/p2p_order_confirm_response_result.dart +++ b/lib/api/response/p2p_order_confirm_response_result.dart @@ -24,10 +24,8 @@ abstract class P2pOrderConfirmResponseModel { class P2pOrderConfirmResponse extends P2pOrderConfirmResponseModel { /// Initializes P2p order confirm response class. const P2pOrderConfirmResponse({ - P2pOrderConfirm? p2pOrderConfirm, - }) : super( - p2pOrderConfirm: p2pOrderConfirm, - ); + super.p2pOrderConfirm, + }); /// Creates an instance from JSON. factory P2pOrderConfirmResponse.fromJson( @@ -105,7 +103,6 @@ enum StatusEnum { /// completed. completed, } - /// P2p order confirm model class. abstract class P2pOrderConfirmModel { /// Initializes P2p order confirm model class . @@ -129,14 +126,10 @@ abstract class P2pOrderConfirmModel { class P2pOrderConfirm extends P2pOrderConfirmModel { /// Initializes P2p order confirm class. const P2pOrderConfirm({ - required String id, - int? dryRun, - StatusEnum? status, - }) : super( - id: id, - dryRun: dryRun, - status: status, - ); + required super.id, + super.dryRun, + super.status, + }); /// Creates an instance from JSON. factory P2pOrderConfirm.fromJson(Map json) => diff --git a/lib/api/response/p2p_order_create_response_result.dart b/lib/api/response/p2p_order_create_response_result.dart index 0c0b04b3af..a14ad33791 100644 --- a/lib/api/response/p2p_order_create_response_result.dart +++ b/lib/api/response/p2p_order_create_response_result.dart @@ -31,12 +31,9 @@ abstract class P2pOrderCreateResponseModel { class P2pOrderCreateResponse extends P2pOrderCreateResponseModel { /// Initializes P2p order create response class. const P2pOrderCreateResponse({ - P2pOrderCreate? p2pOrderCreate, - Subscription? subscription, - }) : super( - p2pOrderCreate: p2pOrderCreate, - subscription: subscription, - ); + super.p2pOrderCreate, + super.subscription, + }); /// Creates an instance from JSON. factory P2pOrderCreateResponse.fromJson( @@ -202,12 +199,10 @@ enum StatusEnum { /// pending. pending, } - /// P2p order create model class. abstract class P2pOrderCreateModel { /// Initializes P2p order create model class . const P2pOrderCreateModel({ - required this.verificationPending, required this.type, required this.status, required this.rateDisplay, @@ -235,9 +230,6 @@ abstract class P2pOrderCreateModel { this.paymentMethodDetails, }); - /// Indicates that an email has been sent to verify confirmation of the order. - final bool verificationPending; - /// Type of the order. final TypeEnum type; @@ -318,60 +310,32 @@ abstract class P2pOrderCreateModel { class P2pOrderCreate extends P2pOrderCreateModel { /// Initializes P2p order create class. const P2pOrderCreate({ - required String accountCurrency, - required AdvertDetails advertDetails, - required AdvertiserDetails advertiserDetails, - required double amount, - required String amountDisplay, - required String chatChannelUrl, - required ClientDetails clientDetails, - required String contactInfo, - required DateTime createdTime, - required DisputeDetails disputeDetails, - required DateTime expiryTime, - required String id, - required bool isIncoming, - required bool isReviewable, - required bool isSeen, - required String localCurrency, - required String paymentInfo, - required double price, - required String priceDisplay, - required double rate, - required String rateDisplay, - required StatusEnum status, - required TypeEnum type, - required bool verificationPending, - String? paymentMethod, - Map? paymentMethodDetails, - }) : super( - accountCurrency: accountCurrency, - advertDetails: advertDetails, - advertiserDetails: advertiserDetails, - amount: amount, - amountDisplay: amountDisplay, - chatChannelUrl: chatChannelUrl, - clientDetails: clientDetails, - contactInfo: contactInfo, - createdTime: createdTime, - disputeDetails: disputeDetails, - expiryTime: expiryTime, - id: id, - isIncoming: isIncoming, - isReviewable: isReviewable, - isSeen: isSeen, - localCurrency: localCurrency, - paymentInfo: paymentInfo, - price: price, - priceDisplay: priceDisplay, - rate: rate, - rateDisplay: rateDisplay, - status: status, - type: type, - verificationPending: verificationPending, - paymentMethod: paymentMethod, - paymentMethodDetails: paymentMethodDetails, - ); + required super.accountCurrency, + required super.advertDetails, + required super.advertiserDetails, + required super.amount, + required super.amountDisplay, + required super.chatChannelUrl, + required super.clientDetails, + required super.contactInfo, + required super.createdTime, + required super.disputeDetails, + required super.expiryTime, + required super.id, + required super.isIncoming, + required super.isReviewable, + required super.isSeen, + required super.localCurrency, + required super.paymentInfo, + required super.price, + required super.priceDisplay, + required super.rate, + required super.rateDisplay, + required super.status, + required super.type, + super.paymentMethod, + super.paymentMethodDetails, + }); /// Creates an instance from JSON. factory P2pOrderCreate.fromJson(Map json) => P2pOrderCreate( @@ -399,7 +363,6 @@ class P2pOrderCreate extends P2pOrderCreateModel { rateDisplay: json['rate_display'], status: statusEnumMapper[json['status']]!, type: typeEnumMapper[json['type']]!, - verificationPending: getBool(json['verification_pending'])!, paymentMethod: json['payment_method'], paymentMethodDetails: json['payment_method_details'] == null ? null @@ -450,7 +413,6 @@ class P2pOrderCreate extends P2pOrderCreateModel { resultMap['type'] = typeEnumMapper.entries .firstWhere((MapEntry entry) => entry.value == type) .key; - resultMap['verification_pending'] = verificationPending; resultMap['payment_method'] = paymentMethod; resultMap['payment_method_details'] = paymentMethodDetails; @@ -482,7 +444,6 @@ class P2pOrderCreate extends P2pOrderCreateModel { String? rateDisplay, StatusEnum? status, TypeEnum? type, - bool? verificationPending, String? paymentMethod, Map? paymentMethodDetails, }) => @@ -510,12 +471,10 @@ class P2pOrderCreate extends P2pOrderCreateModel { rateDisplay: rateDisplay ?? this.rateDisplay, status: status ?? this.status, type: type ?? this.type, - verificationPending: verificationPending ?? this.verificationPending, paymentMethod: paymentMethod ?? this.paymentMethod, paymentMethodDetails: paymentMethodDetails ?? this.paymentMethodDetails, ); } - /// Advert details model class. abstract class AdvertDetailsModel { /// Initializes Advert details model class . @@ -523,6 +482,7 @@ abstract class AdvertDetailsModel { required this.type, required this.id, required this.description, + required this.blockTrade, this.paymentMethod, }); @@ -535,6 +495,9 @@ abstract class AdvertDetailsModel { /// General information about the advert. final String description; + /// Indicates if this is block trade advert or not. + final bool blockTrade; + /// The payment method. final String? paymentMethod; } @@ -543,19 +506,16 @@ abstract class AdvertDetailsModel { class AdvertDetails extends AdvertDetailsModel { /// Initializes Advert details class. const AdvertDetails({ - required String description, - required String id, - required TypeEnum type, - String? paymentMethod, - }) : super( - description: description, - id: id, - type: type, - paymentMethod: paymentMethod, - ); + required super.blockTrade, + required super.description, + required super.id, + required super.type, + super.paymentMethod, + }); /// Creates an instance from JSON. factory AdvertDetails.fromJson(Map json) => AdvertDetails( + blockTrade: getBool(json['block_trade'])!, description: json['description'], id: json['id'], type: typeEnumMapper[json['type']]!, @@ -566,6 +526,7 @@ class AdvertDetails extends AdvertDetailsModel { Map toJson() { final Map resultMap = {}; + resultMap['block_trade'] = blockTrade; resultMap['description'] = description; resultMap['id'] = id; resultMap['type'] = typeEnumMapper.entries @@ -578,19 +539,20 @@ class AdvertDetails extends AdvertDetailsModel { /// Creates a copy of instance with given parameters. AdvertDetails copyWith({ + bool? blockTrade, String? description, String? id, TypeEnum? type, String? paymentMethod, }) => AdvertDetails( + blockTrade: blockTrade ?? this.blockTrade, description: description ?? this.description, id: id ?? this.id, type: type ?? this.type, paymentMethod: paymentMethod ?? this.paymentMethod, ); } - /// Advertiser details model class. abstract class AdvertiserDetailsModel { /// Initializes Advertiser details model class . @@ -630,22 +592,14 @@ abstract class AdvertiserDetailsModel { class AdvertiserDetails extends AdvertiserDetailsModel { /// Initializes Advertiser details class. const AdvertiserDetails({ - required String id, - required bool isOnline, - required String loginid, - required String name, - String? firstName, - String? lastName, - DateTime? lastOnlineTime, - }) : super( - id: id, - isOnline: isOnline, - loginid: loginid, - name: name, - firstName: firstName, - lastName: lastName, - lastOnlineTime: lastOnlineTime, - ); + required super.id, + required super.isOnline, + required super.loginid, + required super.name, + super.firstName, + super.lastName, + super.lastOnlineTime, + }); /// Creates an instance from JSON. factory AdvertiserDetails.fromJson(Map json) => @@ -695,7 +649,6 @@ class AdvertiserDetails extends AdvertiserDetailsModel { lastOnlineTime: lastOnlineTime ?? this.lastOnlineTime, ); } - /// Client details model class. abstract class ClientDetailsModel { /// Initializes Client details model class . @@ -735,22 +688,14 @@ abstract class ClientDetailsModel { class ClientDetails extends ClientDetailsModel { /// Initializes Client details class. const ClientDetails({ - required String id, - required bool isOnline, - required String loginid, - required String name, - String? firstName, - String? lastName, - DateTime? lastOnlineTime, - }) : super( - id: id, - isOnline: isOnline, - loginid: loginid, - name: name, - firstName: firstName, - lastName: lastName, - lastOnlineTime: lastOnlineTime, - ); + required super.id, + required super.isOnline, + required super.loginid, + required super.name, + super.firstName, + super.lastName, + super.lastOnlineTime, + }); /// Creates an instance from JSON. factory ClientDetails.fromJson(Map json) => ClientDetails( @@ -799,7 +744,6 @@ class ClientDetails extends ClientDetailsModel { lastOnlineTime: lastOnlineTime ?? this.lastOnlineTime, ); } - /// Dispute details model class. abstract class DisputeDetailsModel { /// Initializes Dispute details model class . @@ -819,12 +763,9 @@ abstract class DisputeDetailsModel { class DisputeDetails extends DisputeDetailsModel { /// Initializes Dispute details class. const DisputeDetails({ - String? disputeReason, - String? disputerLoginid, - }) : super( - disputeReason: disputeReason, - disputerLoginid: disputerLoginid, - ); + super.disputeReason, + super.disputerLoginid, + }); /// Creates an instance from JSON. factory DisputeDetails.fromJson(Map json) => DisputeDetails( @@ -852,7 +793,6 @@ class DisputeDetails extends DisputeDetailsModel { disputerLoginid: disputerLoginid ?? this.disputerLoginid, ); } - /// Payment method details property model class. abstract class PaymentMethodDetailsPropertyModel { /// Initializes Payment method details property model class . @@ -892,22 +832,14 @@ abstract class PaymentMethodDetailsPropertyModel { class PaymentMethodDetailsProperty extends PaymentMethodDetailsPropertyModel { /// Initializes Payment method details property class. const PaymentMethodDetailsProperty({ - required Map fields, - required bool isEnabled, - required String method, - required PaymentMethodDetailsPropertyTypeEnum type, - String? displayName, - List? usedByAdverts, - List? usedByOrders, - }) : super( - fields: fields, - isEnabled: isEnabled, - method: method, - type: type, - displayName: displayName, - usedByAdverts: usedByAdverts, - usedByOrders: usedByOrders, - ); + required super.fields, + required super.isEnabled, + required super.method, + required super.type, + super.displayName, + super.usedByAdverts, + super.usedByOrders, + }); /// Creates an instance from JSON. factory PaymentMethodDetailsProperty.fromJson(Map json) => @@ -989,7 +921,6 @@ class PaymentMethodDetailsProperty extends PaymentMethodDetailsPropertyModel { usedByOrders: usedByOrders ?? this.usedByOrders, ); } - /// Fields property model class. abstract class FieldsPropertyModel { /// Initializes Fields property model class . @@ -1017,16 +948,11 @@ abstract class FieldsPropertyModel { class FieldsProperty extends FieldsPropertyModel { /// Initializes Fields property class. const FieldsProperty({ - required String displayName, - required int required, - required FieldsPropertyTypeEnum type, - required String value, - }) : super( - displayName: displayName, - required: required, - type: type, - value: value, - ); + required super.displayName, + required super.required, + required super.type, + required super.value, + }); /// Creates an instance from JSON. factory FieldsProperty.fromJson(Map json) => FieldsProperty( @@ -1065,7 +991,6 @@ class FieldsProperty extends FieldsPropertyModel { value: value ?? this.value, ); } - /// Subscription model class. abstract class SubscriptionModel { /// Initializes Subscription model class . @@ -1081,10 +1006,8 @@ abstract class SubscriptionModel { class Subscription extends SubscriptionModel { /// Initializes Subscription class. const Subscription({ - required String id, - }) : super( - id: id, - ); + required super.id, + }); /// Creates an instance from JSON. factory Subscription.fromJson(Map json) => Subscription( diff --git a/lib/api/response/p2p_order_dispute_response_result.dart b/lib/api/response/p2p_order_dispute_response_result.dart index a2bdaae1be..55e41f6a9f 100644 --- a/lib/api/response/p2p_order_dispute_response_result.dart +++ b/lib/api/response/p2p_order_dispute_response_result.dart @@ -25,10 +25,8 @@ abstract class P2pOrderDisputeResponseModel { class P2pOrderDisputeResponse extends P2pOrderDisputeResponseModel { /// Initializes P2p order dispute response class. const P2pOrderDisputeResponse({ - P2pOrderDispute? p2pOrderDispute, - }) : super( - p2pOrderDispute: p2pOrderDispute, - ); + super.p2pOrderDispute, + }); /// Creates an instance from JSON. factory P2pOrderDisputeResponse.fromJson( @@ -153,12 +151,10 @@ enum StatusEnum { /// dispute-completed. disputeCompleted, } - /// P2p order dispute model class. abstract class P2pOrderDisputeModel { /// Initializes P2p order dispute model class . const P2pOrderDisputeModel({ - required this.verificationPending, required this.type, required this.status, required this.rateDisplay, @@ -184,12 +180,10 @@ abstract class P2pOrderDisputeModel { required this.accountCurrency, this.verificationLockoutUntil, this.verificationNextRequest, + this.verificationPending, this.verificationTokenExpiry, }); - /// Indicates that the seller in the process of confirming the order. - final bool verificationPending; - /// Whether this is a buy or a sell. final TypeEnum type; @@ -265,6 +259,9 @@ abstract class P2pOrderDisputeModel { /// If a verification request has already been made, the epoch time that another verification request can be made. final DateTime? verificationNextRequest; + /// Indicates that the seller in the process of confirming the order. + final bool? verificationPending; + /// Epoch time that the current verification token will expire. final DateTime? verificationTokenExpiry; } @@ -273,62 +270,34 @@ abstract class P2pOrderDisputeModel { class P2pOrderDispute extends P2pOrderDisputeModel { /// Initializes P2p order dispute class. const P2pOrderDispute({ - required String accountCurrency, - required AdvertDetails advertDetails, - required AdvertiserDetails advertiserDetails, - required double amount, - required String amountDisplay, - required String chatChannelUrl, - required ClientDetails clientDetails, - required String contactInfo, - required DateTime createdTime, - required DisputeDetails disputeDetails, - required DateTime expiryTime, - required String id, - required bool isIncoming, - required bool isReviewable, - required bool isSeen, - required String localCurrency, - required String paymentInfo, - required double price, - required String priceDisplay, - required double rate, - required String rateDisplay, - required StatusEnum status, - required TypeEnum type, - required bool verificationPending, - DateTime? verificationLockoutUntil, - DateTime? verificationNextRequest, - DateTime? verificationTokenExpiry, - }) : super( - accountCurrency: accountCurrency, - advertDetails: advertDetails, - advertiserDetails: advertiserDetails, - amount: amount, - amountDisplay: amountDisplay, - chatChannelUrl: chatChannelUrl, - clientDetails: clientDetails, - contactInfo: contactInfo, - createdTime: createdTime, - disputeDetails: disputeDetails, - expiryTime: expiryTime, - id: id, - isIncoming: isIncoming, - isReviewable: isReviewable, - isSeen: isSeen, - localCurrency: localCurrency, - paymentInfo: paymentInfo, - price: price, - priceDisplay: priceDisplay, - rate: rate, - rateDisplay: rateDisplay, - status: status, - type: type, - verificationPending: verificationPending, - verificationLockoutUntil: verificationLockoutUntil, - verificationNextRequest: verificationNextRequest, - verificationTokenExpiry: verificationTokenExpiry, - ); + required super.accountCurrency, + required super.advertDetails, + required super.advertiserDetails, + required super.amount, + required super.amountDisplay, + required super.chatChannelUrl, + required super.clientDetails, + required super.contactInfo, + required super.createdTime, + required super.disputeDetails, + required super.expiryTime, + required super.id, + required super.isIncoming, + required super.isReviewable, + required super.isSeen, + required super.localCurrency, + required super.paymentInfo, + required super.price, + required super.priceDisplay, + required super.rate, + required super.rateDisplay, + required super.status, + required super.type, + super.verificationLockoutUntil, + super.verificationNextRequest, + super.verificationPending, + super.verificationTokenExpiry, + }); /// Creates an instance from JSON. factory P2pOrderDispute.fromJson(Map json) => @@ -357,10 +326,10 @@ class P2pOrderDispute extends P2pOrderDisputeModel { rateDisplay: json['rate_display'], status: statusEnumMapper[json['status']]!, type: typeEnumMapper[json['type']]!, - verificationPending: getBool(json['verification_pending'])!, verificationLockoutUntil: getDateTime(json['verification_lockout_until']), verificationNextRequest: getDateTime(json['verification_next_request']), + verificationPending: getBool(json['verification_pending']), verificationTokenExpiry: getDateTime(json['verification_token_expiry']), ); @@ -400,11 +369,11 @@ class P2pOrderDispute extends P2pOrderDisputeModel { resultMap['type'] = typeEnumMapper.entries .firstWhere((MapEntry entry) => entry.value == type) .key; - resultMap['verification_pending'] = verificationPending; resultMap['verification_lockout_until'] = getSecondsSinceEpochDateTime(verificationLockoutUntil); resultMap['verification_next_request'] = getSecondsSinceEpochDateTime(verificationNextRequest); + resultMap['verification_pending'] = verificationPending; resultMap['verification_token_expiry'] = getSecondsSinceEpochDateTime(verificationTokenExpiry); @@ -436,9 +405,9 @@ class P2pOrderDispute extends P2pOrderDisputeModel { String? rateDisplay, StatusEnum? status, TypeEnum? type, - bool? verificationPending, DateTime? verificationLockoutUntil, DateTime? verificationNextRequest, + bool? verificationPending, DateTime? verificationTokenExpiry, }) => P2pOrderDispute( @@ -465,16 +434,15 @@ class P2pOrderDispute extends P2pOrderDisputeModel { rateDisplay: rateDisplay ?? this.rateDisplay, status: status ?? this.status, type: type ?? this.type, - verificationPending: verificationPending ?? this.verificationPending, verificationLockoutUntil: verificationLockoutUntil ?? this.verificationLockoutUntil, verificationNextRequest: verificationNextRequest ?? this.verificationNextRequest, + verificationPending: verificationPending ?? this.verificationPending, verificationTokenExpiry: verificationTokenExpiry ?? this.verificationTokenExpiry, ); } - /// Advert details model class. abstract class AdvertDetailsModel { /// Initializes Advert details model class . @@ -482,6 +450,7 @@ abstract class AdvertDetailsModel { required this.type, required this.id, required this.description, + required this.blockTrade, this.paymentMethod, }); @@ -494,6 +463,9 @@ abstract class AdvertDetailsModel { /// General information about the advert. final String description; + /// Indicates if this is block trade advert or not. + final bool blockTrade; + /// The payment method. final String? paymentMethod; } @@ -502,19 +474,16 @@ abstract class AdvertDetailsModel { class AdvertDetails extends AdvertDetailsModel { /// Initializes Advert details class. const AdvertDetails({ - required String description, - required String id, - required TypeEnum type, - String? paymentMethod, - }) : super( - description: description, - id: id, - type: type, - paymentMethod: paymentMethod, - ); + required super.blockTrade, + required super.description, + required super.id, + required super.type, + super.paymentMethod, + }); /// Creates an instance from JSON. factory AdvertDetails.fromJson(Map json) => AdvertDetails( + blockTrade: getBool(json['block_trade'])!, description: json['description'], id: json['id'], type: typeEnumMapper[json['type']]!, @@ -525,6 +494,7 @@ class AdvertDetails extends AdvertDetailsModel { Map toJson() { final Map resultMap = {}; + resultMap['block_trade'] = blockTrade; resultMap['description'] = description; resultMap['id'] = id; resultMap['type'] = typeEnumMapper.entries @@ -537,19 +507,20 @@ class AdvertDetails extends AdvertDetailsModel { /// Creates a copy of instance with given parameters. AdvertDetails copyWith({ + bool? blockTrade, String? description, String? id, TypeEnum? type, String? paymentMethod, }) => AdvertDetails( + blockTrade: blockTrade ?? this.blockTrade, description: description ?? this.description, id: id ?? this.id, type: type ?? this.type, paymentMethod: paymentMethod ?? this.paymentMethod, ); } - /// Advertiser details model class. abstract class AdvertiserDetailsModel { /// Initializes Advertiser details model class . @@ -575,7 +546,7 @@ abstract class AdvertiserDetailsModel { /// The advertiser's unique identifier. final String id; - /// The advertiser's first name. + /// The client's first name. final String? firstName; /// The advertiser's last name. @@ -589,22 +560,14 @@ abstract class AdvertiserDetailsModel { class AdvertiserDetails extends AdvertiserDetailsModel { /// Initializes Advertiser details class. const AdvertiserDetails({ - required String id, - required bool isOnline, - required String loginid, - required String name, - String? firstName, - String? lastName, - DateTime? lastOnlineTime, - }) : super( - id: id, - isOnline: isOnline, - loginid: loginid, - name: name, - firstName: firstName, - lastName: lastName, - lastOnlineTime: lastOnlineTime, - ); + required super.id, + required super.isOnline, + required super.loginid, + required super.name, + super.firstName, + super.lastName, + super.lastOnlineTime, + }); /// Creates an instance from JSON. factory AdvertiserDetails.fromJson(Map json) => @@ -654,7 +617,6 @@ class AdvertiserDetails extends AdvertiserDetailsModel { lastOnlineTime: lastOnlineTime ?? this.lastOnlineTime, ); } - /// Client details model class. abstract class ClientDetailsModel { /// Initializes Client details model class . @@ -694,22 +656,14 @@ abstract class ClientDetailsModel { class ClientDetails extends ClientDetailsModel { /// Initializes Client details class. const ClientDetails({ - required String id, - required bool isOnline, - required String loginid, - required String name, - String? firstName, - String? lastName, - DateTime? lastOnlineTime, - }) : super( - id: id, - isOnline: isOnline, - loginid: loginid, - name: name, - firstName: firstName, - lastName: lastName, - lastOnlineTime: lastOnlineTime, - ); + required super.id, + required super.isOnline, + required super.loginid, + required super.name, + super.firstName, + super.lastName, + super.lastOnlineTime, + }); /// Creates an instance from JSON. factory ClientDetails.fromJson(Map json) => ClientDetails( @@ -758,7 +712,6 @@ class ClientDetails extends ClientDetailsModel { lastOnlineTime: lastOnlineTime ?? this.lastOnlineTime, ); } - /// Dispute details model class. abstract class DisputeDetailsModel { /// Initializes Dispute details model class . @@ -778,12 +731,9 @@ abstract class DisputeDetailsModel { class DisputeDetails extends DisputeDetailsModel { /// Initializes Dispute details class. const DisputeDetails({ - required String disputeReason, - required String disputerLoginid, - }) : super( - disputeReason: disputeReason, - disputerLoginid: disputerLoginid, - ); + required super.disputeReason, + required super.disputerLoginid, + }); /// Creates an instance from JSON. factory DisputeDetails.fromJson(Map json) => DisputeDetails( diff --git a/lib/api/response/p2p_order_info_response_result.dart b/lib/api/response/p2p_order_info_response_result.dart index e3785742ed..95b617e039 100644 --- a/lib/api/response/p2p_order_info_response_result.dart +++ b/lib/api/response/p2p_order_info_response_result.dart @@ -42,12 +42,9 @@ abstract class P2pOrderInfoResponseModel { class P2pOrderInfoResponse extends P2pOrderInfoResponseModel { /// Initializes P2p order info response class. const P2pOrderInfoResponse({ - P2pOrderInfo? p2pOrderInfo, - Subscription? subscription, - }) : super( - p2pOrderInfo: p2pOrderInfo, - subscription: subscription, - ); + super.p2pOrderInfo, + super.subscription, + }); /// Creates an instance from JSON. factory P2pOrderInfoResponse.fromJson( @@ -362,12 +359,10 @@ enum StatusEnum { /// dispute-completed. disputeCompleted, } - /// P2p order info model class. abstract class P2pOrderInfoModel { /// Initializes P2p order info model class . const P2pOrderInfoModel({ - required this.verificationPending, required this.type, required this.status, required this.rateDisplay, @@ -398,12 +393,10 @@ abstract class P2pOrderInfoModel { this.reviewDetails, this.verificationLockoutUntil, this.verificationNextRequest, + this.verificationPending, this.verificationTokenExpiry, }); - /// Indicates that the seller in the process of confirming the order. - final bool verificationPending; - /// Whether this is a buy or a sell. final TypeEnum type; @@ -494,6 +487,9 @@ abstract class P2pOrderInfoModel { /// If a verification request has already been made, the epoch time that another verification request can be made. final DateTime? verificationNextRequest; + /// Indicates that the seller in the process of confirming the order. + final bool? verificationPending; + /// Epoch time that the current verification token will expire. final DateTime? verificationTokenExpiry; } @@ -502,72 +498,39 @@ abstract class P2pOrderInfoModel { class P2pOrderInfo extends P2pOrderInfoModel { /// Initializes P2p order info class. const P2pOrderInfo({ - required String accountCurrency, - required AdvertDetails advertDetails, - required AdvertiserDetails advertiserDetails, - required double amount, - required String amountDisplay, - required String chatChannelUrl, - required ClientDetails clientDetails, - required String contactInfo, - required DateTime createdTime, - required DisputeDetails disputeDetails, - required DateTime expiryTime, - required String id, - required bool isIncoming, - required bool isReviewable, - required String localCurrency, - required String paymentInfo, - required double price, - required String priceDisplay, - required double rate, - required String rateDisplay, - required StatusEnum status, - required TypeEnum type, - required bool verificationPending, - DateTime? completionTime, - bool? isSeen, - String? paymentMethod, - Map? paymentMethodDetails, - List? paymentMethodNames, - ReviewDetails? reviewDetails, - DateTime? verificationLockoutUntil, - DateTime? verificationNextRequest, - DateTime? verificationTokenExpiry, - }) : super( - accountCurrency: accountCurrency, - advertDetails: advertDetails, - advertiserDetails: advertiserDetails, - amount: amount, - amountDisplay: amountDisplay, - chatChannelUrl: chatChannelUrl, - clientDetails: clientDetails, - contactInfo: contactInfo, - createdTime: createdTime, - disputeDetails: disputeDetails, - expiryTime: expiryTime, - id: id, - isIncoming: isIncoming, - isReviewable: isReviewable, - localCurrency: localCurrency, - paymentInfo: paymentInfo, - price: price, - priceDisplay: priceDisplay, - rate: rate, - rateDisplay: rateDisplay, - status: status, - type: type, - verificationPending: verificationPending, - completionTime: completionTime, - isSeen: isSeen, - paymentMethod: paymentMethod, - paymentMethodDetails: paymentMethodDetails, - paymentMethodNames: paymentMethodNames, - reviewDetails: reviewDetails, - verificationLockoutUntil: verificationLockoutUntil, - verificationNextRequest: verificationNextRequest, - verificationTokenExpiry: verificationTokenExpiry, - ); + required super.accountCurrency, + required super.advertDetails, + required super.advertiserDetails, + required super.amount, + required super.amountDisplay, + required super.chatChannelUrl, + required super.clientDetails, + required super.contactInfo, + required super.createdTime, + required super.disputeDetails, + required super.expiryTime, + required super.id, + required super.isIncoming, + required super.isReviewable, + required super.localCurrency, + required super.paymentInfo, + required super.price, + required super.priceDisplay, + required super.rate, + required super.rateDisplay, + required super.status, + required super.type, + super.completionTime, + super.isSeen, + super.paymentMethod, + super.paymentMethodDetails, + super.paymentMethodNames, + super.reviewDetails, + super.verificationLockoutUntil, + super.verificationNextRequest, + super.verificationPending, + super.verificationTokenExpiry, + }); /// Creates an instance from JSON. factory P2pOrderInfo.fromJson(Map json) => P2pOrderInfo( @@ -594,7 +557,6 @@ class P2pOrderInfo extends P2pOrderInfoModel { rateDisplay: json['rate_display'], status: statusEnumMapper[json['status']]!, type: typeEnumMapper[json['type']]!, - verificationPending: getBool(json['verification_pending'])!, completionTime: getDateTime(json['completion_time']), isSeen: getBool(json['is_seen']), paymentMethod: json['payment_method'], @@ -622,6 +584,7 @@ class P2pOrderInfo extends P2pOrderInfoModel { verificationLockoutUntil: getDateTime(json['verification_lockout_until']), verificationNextRequest: getDateTime(json['verification_next_request']), + verificationPending: getBool(json['verification_pending']), verificationTokenExpiry: getDateTime(json['verification_token_expiry']), ); @@ -660,7 +623,6 @@ class P2pOrderInfo extends P2pOrderInfoModel { resultMap['type'] = typeEnumMapper.entries .firstWhere((MapEntry entry) => entry.value == type) .key; - resultMap['verification_pending'] = verificationPending; resultMap['completion_time'] = getSecondsSinceEpochDateTime(completionTime); resultMap['is_seen'] = isSeen; resultMap['payment_method'] = paymentMethod; @@ -679,6 +641,7 @@ class P2pOrderInfo extends P2pOrderInfoModel { getSecondsSinceEpochDateTime(verificationLockoutUntil); resultMap['verification_next_request'] = getSecondsSinceEpochDateTime(verificationNextRequest); + resultMap['verification_pending'] = verificationPending; resultMap['verification_token_expiry'] = getSecondsSinceEpochDateTime(verificationTokenExpiry); @@ -709,7 +672,6 @@ class P2pOrderInfo extends P2pOrderInfoModel { String? rateDisplay, StatusEnum? status, TypeEnum? type, - bool? verificationPending, DateTime? completionTime, bool? isSeen, String? paymentMethod, @@ -718,6 +680,7 @@ class P2pOrderInfo extends P2pOrderInfoModel { ReviewDetails? reviewDetails, DateTime? verificationLockoutUntil, DateTime? verificationNextRequest, + bool? verificationPending, DateTime? verificationTokenExpiry, }) => P2pOrderInfo( @@ -743,7 +706,6 @@ class P2pOrderInfo extends P2pOrderInfoModel { rateDisplay: rateDisplay ?? this.rateDisplay, status: status ?? this.status, type: type ?? this.type, - verificationPending: verificationPending ?? this.verificationPending, completionTime: completionTime ?? this.completionTime, isSeen: isSeen ?? this.isSeen, paymentMethod: paymentMethod ?? this.paymentMethod, @@ -754,11 +716,11 @@ class P2pOrderInfo extends P2pOrderInfoModel { verificationLockoutUntil ?? this.verificationLockoutUntil, verificationNextRequest: verificationNextRequest ?? this.verificationNextRequest, + verificationPending: verificationPending ?? this.verificationPending, verificationTokenExpiry: verificationTokenExpiry ?? this.verificationTokenExpiry, ); } - /// Advert details model class. abstract class AdvertDetailsModel { /// Initializes Advert details model class . @@ -766,6 +728,7 @@ abstract class AdvertDetailsModel { required this.type, required this.id, required this.description, + required this.blockTrade, this.paymentMethod, }); @@ -778,6 +741,9 @@ abstract class AdvertDetailsModel { /// General information about the advert. final String description; + /// Indicates if this is block trade advert or not. + final bool blockTrade; + /// The payment method. final String? paymentMethod; } @@ -786,19 +752,16 @@ abstract class AdvertDetailsModel { class AdvertDetails extends AdvertDetailsModel { /// Initializes Advert details class. const AdvertDetails({ - required String description, - required String id, - required TypeEnum type, - String? paymentMethod, - }) : super( - description: description, - id: id, - type: type, - paymentMethod: paymentMethod, - ); + required super.blockTrade, + required super.description, + required super.id, + required super.type, + super.paymentMethod, + }); /// Creates an instance from JSON. factory AdvertDetails.fromJson(Map json) => AdvertDetails( + blockTrade: getBool(json['block_trade'])!, description: json['description'], id: json['id'], type: typeEnumMapper[json['type']]!, @@ -809,6 +772,7 @@ class AdvertDetails extends AdvertDetailsModel { Map toJson() { final Map resultMap = {}; + resultMap['block_trade'] = blockTrade; resultMap['description'] = description; resultMap['id'] = id; resultMap['type'] = typeEnumMapper.entries @@ -821,19 +785,20 @@ class AdvertDetails extends AdvertDetailsModel { /// Creates a copy of instance with given parameters. AdvertDetails copyWith({ + bool? blockTrade, String? description, String? id, TypeEnum? type, String? paymentMethod, }) => AdvertDetails( + blockTrade: blockTrade ?? this.blockTrade, description: description ?? this.description, id: id ?? this.id, type: type ?? this.type, paymentMethod: paymentMethod ?? this.paymentMethod, ); } - /// Advertiser details model class. abstract class AdvertiserDetailsModel { /// Initializes Advertiser details model class . @@ -877,24 +842,15 @@ abstract class AdvertiserDetailsModel { class AdvertiserDetails extends AdvertiserDetailsModel { /// Initializes Advertiser details class. const AdvertiserDetails({ - required String id, - required bool isOnline, - required String loginid, - required String name, - String? firstName, - int? isRecommended, - String? lastName, - DateTime? lastOnlineTime, - }) : super( - id: id, - isOnline: isOnline, - loginid: loginid, - name: name, - firstName: firstName, - isRecommended: isRecommended, - lastName: lastName, - lastOnlineTime: lastOnlineTime, - ); + required super.id, + required super.isOnline, + required super.loginid, + required super.name, + super.firstName, + super.isRecommended, + super.lastName, + super.lastOnlineTime, + }); /// Creates an instance from JSON. factory AdvertiserDetails.fromJson(Map json) => @@ -948,7 +904,6 @@ class AdvertiserDetails extends AdvertiserDetailsModel { lastOnlineTime: lastOnlineTime ?? this.lastOnlineTime, ); } - /// Client details model class. abstract class ClientDetailsModel { /// Initializes Client details model class . @@ -992,24 +947,15 @@ abstract class ClientDetailsModel { class ClientDetails extends ClientDetailsModel { /// Initializes Client details class. const ClientDetails({ - required String id, - required String loginid, - required String name, - String? firstName, - bool? isOnline, - int? isRecommended, - String? lastName, - DateTime? lastOnlineTime, - }) : super( - id: id, - loginid: loginid, - name: name, - firstName: firstName, - isOnline: isOnline, - isRecommended: isRecommended, - lastName: lastName, - lastOnlineTime: lastOnlineTime, - ); + required super.id, + required super.loginid, + required super.name, + super.firstName, + super.isOnline, + super.isRecommended, + super.lastName, + super.lastOnlineTime, + }); /// Creates an instance from JSON. factory ClientDetails.fromJson(Map json) => ClientDetails( @@ -1062,7 +1008,6 @@ class ClientDetails extends ClientDetailsModel { lastOnlineTime: lastOnlineTime ?? this.lastOnlineTime, ); } - /// Dispute details model class. abstract class DisputeDetailsModel { /// Initializes Dispute details model class . @@ -1082,12 +1027,9 @@ abstract class DisputeDetailsModel { class DisputeDetails extends DisputeDetailsModel { /// Initializes Dispute details class. const DisputeDetails({ - String? disputeReason, - String? disputerLoginid, - }) : super( - disputeReason: disputeReason, - disputerLoginid: disputerLoginid, - ); + super.disputeReason, + super.disputerLoginid, + }); /// Creates an instance from JSON. factory DisputeDetails.fromJson(Map json) => DisputeDetails( @@ -1115,7 +1057,6 @@ class DisputeDetails extends DisputeDetailsModel { disputerLoginid: disputerLoginid ?? this.disputerLoginid, ); } - /// Payment method details property model class. abstract class PaymentMethodDetailsPropertyModel { /// Initializes Payment method details property model class . @@ -1155,22 +1096,14 @@ abstract class PaymentMethodDetailsPropertyModel { class PaymentMethodDetailsProperty extends PaymentMethodDetailsPropertyModel { /// Initializes Payment method details property class. const PaymentMethodDetailsProperty({ - required Map fields, - required bool isEnabled, - required String method, - required PaymentMethodDetailsPropertyTypeEnum type, - String? displayName, - List? usedByAdverts, - List? usedByOrders, - }) : super( - fields: fields, - isEnabled: isEnabled, - method: method, - type: type, - displayName: displayName, - usedByAdverts: usedByAdverts, - usedByOrders: usedByOrders, - ); + required super.fields, + required super.isEnabled, + required super.method, + required super.type, + super.displayName, + super.usedByAdverts, + super.usedByOrders, + }); /// Creates an instance from JSON. factory PaymentMethodDetailsProperty.fromJson(Map json) => @@ -1252,7 +1185,6 @@ class PaymentMethodDetailsProperty extends PaymentMethodDetailsPropertyModel { usedByOrders: usedByOrders ?? this.usedByOrders, ); } - /// Fields property model class. abstract class FieldsPropertyModel { /// Initializes Fields property model class . @@ -1280,16 +1212,11 @@ abstract class FieldsPropertyModel { class FieldsProperty extends FieldsPropertyModel { /// Initializes Fields property class. const FieldsProperty({ - required String displayName, - required int required, - required FieldsPropertyTypeEnum type, - required String value, - }) : super( - displayName: displayName, - required: required, - type: type, - value: value, - ); + required super.displayName, + required super.required, + required super.type, + required super.value, + }); /// Creates an instance from JSON. factory FieldsProperty.fromJson(Map json) => FieldsProperty( @@ -1328,7 +1255,6 @@ class FieldsProperty extends FieldsPropertyModel { value: value ?? this.value, ); } - /// Review details model class. abstract class ReviewDetailsModel { /// Initializes Review details model class . @@ -1352,14 +1278,10 @@ abstract class ReviewDetailsModel { class ReviewDetails extends ReviewDetailsModel { /// Initializes Review details class. const ReviewDetails({ - required DateTime createdTime, - required int rating, - int? recommended, - }) : super( - createdTime: createdTime, - rating: rating, - recommended: recommended, - ); + required super.createdTime, + required super.rating, + super.recommended, + }); /// Creates an instance from JSON. factory ReviewDetails.fromJson(Map json) => ReviewDetails( @@ -1391,7 +1313,6 @@ class ReviewDetails extends ReviewDetailsModel { recommended: recommended ?? this.recommended, ); } - /// Subscription model class. abstract class SubscriptionModel { /// Initializes Subscription model class . @@ -1407,10 +1328,8 @@ abstract class SubscriptionModel { class Subscription extends SubscriptionModel { /// Initializes Subscription class. const Subscription({ - required String id, - }) : super( - id: id, - ); + required super.id, + }); /// Creates an instance from JSON. factory Subscription.fromJson(Map json) => Subscription( diff --git a/lib/api/response/p2p_order_list_response_result.dart b/lib/api/response/p2p_order_list_response_result.dart index d094361c9a..3cc71ac3e3 100644 --- a/lib/api/response/p2p_order_list_response_result.dart +++ b/lib/api/response/p2p_order_list_response_result.dart @@ -35,12 +35,9 @@ abstract class P2pOrderListResponseModel { class P2pOrderListResponse extends P2pOrderListResponseModel { /// Initializes P2p order list response class. const P2pOrderListResponse({ - P2pOrderList? p2pOrderList, - Subscription? subscription, - }) : super( - p2pOrderList: p2pOrderList, - subscription: subscription, - ); + super.p2pOrderList, + super.subscription, + }); /// Creates an instance from JSON. factory P2pOrderListResponse.fromJson( @@ -237,7 +234,6 @@ enum StatusEnum { /// dispute-completed. disputeCompleted, } - /// P2p order list model class. abstract class P2pOrderListModel { /// Initializes P2p order list model class . @@ -253,10 +249,8 @@ abstract class P2pOrderListModel { class P2pOrderList extends P2pOrderListModel { /// Initializes P2p order list class. const P2pOrderList({ - required List list, - }) : super( - list: list, - ); + required super.list, + }); /// Creates an instance from JSON. factory P2pOrderList.fromJson(Map json) => P2pOrderList( @@ -288,12 +282,10 @@ class P2pOrderList extends P2pOrderListModel { list: list ?? this.list, ); } - /// List item model class. abstract class ListItemModel { /// Initializes List item model class . const ListItemModel({ - required this.verificationPending, required this.type, required this.status, required this.rateDisplay, @@ -323,12 +315,10 @@ abstract class ListItemModel { this.reviewDetails, this.verificationLockoutUntil, this.verificationNextRequest, + this.verificationPending, this.verificationTokenExpiry, }); - /// Indicates that the seller in the process of confirming the order. - final bool verificationPending; - /// Whether this is a buy or a sell. final TypeEnum type; @@ -416,6 +406,9 @@ abstract class ListItemModel { /// If a verification request has already been made, the epoch time that another verification request can be made. final DateTime? verificationNextRequest; + /// Indicates that the seller in the process of confirming the order. + final bool? verificationPending; + /// Epoch time that the current verification token will expire. final DateTime? verificationTokenExpiry; } @@ -424,70 +417,38 @@ abstract class ListItemModel { class ListItem extends ListItemModel { /// Initializes List item class. const ListItem({ - required String accountCurrency, - required AdvertDetails advertDetails, - required AdvertiserDetails advertiserDetails, - required double amount, - required String amountDisplay, - required String chatChannelUrl, - required String contactInfo, - required DateTime createdTime, - required DisputeDetails disputeDetails, - required DateTime expiryTime, - required String id, - required bool isIncoming, - required bool isReviewable, - required String localCurrency, - required String paymentInfo, - required double price, - required String priceDisplay, - required double rate, - required String rateDisplay, - required StatusEnum status, - required TypeEnum type, - required bool verificationPending, - ClientDetails? clientDetails, - DateTime? completionTime, - bool? isSeen, - String? paymentMethod, - List? paymentMethodNames, - ReviewDetails? reviewDetails, - DateTime? verificationLockoutUntil, - DateTime? verificationNextRequest, - DateTime? verificationTokenExpiry, - }) : super( - accountCurrency: accountCurrency, - advertDetails: advertDetails, - advertiserDetails: advertiserDetails, - amount: amount, - amountDisplay: amountDisplay, - chatChannelUrl: chatChannelUrl, - contactInfo: contactInfo, - createdTime: createdTime, - disputeDetails: disputeDetails, - expiryTime: expiryTime, - id: id, - isIncoming: isIncoming, - isReviewable: isReviewable, - localCurrency: localCurrency, - paymentInfo: paymentInfo, - price: price, - priceDisplay: priceDisplay, - rate: rate, - rateDisplay: rateDisplay, - status: status, - type: type, - verificationPending: verificationPending, - clientDetails: clientDetails, - completionTime: completionTime, - isSeen: isSeen, - paymentMethod: paymentMethod, - paymentMethodNames: paymentMethodNames, - reviewDetails: reviewDetails, - verificationLockoutUntil: verificationLockoutUntil, - verificationNextRequest: verificationNextRequest, - verificationTokenExpiry: verificationTokenExpiry, - ); + required super.accountCurrency, + required super.advertDetails, + required super.advertiserDetails, + required super.amount, + required super.amountDisplay, + required super.chatChannelUrl, + required super.contactInfo, + required super.createdTime, + required super.disputeDetails, + required super.expiryTime, + required super.id, + required super.isIncoming, + required super.isReviewable, + required super.localCurrency, + required super.paymentInfo, + required super.price, + required super.priceDisplay, + required super.rate, + required super.rateDisplay, + required super.status, + required super.type, + super.clientDetails, + super.completionTime, + super.isSeen, + super.paymentMethod, + super.paymentMethodNames, + super.reviewDetails, + super.verificationLockoutUntil, + super.verificationNextRequest, + super.verificationPending, + super.verificationTokenExpiry, + }); /// Creates an instance from JSON. factory ListItem.fromJson(Map json) => ListItem( @@ -513,7 +474,6 @@ class ListItem extends ListItemModel { rateDisplay: json['rate_display'], status: statusEnumMapper[json['status']]!, type: typeEnumMapper[json['type']]!, - verificationPending: getBool(json['verification_pending'])!, clientDetails: json['client_details'] == null ? null : ClientDetails.fromJson(json['client_details']), @@ -533,6 +493,7 @@ class ListItem extends ListItemModel { verificationLockoutUntil: getDateTime(json['verification_lockout_until']), verificationNextRequest: getDateTime(json['verification_next_request']), + verificationPending: getBool(json['verification_pending']), verificationTokenExpiry: getDateTime(json['verification_token_expiry']), ); @@ -569,7 +530,6 @@ class ListItem extends ListItemModel { resultMap['type'] = typeEnumMapper.entries .firstWhere((MapEntry entry) => entry.value == type) .key; - resultMap['verification_pending'] = verificationPending; if (clientDetails != null) { resultMap['client_details'] = clientDetails!.toJson(); } @@ -590,6 +550,7 @@ class ListItem extends ListItemModel { getSecondsSinceEpochDateTime(verificationLockoutUntil); resultMap['verification_next_request'] = getSecondsSinceEpochDateTime(verificationNextRequest); + resultMap['verification_pending'] = verificationPending; resultMap['verification_token_expiry'] = getSecondsSinceEpochDateTime(verificationTokenExpiry); @@ -619,7 +580,6 @@ class ListItem extends ListItemModel { String? rateDisplay, StatusEnum? status, TypeEnum? type, - bool? verificationPending, ClientDetails? clientDetails, DateTime? completionTime, bool? isSeen, @@ -628,6 +588,7 @@ class ListItem extends ListItemModel { ReviewDetails? reviewDetails, DateTime? verificationLockoutUntil, DateTime? verificationNextRequest, + bool? verificationPending, DateTime? verificationTokenExpiry, }) => ListItem( @@ -652,7 +613,6 @@ class ListItem extends ListItemModel { rateDisplay: rateDisplay ?? this.rateDisplay, status: status ?? this.status, type: type ?? this.type, - verificationPending: verificationPending ?? this.verificationPending, clientDetails: clientDetails ?? this.clientDetails, completionTime: completionTime ?? this.completionTime, isSeen: isSeen ?? this.isSeen, @@ -663,11 +623,11 @@ class ListItem extends ListItemModel { verificationLockoutUntil ?? this.verificationLockoutUntil, verificationNextRequest: verificationNextRequest ?? this.verificationNextRequest, + verificationPending: verificationPending ?? this.verificationPending, verificationTokenExpiry: verificationTokenExpiry ?? this.verificationTokenExpiry, ); } - /// Advert details model class. abstract class AdvertDetailsModel { /// Initializes Advert details model class . @@ -675,6 +635,7 @@ abstract class AdvertDetailsModel { required this.type, required this.id, required this.description, + required this.blockTrade, this.paymentMethod, }); @@ -687,6 +648,9 @@ abstract class AdvertDetailsModel { /// General information about the advert. final String description; + /// Indicates if this is block trade advert or not. + final bool blockTrade; + /// The payment method. final String? paymentMethod; } @@ -695,19 +659,16 @@ abstract class AdvertDetailsModel { class AdvertDetails extends AdvertDetailsModel { /// Initializes Advert details class. const AdvertDetails({ - required String description, - required String id, - required TypeEnum type, - String? paymentMethod, - }) : super( - description: description, - id: id, - type: type, - paymentMethod: paymentMethod, - ); + required super.blockTrade, + required super.description, + required super.id, + required super.type, + super.paymentMethod, + }); /// Creates an instance from JSON. factory AdvertDetails.fromJson(Map json) => AdvertDetails( + blockTrade: getBool(json['block_trade'])!, description: json['description'], id: json['id'], type: typeEnumMapper[json['type']]!, @@ -718,6 +679,7 @@ class AdvertDetails extends AdvertDetailsModel { Map toJson() { final Map resultMap = {}; + resultMap['block_trade'] = blockTrade; resultMap['description'] = description; resultMap['id'] = id; resultMap['type'] = typeEnumMapper.entries @@ -730,19 +692,20 @@ class AdvertDetails extends AdvertDetailsModel { /// Creates a copy of instance with given parameters. AdvertDetails copyWith({ + bool? blockTrade, String? description, String? id, TypeEnum? type, String? paymentMethod, }) => AdvertDetails( + blockTrade: blockTrade ?? this.blockTrade, description: description ?? this.description, id: id ?? this.id, type: type ?? this.type, paymentMethod: paymentMethod ?? this.paymentMethod, ); } - /// Advertiser details model class. abstract class AdvertiserDetailsModel { /// Initializes Advertiser details model class . @@ -786,24 +749,15 @@ abstract class AdvertiserDetailsModel { class AdvertiserDetails extends AdvertiserDetailsModel { /// Initializes Advertiser details class. const AdvertiserDetails({ - required String id, - required bool isOnline, - required String loginid, - required String name, - String? firstName, - int? isRecommended, - String? lastName, - DateTime? lastOnlineTime, - }) : super( - id: id, - isOnline: isOnline, - loginid: loginid, - name: name, - firstName: firstName, - isRecommended: isRecommended, - lastName: lastName, - lastOnlineTime: lastOnlineTime, - ); + required super.id, + required super.isOnline, + required super.loginid, + required super.name, + super.firstName, + super.isRecommended, + super.lastName, + super.lastOnlineTime, + }); /// Creates an instance from JSON. factory AdvertiserDetails.fromJson(Map json) => @@ -857,7 +811,6 @@ class AdvertiserDetails extends AdvertiserDetailsModel { lastOnlineTime: lastOnlineTime ?? this.lastOnlineTime, ); } - /// Dispute details model class. abstract class DisputeDetailsModel { /// Initializes Dispute details model class . @@ -877,12 +830,9 @@ abstract class DisputeDetailsModel { class DisputeDetails extends DisputeDetailsModel { /// Initializes Dispute details class. const DisputeDetails({ - String? disputeReason, - String? disputerLoginid, - }) : super( - disputeReason: disputeReason, - disputerLoginid: disputerLoginid, - ); + super.disputeReason, + super.disputerLoginid, + }); /// Creates an instance from JSON. factory DisputeDetails.fromJson(Map json) => DisputeDetails( @@ -910,7 +860,6 @@ class DisputeDetails extends DisputeDetailsModel { disputerLoginid: disputerLoginid ?? this.disputerLoginid, ); } - /// Client details model class. abstract class ClientDetailsModel { /// Initializes Client details model class . @@ -954,24 +903,15 @@ abstract class ClientDetailsModel { class ClientDetails extends ClientDetailsModel { /// Initializes Client details class. const ClientDetails({ - required String id, - required bool isOnline, - required String loginid, - required String name, - String? firstName, - int? isRecommended, - String? lastName, - DateTime? lastOnlineTime, - }) : super( - id: id, - isOnline: isOnline, - loginid: loginid, - name: name, - firstName: firstName, - isRecommended: isRecommended, - lastName: lastName, - lastOnlineTime: lastOnlineTime, - ); + required super.id, + required super.isOnline, + required super.loginid, + required super.name, + super.firstName, + super.isRecommended, + super.lastName, + super.lastOnlineTime, + }); /// Creates an instance from JSON. factory ClientDetails.fromJson(Map json) => ClientDetails( @@ -1024,7 +964,6 @@ class ClientDetails extends ClientDetailsModel { lastOnlineTime: lastOnlineTime ?? this.lastOnlineTime, ); } - /// Review details model class. abstract class ReviewDetailsModel { /// Initializes Review details model class . @@ -1048,14 +987,10 @@ abstract class ReviewDetailsModel { class ReviewDetails extends ReviewDetailsModel { /// Initializes Review details class. const ReviewDetails({ - required DateTime createdTime, - required int rating, - int? recommended, - }) : super( - createdTime: createdTime, - rating: rating, - recommended: recommended, - ); + required super.createdTime, + required super.rating, + super.recommended, + }); /// Creates an instance from JSON. factory ReviewDetails.fromJson(Map json) => ReviewDetails( @@ -1087,7 +1022,6 @@ class ReviewDetails extends ReviewDetailsModel { recommended: recommended ?? this.recommended, ); } - /// Subscription model class. abstract class SubscriptionModel { /// Initializes Subscription model class . @@ -1103,10 +1037,8 @@ abstract class SubscriptionModel { class Subscription extends SubscriptionModel { /// Initializes Subscription class. const Subscription({ - required String id, - }) : super( - id: id, - ); + required super.id, + }); /// Creates an instance from JSON. factory Subscription.fromJson(Map json) => Subscription( diff --git a/lib/api/response/p2p_order_review_response_result.dart b/lib/api/response/p2p_order_review_response_result.dart index 8e4e29fe9b..4e26bc16dc 100644 --- a/lib/api/response/p2p_order_review_response_result.dart +++ b/lib/api/response/p2p_order_review_response_result.dart @@ -24,10 +24,8 @@ abstract class P2pOrderReviewResponseModel { class P2pOrderReviewResponse extends P2pOrderReviewResponseModel { /// Initializes P2p order review response class. const P2pOrderReviewResponse({ - P2pOrderReview? p2pOrderReview, - }) : super( - p2pOrderReview: p2pOrderReview, - ); + super.p2pOrderReview, + }); /// Creates an instance from JSON. factory P2pOrderReviewResponse.fromJson( @@ -90,7 +88,6 @@ class P2pOrderReviewResponse extends P2pOrderReviewResponseModel { p2pOrderReview: p2pOrderReview ?? this.p2pOrderReview, ); } - /// P2p order review model class. abstract class P2pOrderReviewModel { /// Initializes P2p order review model class . @@ -122,18 +119,12 @@ abstract class P2pOrderReviewModel { class P2pOrderReview extends P2pOrderReviewModel { /// Initializes P2p order review class. const P2pOrderReview({ - required String advertiserId, - required DateTime createdTime, - required String orderId, - required int rating, - int? recommended, - }) : super( - advertiserId: advertiserId, - createdTime: createdTime, - orderId: orderId, - rating: rating, - recommended: recommended, - ); + required super.advertiserId, + required super.createdTime, + required super.orderId, + required super.rating, + super.recommended, + }); /// Creates an instance from JSON. factory P2pOrderReview.fromJson(Map json) => P2pOrderReview( diff --git a/lib/api/response/p2p_payment_methods_response_result.dart b/lib/api/response/p2p_payment_methods_response_result.dart index 7a464168ae..651cf997df 100644 --- a/lib/api/response/p2p_payment_methods_response_result.dart +++ b/lib/api/response/p2p_payment_methods_response_result.dart @@ -24,10 +24,8 @@ abstract class P2pPaymentMethodsResponseModel { class P2pPaymentMethodsResponse extends P2pPaymentMethodsResponseModel { /// Initializes P2p payment methods response class. const P2pPaymentMethodsResponse({ - Map? p2pPaymentMethods, - }) : super( - p2pPaymentMethods: p2pPaymentMethods, - ); + super.p2pPaymentMethods, + }); /// Creates an instance from JSON. factory P2pPaymentMethodsResponse.fromJson( @@ -123,7 +121,6 @@ enum P2pPaymentMethodsPropertyTypeEnum { /// other. other, } - /// P2p payment methods property model class. abstract class P2pPaymentMethodsPropertyModel { /// Initializes P2p payment methods property model class . @@ -147,14 +144,10 @@ abstract class P2pPaymentMethodsPropertyModel { class P2pPaymentMethodsProperty extends P2pPaymentMethodsPropertyModel { /// Initializes P2p payment methods property class. const P2pPaymentMethodsProperty({ - required String displayName, - required Map fields, - required P2pPaymentMethodsPropertyTypeEnum type, - }) : super( - displayName: displayName, - fields: fields, - type: type, - ); + required super.displayName, + required super.fields, + required super.type, + }); /// Creates an instance from JSON. factory P2pPaymentMethodsProperty.fromJson(Map json) => @@ -196,7 +189,6 @@ class P2pPaymentMethodsProperty extends P2pPaymentMethodsPropertyModel { type: type ?? this.type, ); } - /// Fields property model class. abstract class FieldsPropertyModel { /// Initializes Fields property model class . @@ -220,14 +212,10 @@ abstract class FieldsPropertyModel { class FieldsProperty extends FieldsPropertyModel { /// Initializes Fields property class. const FieldsProperty({ - required String displayName, - required int required, - required TypeEnum type, - }) : super( - displayName: displayName, - required: required, - type: type, - ); + required super.displayName, + required super.required, + required super.type, + }); /// Creates an instance from JSON. factory FieldsProperty.fromJson(Map json) => FieldsProperty( diff --git a/lib/api/response/p2p_ping_response_result.dart b/lib/api/response/p2p_ping_response_result.dart index a82581922a..0dfd2c91cd 100644 --- a/lib/api/response/p2p_ping_response_result.dart +++ b/lib/api/response/p2p_ping_response_result.dart @@ -2,13 +2,13 @@ import 'package:equatable/equatable.dart'; -import 'package:deriv_dependency_injector/dependency_injector.dart'; -import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; -import 'package:flutter_deriv_api/basic_api/generated/p2p_ping_receive.dart'; -import 'package:flutter_deriv_api/basic_api/generated/p2p_ping_send.dart'; - -import 'package:flutter_deriv_api/helpers/helpers.dart'; +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; +import 'package:flutter_deriv_api/basic_api/generated/p2p_ping_receive.dart'; +import 'package:flutter_deriv_api/basic_api/generated/p2p_ping_send.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; /// P2p ping response model class. @@ -26,10 +26,8 @@ abstract class P2pPingResponseModel { class P2pPingResponse extends P2pPingResponseModel { /// Initializes P2p ping response class. const P2pPingResponse({ - P2pPingEnum? p2pPing, - }) : super( - p2pPing: p2pPing, - ); + super.p2pPing, + }); /// Creates an instance from JSON. factory P2pPingResponse.fromJson( @@ -67,7 +65,7 @@ class P2pPingResponse extends P2pPingResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - BaseAPIException(baseExceptionModel: baseExceptionModel), + APIBaseException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/p2p_settings_response_result.dart b/lib/api/response/p2p_settings_response_result.dart index 817bf33f3c..d6d15e6ce1 100644 --- a/lib/api/response/p2p_settings_response_result.dart +++ b/lib/api/response/p2p_settings_response_result.dart @@ -105,7 +105,6 @@ enum FloatRateAdvertsEnum { /// list_only. listOnly, } - /// P2p settings model class. abstract class P2pSettingsModel { /// Initializes P2p settings model class . @@ -391,7 +390,6 @@ class P2pSettings extends P2pSettingsModel { overrideExchangeRate: overrideExchangeRate ?? this.overrideExchangeRate, ); } - /// Block trade model class. abstract class BlockTradeModel { /// Initializes Block trade model class . @@ -441,7 +439,6 @@ class BlockTrade extends BlockTradeModel { maximumAdvertAmount: maximumAdvertAmount ?? this.maximumAdvertAmount, ); } - /// Local currencies item model class. abstract class LocalCurrenciesItemModel { /// Initializes Local currencies item model class . @@ -510,7 +507,6 @@ class LocalCurrenciesItem extends LocalCurrenciesItemModel { isDefault: isDefault ?? this.isDefault, ); } - /// Counterparty term steps model class. abstract class CounterpartyTermStepsModel { /// Initializes Counterparty term steps model class . @@ -596,7 +592,6 @@ class CounterpartyTermSteps extends CounterpartyTermStepsModel { rating: rating ?? this.rating, ); } - /// Subscription model class. abstract class SubscriptionModel { /// Initializes Subscription model class . diff --git a/lib/api/response/passkeys_list_response_result.dart b/lib/api/response/passkeys_list_response_result.dart new file mode 100644 index 0000000000..253204bfa8 --- /dev/null +++ b/lib/api/response/passkeys_list_response_result.dart @@ -0,0 +1,147 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Passkeys list response model class. +abstract class PasskeysListResponseModel { + /// Initializes Passkeys list response model class . + const PasskeysListResponseModel({ + this.passkeysList, + }); + + /// The list of passkeys. + final List? passkeysList; +} + +/// Passkeys list response class. +class PasskeysListResponse extends PasskeysListResponseModel { + /// Initializes Passkeys list response class. + const PasskeysListResponse({ + super.passkeysList, + }); + + /// Creates an instance from JSON. + factory PasskeysListResponse.fromJson( + dynamic passkeysListJson, + ) => + PasskeysListResponse( + passkeysList: passkeysListJson == null + ? null + : List.from( + passkeysListJson?.map( + (dynamic item) => PasskeysListItem.fromJson(item), + ), + ), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (passkeysList != null) { + resultMap['passkeys_list'] = passkeysList! + .map( + (PasskeysListItem item) => item.toJson(), + ) + .toList(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + PasskeysListResponse copyWith({ + List? passkeysList, + }) => + PasskeysListResponse( + passkeysList: passkeysList ?? this.passkeysList, + ); +} +/// Passkeys list item model class. +abstract class PasskeysListItemModel { + /// Initializes Passkeys list item model class . + const PasskeysListItemModel({ + this.createdAt, + this.id, + this.lastUsed, + this.name, + this.passkeyId, + this.storedOn, + }); + + /// The epoch date when the passkey was created. + final DateTime? createdAt; + + /// The system id of the stored passkey. + final int? id; + + /// The epoch timestamp that the key was last used to authenticate the user. + final DateTime? lastUsed; + + /// The descriptive name of the passkey. + final String? name; + + /// The id of the passkey credential. + final String? passkeyId; + + /// The name of the device where the credential is stored on. + final String? storedOn; +} + +/// Passkeys list item class. +class PasskeysListItem extends PasskeysListItemModel { + /// Initializes Passkeys list item class. + const PasskeysListItem({ + super.createdAt, + super.id, + super.lastUsed, + super.name, + super.passkeyId, + super.storedOn, + }); + + /// Creates an instance from JSON. + factory PasskeysListItem.fromJson(Map json) => + PasskeysListItem( + createdAt: getDateTime(json['created_at']), + id: json['id'], + lastUsed: getDateTime(json['last_used']), + name: json['name'], + passkeyId: json['passkey_id'], + storedOn: json['stored_on'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['created_at'] = getSecondsSinceEpochDateTime(createdAt); + resultMap['id'] = id; + resultMap['last_used'] = getSecondsSinceEpochDateTime(lastUsed); + resultMap['name'] = name; + resultMap['passkey_id'] = passkeyId; + resultMap['stored_on'] = storedOn; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + PasskeysListItem copyWith({ + DateTime? createdAt, + int? id, + DateTime? lastUsed, + String? name, + String? passkeyId, + String? storedOn, + }) => + PasskeysListItem( + createdAt: createdAt ?? this.createdAt, + id: id ?? this.id, + lastUsed: lastUsed ?? this.lastUsed, + name: name ?? this.name, + passkeyId: passkeyId ?? this.passkeyId, + storedOn: storedOn ?? this.storedOn, + ); +} diff --git a/lib/api/response/passkeys_login_response_result.dart b/lib/api/response/passkeys_login_response_result.dart new file mode 100644 index 0000000000..4ca8ffa84b --- /dev/null +++ b/lib/api/response/passkeys_login_response_result.dart @@ -0,0 +1,111 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Passkeys login response model class. +abstract class PasskeysLoginResponseModel { + /// Initializes Passkeys login response model class . + const PasskeysLoginResponseModel({ + this.passkeysLogin, + }); + + /// Wrapper of the response. + final PasskeysLogin? passkeysLogin; +} + +/// Passkeys login response class. +class PasskeysLoginResponse extends PasskeysLoginResponseModel { + /// Initializes Passkeys login response class. + const PasskeysLoginResponse({ + super.passkeysLogin, + }); + + /// Creates an instance from JSON. + factory PasskeysLoginResponse.fromJson( + dynamic passkeysLoginJson, + ) => + PasskeysLoginResponse( + passkeysLogin: passkeysLoginJson == null + ? null + : PasskeysLogin.fromJson(passkeysLoginJson), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (passkeysLogin != null) { + resultMap['passkeys_login'] = passkeysLogin!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + PasskeysLoginResponse copyWith({ + PasskeysLogin? passkeysLogin, + }) => + PasskeysLoginResponse( + passkeysLogin: passkeysLogin ?? this.passkeysLogin, + ); +} +/// Passkeys login model class. +abstract class PasskeysLoginModel { + /// Initializes Passkeys login model class . + const PasskeysLoginModel({ + this.binaryUserId, + this.email, + this.verified, + }); + + /// The user id. + final int? binaryUserId; + + /// The email address of the user. + final String? email; + + /// The Passkeys login status + final bool? verified; +} + +/// Passkeys login class. +class PasskeysLogin extends PasskeysLoginModel { + /// Initializes Passkeys login class. + const PasskeysLogin({ + super.binaryUserId, + super.email, + super.verified, + }); + + /// Creates an instance from JSON. + factory PasskeysLogin.fromJson(Map json) => PasskeysLogin( + binaryUserId: json['binary_user_id'], + email: json['email'], + verified: getBool(json['verified']), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['binary_user_id'] = binaryUserId; + resultMap['email'] = email; + resultMap['verified'] = verified; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + PasskeysLogin copyWith({ + int? binaryUserId, + String? email, + bool? verified, + }) => + PasskeysLogin( + binaryUserId: binaryUserId ?? this.binaryUserId, + email: email ?? this.email, + verified: verified ?? this.verified, + ); +} diff --git a/lib/api/response/passkeys_options_response_result.dart b/lib/api/response/passkeys_options_response_result.dart new file mode 100644 index 0000000000..93eef279f1 --- /dev/null +++ b/lib/api/response/passkeys_options_response_result.dart @@ -0,0 +1,340 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Passkeys options response model class. +abstract class PasskeysOptionsResponseModel { + /// Initializes Passkeys options response model class . + const PasskeysOptionsResponseModel({ + this.passkeysOptions, + }); + + /// Wrapper of the response. + final PasskeysOptions? passkeysOptions; +} + +/// Passkeys options response class. +class PasskeysOptionsResponse extends PasskeysOptionsResponseModel { + /// Initializes Passkeys options response class. + const PasskeysOptionsResponse({ + super.passkeysOptions, + }); + + /// Creates an instance from JSON. + factory PasskeysOptionsResponse.fromJson( + dynamic passkeysOptionsJson, + ) => + PasskeysOptionsResponse( + passkeysOptions: passkeysOptionsJson == null + ? null + : PasskeysOptions.fromJson(passkeysOptionsJson), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (passkeysOptions != null) { + resultMap['passkeys_options'] = passkeysOptions!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + PasskeysOptionsResponse copyWith({ + PasskeysOptions? passkeysOptions, + }) => + PasskeysOptionsResponse( + passkeysOptions: passkeysOptions ?? this.passkeysOptions, + ); +} + +/// TransportsItemEnum mapper. +final Map transportsItemEnumMapper = + { + "usb": TransportsItemEnum.usb, + "nfc": TransportsItemEnum.nfc, + "ble": TransportsItemEnum.ble, + "smart-card": TransportsItemEnum.smartCard, + "hybrid": TransportsItemEnum.hybrid, + "internal": TransportsItemEnum.internal, +}; + +/// TransportsItem Enum. +enum TransportsItemEnum { + /// usb. + usb, + + /// nfc. + nfc, + + /// ble. + ble, + + /// smart-card. + smartCard, + + /// hybrid. + hybrid, + + /// internal. + internal, +} + +/// TypeEnum mapper. +final Map typeEnumMapper = { + "public-key": TypeEnum.publicKey, +}; + +/// Type Enum. +enum TypeEnum { + /// public-key. + publicKey, +} + +/// UserVerificationEnum mapper. +final Map userVerificationEnumMapper = + { + "required": UserVerificationEnum.required, + "preferred": UserVerificationEnum.preferred, + "discouraged": UserVerificationEnum.discouraged, +}; + +/// UserVerification Enum. +enum UserVerificationEnum { + /// required. + required, + + /// preferred. + preferred, + + /// discouraged. + discouraged, +} +/// Passkeys options model class. +abstract class PasskeysOptionsModel { + /// Initializes Passkeys options model class . + const PasskeysOptionsModel({ + this.publicKey, + }); + + /// Wrapper of the options. + final PublicKey? publicKey; +} + +/// Passkeys options class. +class PasskeysOptions extends PasskeysOptionsModel { + /// Initializes Passkeys options class. + const PasskeysOptions({ + super.publicKey, + }); + + /// Creates an instance from JSON. + factory PasskeysOptions.fromJson(Map json) => + PasskeysOptions( + publicKey: json['publicKey'] == null + ? null + : PublicKey.fromJson(json['publicKey']), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (publicKey != null) { + resultMap['publicKey'] = publicKey!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + PasskeysOptions copyWith({ + PublicKey? publicKey, + }) => + PasskeysOptions( + publicKey: publicKey ?? this.publicKey, + ); +} +/// Public key model class. +abstract class PublicKeyModel { + /// Initializes Public key model class . + const PublicKeyModel({ + this.allowCredentials, + this.challenge, + this.extensions, + this.rpId, + this.timeout, + this.userVerification, + }); + + /// List of credentials that are already registered. Only listed credentials are allowed to authenticate. + final List? allowCredentials; + + /// Random string to be signed by the authenticator. will be byte array base64 encoded. + final String? challenge; + + /// Empty for now + final Map? extensions; + + /// Relying party id. + final String? rpId; + + /// Time before expiring the ceremony in milliseconds. + final DateTime? timeout; + + /// Ask the user to enter thier authentication method (PIN, fingerprint, etc). Default is discouraged. + final UserVerificationEnum? userVerification; +} + +/// Public key class. +class PublicKey extends PublicKeyModel { + /// Initializes Public key class. + const PublicKey({ + super.allowCredentials, + super.challenge, + super.extensions, + super.rpId, + super.timeout, + super.userVerification, + }); + + /// Creates an instance from JSON. + factory PublicKey.fromJson(Map json) => PublicKey( + allowCredentials: json['allowCredentials'] == null + ? null + : List.from( + json['allowCredentials']?.map( + (dynamic item) => AllowCredentialsItem.fromJson(item), + ), + ), + challenge: json['challenge'], + extensions: json['extensions'], + rpId: json['rpId'], + timeout: getDateTime(json['timeout']), + userVerification: json['userVerification'] == null + ? null + : userVerificationEnumMapper[json['userVerification']], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (allowCredentials != null) { + resultMap['allowCredentials'] = allowCredentials! + .map( + (AllowCredentialsItem item) => item.toJson(), + ) + .toList(); + } + resultMap['challenge'] = challenge; + resultMap['extensions'] = extensions; + resultMap['rpId'] = rpId; + resultMap['timeout'] = getSecondsSinceEpochDateTime(timeout); + resultMap['userVerification'] = userVerificationEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == userVerification) + .key; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + PublicKey copyWith({ + List? allowCredentials, + String? challenge, + Map? extensions, + String? rpId, + DateTime? timeout, + UserVerificationEnum? userVerification, + }) => + PublicKey( + allowCredentials: allowCredentials ?? this.allowCredentials, + challenge: challenge ?? this.challenge, + extensions: extensions ?? this.extensions, + rpId: rpId ?? this.rpId, + timeout: timeout ?? this.timeout, + userVerification: userVerification ?? this.userVerification, + ); +} +/// Allow credentials item model class. +abstract class AllowCredentialsItemModel { + /// Initializes Allow credentials item model class . + const AllowCredentialsItemModel({ + this.id, + this.transports, + this.type, + }); + + /// The credential id. base64 encoded. + final String? id; + + /// The transports supported by the authenticator. + final List? transports; + + /// Will be always public-key. + final TypeEnum? type; +} + +/// Allow credentials item class. +class AllowCredentialsItem extends AllowCredentialsItemModel { + /// Initializes Allow credentials item class. + const AllowCredentialsItem({ + super.id, + super.transports, + super.type, + }); + + /// Creates an instance from JSON. + factory AllowCredentialsItem.fromJson(Map json) => + AllowCredentialsItem( + id: json['id'], + transports: json['transports'] == null + ? null + : List.from( + json['transports']?.map( + (dynamic item) => + item == null ? null : transportsItemEnumMapper[item], + ), + ), + type: json['type'] == null ? null : typeEnumMapper[json['type']], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['id'] = id; + if (transports != null) { + resultMap['transports'] = transports! + .map( + (TransportsItemEnum item) => transportsItemEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == item) + .key, + ) + .toList(); + } + resultMap['type'] = typeEnumMapper.entries + .firstWhere((MapEntry entry) => entry.value == type) + .key; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + AllowCredentialsItem copyWith({ + String? id, + List? transports, + TypeEnum? type, + }) => + AllowCredentialsItem( + id: id ?? this.id, + transports: transports ?? this.transports, + type: type ?? this.type, + ); +} diff --git a/lib/api/response/passkeys_register_options_response_result.dart b/lib/api/response/passkeys_register_options_response_result.dart new file mode 100644 index 0000000000..a412fb7252 --- /dev/null +++ b/lib/api/response/passkeys_register_options_response_result.dart @@ -0,0 +1,656 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Passkeys register options response model class. +abstract class PasskeysRegisterOptionsResponseModel { + /// Initializes Passkeys register options response model class . + const PasskeysRegisterOptionsResponseModel({ + this.passkeysRegisterOptions, + }); + + /// Wrapper of the response. + final PasskeysRegisterOptions? passkeysRegisterOptions; +} + +/// Passkeys register options response class. +class PasskeysRegisterOptionsResponse + extends PasskeysRegisterOptionsResponseModel { + /// Initializes Passkeys register options response class. + const PasskeysRegisterOptionsResponse({ + super.passkeysRegisterOptions, + }); + + /// Creates an instance from JSON. + factory PasskeysRegisterOptionsResponse.fromJson( + dynamic passkeysRegisterOptionsJson, + ) => + PasskeysRegisterOptionsResponse( + passkeysRegisterOptions: passkeysRegisterOptionsJson == null + ? null + : PasskeysRegisterOptions.fromJson(passkeysRegisterOptionsJson), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (passkeysRegisterOptions != null) { + resultMap['passkeys_register_options'] = + passkeysRegisterOptions!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + PasskeysRegisterOptionsResponse copyWith({ + PasskeysRegisterOptions? passkeysRegisterOptions, + }) => + PasskeysRegisterOptionsResponse( + passkeysRegisterOptions: + passkeysRegisterOptions ?? this.passkeysRegisterOptions, + ); +} + +/// AttestationEnum mapper. +final Map attestationEnumMapper = + { + "none": AttestationEnum.none, + "indirect": AttestationEnum.indirect, + "direct": AttestationEnum.direct, +}; + +/// Attestation Enum. +enum AttestationEnum { + /// none. + none, + + /// indirect. + indirect, + + /// direct. + direct, +} + +/// AuthenticatorAttachmentEnum mapper. +final Map + authenticatorAttachmentEnumMapper = { + "platform": AuthenticatorAttachmentEnum.platform, + "cross-platform": AuthenticatorAttachmentEnum.crossPlatform, +}; + +/// AuthenticatorAttachment Enum. +enum AuthenticatorAttachmentEnum { + /// platform. + platform, + + /// cross-platform. + crossPlatform, +} + +/// UserVerificationEnum mapper. +final Map userVerificationEnumMapper = + { + "required": UserVerificationEnum.required, + "preferred": UserVerificationEnum.preferred, + "discouraged": UserVerificationEnum.discouraged, +}; + +/// UserVerification Enum. +enum UserVerificationEnum { + /// required. + required, + + /// preferred. + preferred, + + /// discouraged. + discouraged, +} + +/// TransportsItemEnum mapper. +final Map transportsItemEnumMapper = + { + "usb": TransportsItemEnum.usb, + "nfc": TransportsItemEnum.nfc, + "ble": TransportsItemEnum.ble, + "smart-card": TransportsItemEnum.smartCard, + "hybrid": TransportsItemEnum.hybrid, + "internal": TransportsItemEnum.internal, +}; + +/// TransportsItem Enum. +enum TransportsItemEnum { + /// usb. + usb, + + /// nfc. + nfc, + + /// ble. + ble, + + /// smart-card. + smartCard, + + /// hybrid. + hybrid, + + /// internal. + internal, +} + +/// TypeEnum mapper. +final Map typeEnumMapper = { + "public-key": TypeEnum.publicKey, +}; + +/// Type Enum. +enum TypeEnum { + /// public-key. + publicKey, +} +/// Passkeys register options model class. +abstract class PasskeysRegisterOptionsModel { + /// Initializes Passkeys register options model class . + const PasskeysRegisterOptionsModel({ + this.publicKey, + }); + + /// Wrapper of the options. + final PublicKey? publicKey; +} + +/// Passkeys register options class. +class PasskeysRegisterOptions extends PasskeysRegisterOptionsModel { + /// Initializes Passkeys register options class. + const PasskeysRegisterOptions({ + super.publicKey, + }); + + /// Creates an instance from JSON. + factory PasskeysRegisterOptions.fromJson(Map json) => + PasskeysRegisterOptions( + publicKey: json['publicKey'] == null + ? null + : PublicKey.fromJson(json['publicKey']), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (publicKey != null) { + resultMap['publicKey'] = publicKey!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + PasskeysRegisterOptions copyWith({ + PublicKey? publicKey, + }) => + PasskeysRegisterOptions( + publicKey: publicKey ?? this.publicKey, + ); +} +/// Public key model class. +abstract class PublicKeyModel { + /// Initializes Public key model class . + const PublicKeyModel({ + this.attestation, + this.authenticatorSelection, + this.challenge, + this.excludeCredentials, + this.extensions, + this.pubKeyCredParams, + this.rp, + this.timeout, + this.user, + }); + + /// The attestation settings, weather the authenticator will attest the respone on no. Default is direct. + final AttestationEnum? attestation; + + /// Settings to control authenticator behavior and selection. + final AuthenticatorSelection? authenticatorSelection; + + /// Random string to be signed by the authenticator. will be byte array base64 encoded. + final String? challenge; + + /// List of already registered credentials to avoid re-registering. + final List? excludeCredentials; + + /// Empty for now + final Map? extensions; + + /// Supported public key algorithms. + final List? pubKeyCredParams; + + /// The relying party info. + final Rp? rp; + + /// Time before expiring the cermony in milliseconds. + final DateTime? timeout; + + /// The user info + final User? user; +} + +/// Public key class. +class PublicKey extends PublicKeyModel { + /// Initializes Public key class. + const PublicKey({ + super.attestation, + super.authenticatorSelection, + super.challenge, + super.excludeCredentials, + super.extensions, + super.pubKeyCredParams, + super.rp, + super.timeout, + super.user, + }); + + /// Creates an instance from JSON. + factory PublicKey.fromJson(Map json) => PublicKey( + attestation: json['attestation'] == null + ? null + : attestationEnumMapper[json['attestation']], + authenticatorSelection: json['authenticatorSelection'] == null + ? null + : AuthenticatorSelection.fromJson(json['authenticatorSelection']), + challenge: json['challenge'], + excludeCredentials: json['excludeCredentials'] == null + ? null + : List.from( + json['excludeCredentials']?.map( + (dynamic item) => ExcludeCredentialsItem.fromJson(item), + ), + ), + extensions: json['extensions'], + pubKeyCredParams: json['pubKeyCredParams'] == null + ? null + : List.from( + json['pubKeyCredParams']?.map( + (dynamic item) => PubKeyCredParamsItem.fromJson(item), + ), + ), + rp: json['rp'] == null ? null : Rp.fromJson(json['rp']), + timeout: getDateTime(json['timeout']), + user: json['user'] == null ? null : User.fromJson(json['user']), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['attestation'] = attestationEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == attestation) + .key; + if (authenticatorSelection != null) { + resultMap['authenticatorSelection'] = authenticatorSelection!.toJson(); + } + resultMap['challenge'] = challenge; + if (excludeCredentials != null) { + resultMap['excludeCredentials'] = excludeCredentials! + .map( + (ExcludeCredentialsItem item) => item.toJson(), + ) + .toList(); + } + resultMap['extensions'] = extensions; + if (pubKeyCredParams != null) { + resultMap['pubKeyCredParams'] = pubKeyCredParams! + .map( + (PubKeyCredParamsItem item) => item.toJson(), + ) + .toList(); + } + if (rp != null) { + resultMap['rp'] = rp!.toJson(); + } + resultMap['timeout'] = getSecondsSinceEpochDateTime(timeout); + if (user != null) { + resultMap['user'] = user!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + PublicKey copyWith({ + AttestationEnum? attestation, + AuthenticatorSelection? authenticatorSelection, + String? challenge, + List? excludeCredentials, + Map? extensions, + List? pubKeyCredParams, + Rp? rp, + DateTime? timeout, + User? user, + }) => + PublicKey( + attestation: attestation ?? this.attestation, + authenticatorSelection: + authenticatorSelection ?? this.authenticatorSelection, + challenge: challenge ?? this.challenge, + excludeCredentials: excludeCredentials ?? this.excludeCredentials, + extensions: extensions ?? this.extensions, + pubKeyCredParams: pubKeyCredParams ?? this.pubKeyCredParams, + rp: rp ?? this.rp, + timeout: timeout ?? this.timeout, + user: user ?? this.user, + ); +} +/// Authenticator selection model class. +abstract class AuthenticatorSelectionModel { + /// Initializes Authenticator selection model class . + const AuthenticatorSelectionModel({ + this.authenticatorAttachment, + this.requireResidentKey, + this.userVerification, + }); + + /// Whether to allow cross platform authenticators (QR) or only the ones installed on the device itself. + final AuthenticatorAttachmentEnum? authenticatorAttachment; + + /// Ask the auth to save the passkey on the device. this will allow seamless login without the need to enter the user name. will be true always + final bool? requireResidentKey; + + /// Ask the user to enter thier authentication method (PIN, fingerprint, etc). Default is required. + final UserVerificationEnum? userVerification; +} + +/// Authenticator selection class. +class AuthenticatorSelection extends AuthenticatorSelectionModel { + /// Initializes Authenticator selection class. + const AuthenticatorSelection({ + super.authenticatorAttachment, + super.requireResidentKey, + super.userVerification, + }); + + /// Creates an instance from JSON. + factory AuthenticatorSelection.fromJson(Map json) => + AuthenticatorSelection( + authenticatorAttachment: json['authenticatorAttachment'] == null + ? null + : authenticatorAttachmentEnumMapper[ + json['authenticatorAttachment']], + requireResidentKey: getBool(json['requireResidentKey']), + userVerification: json['userVerification'] == null + ? null + : userVerificationEnumMapper[json['userVerification']], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['authenticatorAttachment'] = authenticatorAttachmentEnumMapper + .entries + .firstWhere((MapEntry entry) => + entry.value == authenticatorAttachment) + .key; + resultMap['requireResidentKey'] = requireResidentKey; + resultMap['userVerification'] = userVerificationEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == userVerification) + .key; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + AuthenticatorSelection copyWith({ + AuthenticatorAttachmentEnum? authenticatorAttachment, + bool? requireResidentKey, + UserVerificationEnum? userVerification, + }) => + AuthenticatorSelection( + authenticatorAttachment: + authenticatorAttachment ?? this.authenticatorAttachment, + requireResidentKey: requireResidentKey ?? this.requireResidentKey, + userVerification: userVerification ?? this.userVerification, + ); +} +/// Exclude credentials item model class. +abstract class ExcludeCredentialsItemModel { + /// Initializes Exclude credentials item model class . + const ExcludeCredentialsItemModel({ + this.id, + this.transports, + this.type, + }); + + /// The credential id. base64 encoded. + final String? id; + + /// The transports supported by the authenticator. + final List? transports; + + /// Will be always public-key. + final TypeEnum? type; +} + +/// Exclude credentials item class. +class ExcludeCredentialsItem extends ExcludeCredentialsItemModel { + /// Initializes Exclude credentials item class. + const ExcludeCredentialsItem({ + super.id, + super.transports, + super.type, + }); + + /// Creates an instance from JSON. + factory ExcludeCredentialsItem.fromJson(Map json) => + ExcludeCredentialsItem( + id: json['id'], + transports: json['transports'] == null + ? null + : List.from( + json['transports']?.map( + (dynamic item) => + item == null ? null : transportsItemEnumMapper[item], + ), + ), + type: json['type'] == null ? null : typeEnumMapper[json['type']], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['id'] = id; + if (transports != null) { + resultMap['transports'] = transports! + .map( + (TransportsItemEnum item) => transportsItemEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == item) + .key, + ) + .toList(); + } + resultMap['type'] = typeEnumMapper.entries + .firstWhere((MapEntry entry) => entry.value == type) + .key; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + ExcludeCredentialsItem copyWith({ + String? id, + List? transports, + TypeEnum? type, + }) => + ExcludeCredentialsItem( + id: id ?? this.id, + transports: transports ?? this.transports, + type: type ?? this.type, + ); +} +/// Pub key cred params item model class. +abstract class PubKeyCredParamsItemModel { + /// Initializes Pub key cred params item model class . + const PubKeyCredParamsItemModel({ + this.alg, + this.type, + }); + + /// Algorithm + final String? alg; + + /// Type + final String? type; +} + +/// Pub key cred params item class. +class PubKeyCredParamsItem extends PubKeyCredParamsItemModel { + /// Initializes Pub key cred params item class. + const PubKeyCredParamsItem({ + super.alg, + super.type, + }); + + /// Creates an instance from JSON. + factory PubKeyCredParamsItem.fromJson(Map json) => + PubKeyCredParamsItem( + alg: json['alg'], + type: json['type'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['alg'] = alg; + resultMap['type'] = type; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + PubKeyCredParamsItem copyWith({ + String? alg, + String? type, + }) => + PubKeyCredParamsItem( + alg: alg ?? this.alg, + type: type ?? this.type, + ); +} +/// Rp model class. +abstract class RpModel { + /// Initializes Rp model class . + const RpModel({ + this.id, + this.name, + }); + + /// Relying party id. + final String? id; + + /// Relying party name. + final String? name; +} + +/// Rp class. +class Rp extends RpModel { + /// Initializes Rp class. + const Rp({ + super.id, + super.name, + }); + + /// Creates an instance from JSON. + factory Rp.fromJson(Map json) => Rp( + id: json['id'], + name: json['name'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['id'] = id; + resultMap['name'] = name; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + Rp copyWith({ + String? id, + String? name, + }) => + Rp( + id: id ?? this.id, + name: name ?? this.name, + ); +} +/// User model class. +abstract class UserModel { + /// Initializes User model class . + const UserModel({ + this.displayName, + this.id, + this.name, + }); + + /// Display name of the user. will be email + final String? displayName; + + /// Binary user id + final int? id; + + /// Name of the user, will be email + final String? name; +} + +/// User class. +class User extends UserModel { + /// Initializes User class. + const User({ + super.displayName, + super.id, + super.name, + }); + + /// Creates an instance from JSON. + factory User.fromJson(Map json) => User( + displayName: json['displayName'], + id: json['id'], + name: json['name'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['displayName'] = displayName; + resultMap['id'] = id; + resultMap['name'] = name; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + User copyWith({ + String? displayName, + int? id, + String? name, + }) => + User( + displayName: displayName ?? this.displayName, + id: id ?? this.id, + name: name ?? this.name, + ); +} diff --git a/lib/api/response/passkeys_register_response_result.dart b/lib/api/response/passkeys_register_response_result.dart new file mode 100644 index 0000000000..6d0d2e8119 --- /dev/null +++ b/lib/api/response/passkeys_register_response_result.dart @@ -0,0 +1,139 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Passkeys register response model class. +abstract class PasskeysRegisterResponseModel { + /// Initializes Passkeys register response model class . + const PasskeysRegisterResponseModel({ + this.passkeysRegister, + }); + + /// Wrapper of the response. + final PasskeysRegister? passkeysRegister; +} + +/// Passkeys register response class. +class PasskeysRegisterResponse extends PasskeysRegisterResponseModel { + /// Initializes Passkeys register response class. + const PasskeysRegisterResponse({ + super.passkeysRegister, + }); + + /// Creates an instance from JSON. + factory PasskeysRegisterResponse.fromJson( + dynamic passkeysRegisterJson, + ) => + PasskeysRegisterResponse( + passkeysRegister: passkeysRegisterJson == null + ? null + : PasskeysRegister.fromJson(passkeysRegisterJson), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (passkeysRegister != null) { + resultMap['passkeys_register'] = passkeysRegister!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + PasskeysRegisterResponse copyWith({ + PasskeysRegister? passkeysRegister, + }) => + PasskeysRegisterResponse( + passkeysRegister: passkeysRegister ?? this.passkeysRegister, + ); +} +/// Passkeys register model class. +abstract class PasskeysRegisterModel { + /// Initializes Passkeys register model class . + const PasskeysRegisterModel({ + this.createdAt, + this.id, + this.lastUsed, + this.name, + this.passkeyId, + this.storedOn, + }); + + /// The epoch timestamp when the passkey was created. + final DateTime? createdAt; + + /// The system id of the stored passkey. + final int? id; + + /// The epoch timestamp that the key was last used to authenticate the user. + final DateTime? lastUsed; + + /// The descriptive name of the passkey. + final String? name; + + /// The id of the passkey credential. + final String? passkeyId; + + /// The name of the device where the credential is stored on. + final String? storedOn; +} + +/// Passkeys register class. +class PasskeysRegister extends PasskeysRegisterModel { + /// Initializes Passkeys register class. + const PasskeysRegister({ + super.createdAt, + super.id, + super.lastUsed, + super.name, + super.passkeyId, + super.storedOn, + }); + + /// Creates an instance from JSON. + factory PasskeysRegister.fromJson(Map json) => + PasskeysRegister( + createdAt: getDateTime(json['created_at']), + id: json['id'], + lastUsed: getDateTime(json['last_used']), + name: json['name'], + passkeyId: json['passkey_id'], + storedOn: json['stored_on'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['created_at'] = getSecondsSinceEpochDateTime(createdAt); + resultMap['id'] = id; + resultMap['last_used'] = getSecondsSinceEpochDateTime(lastUsed); + resultMap['name'] = name; + resultMap['passkey_id'] = passkeyId; + resultMap['stored_on'] = storedOn; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + PasskeysRegister copyWith({ + DateTime? createdAt, + int? id, + DateTime? lastUsed, + String? name, + String? passkeyId, + String? storedOn, + }) => + PasskeysRegister( + createdAt: createdAt ?? this.createdAt, + id: id ?? this.id, + lastUsed: lastUsed ?? this.lastUsed, + name: name ?? this.name, + passkeyId: passkeyId ?? this.passkeyId, + storedOn: storedOn ?? this.storedOn, + ); +} diff --git a/lib/api/response/passkeys_rename_response_result.dart b/lib/api/response/passkeys_rename_response_result.dart new file mode 100644 index 0000000000..f3355effeb --- /dev/null +++ b/lib/api/response/passkeys_rename_response_result.dart @@ -0,0 +1,49 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Passkeys rename response model class. +abstract class PasskeysRenameResponseModel { + /// Initializes Passkeys rename response model class . + const PasskeysRenameResponseModel({ + this.passkeysRename, + }); + + /// 1 on success + final int? passkeysRename; +} + +/// Passkeys rename response class. +class PasskeysRenameResponse extends PasskeysRenameResponseModel { + /// Initializes Passkeys rename response class. + const PasskeysRenameResponse({ + super.passkeysRename, + }); + + /// Creates an instance from JSON. + factory PasskeysRenameResponse.fromJson( + dynamic passkeysRenameJson, + ) => + PasskeysRenameResponse( + passkeysRename: passkeysRenameJson, + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['passkeys_rename'] = passkeysRename; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + PasskeysRenameResponse copyWith({ + int? passkeysRename, + }) => + PasskeysRenameResponse( + passkeysRename: passkeysRename ?? this.passkeysRename, + ); +} diff --git a/lib/api/response/passkeys_revoke_response_result.dart b/lib/api/response/passkeys_revoke_response_result.dart new file mode 100644 index 0000000000..7475682f99 --- /dev/null +++ b/lib/api/response/passkeys_revoke_response_result.dart @@ -0,0 +1,49 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Passkeys revoke response model class. +abstract class PasskeysRevokeResponseModel { + /// Initializes Passkeys revoke response model class . + const PasskeysRevokeResponseModel({ + this.passkeysRevoke, + }); + + /// 1 on success + final int? passkeysRevoke; +} + +/// Passkeys revoke response class. +class PasskeysRevokeResponse extends PasskeysRevokeResponseModel { + /// Initializes Passkeys revoke response class. + const PasskeysRevokeResponse({ + super.passkeysRevoke, + }); + + /// Creates an instance from JSON. + factory PasskeysRevokeResponse.fromJson( + dynamic passkeysRevokeJson, + ) => + PasskeysRevokeResponse( + passkeysRevoke: passkeysRevokeJson, + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['passkeys_revoke'] = passkeysRevoke; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + PasskeysRevokeResponse copyWith({ + int? passkeysRevoke, + }) => + PasskeysRevokeResponse( + passkeysRevoke: passkeysRevoke ?? this.passkeysRevoke, + ); +} diff --git a/lib/api/response/payment_methods_response_result.dart b/lib/api/response/payment_methods_response_result.dart index 7847473d31..c93613160c 100644 --- a/lib/api/response/payment_methods_response_result.dart +++ b/lib/api/response/payment_methods_response_result.dart @@ -24,10 +24,8 @@ abstract class PaymentMethodsResponseModel { class PaymentMethodsResponse extends PaymentMethodsResponseModel { /// Initializes Payment methods response class. const PaymentMethodsResponse({ - List? paymentMethods, - }) : super( - paymentMethods: paymentMethods, - ); + super.paymentMethods, + }); /// Creates an instance from JSON. factory PaymentMethodsResponse.fromJson( @@ -85,7 +83,6 @@ class PaymentMethodsResponse extends PaymentMethodsResponseModel { paymentMethods: paymentMethods ?? this.paymentMethods, ); } - /// Payment methods item model class. abstract class PaymentMethodsItemModel { /// Initializes Payment methods item model class . @@ -149,34 +146,20 @@ abstract class PaymentMethodsItemModel { class PaymentMethodsItem extends PaymentMethodsItemModel { /// Initializes Payment methods item class. const PaymentMethodsItem({ - required Map depositLimits, - required String depositTime, - required String description, - required String displayName, - required String id, - required String paymentProcessor, - required List predefinedAmounts, - required String signupLink, - required List supportedCurrencies, - required String type, - required String typeDisplayName, - required Map withdrawLimits, - required String withdrawalTime, - }) : super( - depositLimits: depositLimits, - depositTime: depositTime, - description: description, - displayName: displayName, - id: id, - paymentProcessor: paymentProcessor, - predefinedAmounts: predefinedAmounts, - signupLink: signupLink, - supportedCurrencies: supportedCurrencies, - type: type, - typeDisplayName: typeDisplayName, - withdrawLimits: withdrawLimits, - withdrawalTime: withdrawalTime, - ); + required super.depositLimits, + required super.depositTime, + required super.description, + required super.displayName, + required super.id, + required super.paymentProcessor, + required super.predefinedAmounts, + required super.signupLink, + required super.supportedCurrencies, + required super.type, + required super.typeDisplayName, + required super.withdrawLimits, + required super.withdrawalTime, + }); /// Creates an instance from JSON. factory PaymentMethodsItem.fromJson(Map json) => @@ -279,7 +262,6 @@ class PaymentMethodsItem extends PaymentMethodsItemModel { withdrawalTime: withdrawalTime ?? this.withdrawalTime, ); } - /// Deposit limits property model class. abstract class DepositLimitsPropertyModel { /// Initializes Deposit limits property model class . @@ -299,12 +281,9 @@ abstract class DepositLimitsPropertyModel { class DepositLimitsProperty extends DepositLimitsPropertyModel { /// Initializes Deposit limits property class. const DepositLimitsProperty({ - required int max, - required int min, - }) : super( - max: max, - min: min, - ); + required super.max, + required super.min, + }); /// Creates an instance from JSON. factory DepositLimitsProperty.fromJson(Map json) => @@ -333,7 +312,6 @@ class DepositLimitsProperty extends DepositLimitsPropertyModel { min: min ?? this.min, ); } - /// Withdraw limits property model class. abstract class WithdrawLimitsPropertyModel { /// Initializes Withdraw limits property model class . @@ -353,12 +331,9 @@ abstract class WithdrawLimitsPropertyModel { class WithdrawLimitsProperty extends WithdrawLimitsPropertyModel { /// Initializes Withdraw limits property class. const WithdrawLimitsProperty({ - required int max, - required int min, - }) : super( - max: max, - min: min, - ); + required super.max, + required super.min, + }); /// Creates an instance from JSON. factory WithdrawLimitsProperty.fromJson(Map json) => diff --git a/lib/api/response/paymentagent_details_response_result.dart b/lib/api/response/paymentagent_details_response_result.dart index 6acab3cf33..9f54ad73b7 100644 --- a/lib/api/response/paymentagent_details_response_result.dart +++ b/lib/api/response/paymentagent_details_response_result.dart @@ -18,10 +18,8 @@ abstract class PaymentagentDetailsResponseModel { class PaymentagentDetailsResponse extends PaymentagentDetailsResponseModel { /// Initializes Paymentagent details response class. const PaymentagentDetailsResponse({ - PaymentagentDetails? paymentagentDetails, - }) : super( - paymentagentDetails: paymentagentDetails, - ); + super.paymentagentDetails, + }); /// Creates an instance from JSON. factory PaymentagentDetailsResponse.fromJson( @@ -56,16 +54,18 @@ class PaymentagentDetailsResponse extends PaymentagentDetailsResponseModel { abstract class PaymentagentDetailsModel { /// Initializes Paymentagent details model class . const PaymentagentDetailsModel({ + required this.canApply, this.affiliateId, this.codeOfConductApproval, this.commissionDeposit, this.commissionWithdrawal, this.currencyCode, + this.eligibiltyValidation, this.email, this.information, - this.isListed, this.maxWithdrawal, this.minWithdrawal, + this.newlyAuthorized, this.paymentAgentName, this.phoneNumbers, this.status, @@ -74,6 +74,9 @@ abstract class PaymentagentDetailsModel { this.urls, }); + /// If `true`, the client may apply using paymentagent_create. + final bool canApply; + /// Client's My Affiliate id, if exists. final String? affiliateId; @@ -89,21 +92,24 @@ abstract class PaymentagentDetailsModel { /// Currency supported by the payment agent. It's usually the same as agent's Deriv account currency. final String? currencyCode; + /// Contains a list of error codes that would prevent a successful payment agent application. + final List? eligibiltyValidation; + /// Payment agent's email address. final String? email; /// Information about payment agent and their proposed service. final String? information; - /// Wether or not the client should be listed among available agents in the FE. - final bool? isListed; - /// Maximum amount allowed for withdrawals final double? maxWithdrawal; /// Minimum amount allowed for withdrawals final double? minWithdrawal; + /// Indicates if the payment agent was recently approved with no transactions yet. + final bool? newlyAuthorized; + /// The name with which the payment agent is going to be identified. final String? paymentAgentName; @@ -127,54 +133,47 @@ abstract class PaymentagentDetailsModel { class PaymentagentDetails extends PaymentagentDetailsModel { /// Initializes Paymentagent details class. const PaymentagentDetails({ - String? affiliateId, - bool? codeOfConductApproval, - double? commissionDeposit, - double? commissionWithdrawal, - String? currencyCode, - String? email, - String? information, - bool? isListed, - double? maxWithdrawal, - double? minWithdrawal, - String? paymentAgentName, - List? phoneNumbers, - Map? status, - List? supportedPaymentMethods, - String? targetCountry, - List? urls, - }) : super( - affiliateId: affiliateId, - codeOfConductApproval: codeOfConductApproval, - commissionDeposit: commissionDeposit, - commissionWithdrawal: commissionWithdrawal, - currencyCode: currencyCode, - email: email, - information: information, - isListed: isListed, - maxWithdrawal: maxWithdrawal, - minWithdrawal: minWithdrawal, - paymentAgentName: paymentAgentName, - phoneNumbers: phoneNumbers, - status: status, - supportedPaymentMethods: supportedPaymentMethods, - targetCountry: targetCountry, - urls: urls, - ); + required super.canApply, + super.affiliateId, + super.codeOfConductApproval, + super.commissionDeposit, + super.commissionWithdrawal, + super.currencyCode, + super.eligibiltyValidation, + super.email, + super.information, + super.maxWithdrawal, + super.minWithdrawal, + super.newlyAuthorized, + super.paymentAgentName, + super.phoneNumbers, + super.status, + super.supportedPaymentMethods, + super.targetCountry, + super.urls, + }); /// Creates an instance from JSON. factory PaymentagentDetails.fromJson(Map json) => PaymentagentDetails( + canApply: getBool(json['can_apply'])!, affiliateId: json['affiliate_id'], codeOfConductApproval: getBool(json['code_of_conduct_approval']), commissionDeposit: getDouble(json['commission_deposit']), commissionWithdrawal: getDouble(json['commission_withdrawal']), currencyCode: json['currency_code'], + eligibiltyValidation: json['eligibilty_validation'] == null + ? null + : List.from( + json['eligibilty_validation']?.map( + (dynamic item) => item, + ), + ), email: json['email'], information: json['information'], - isListed: getBool(json['is_listed']), maxWithdrawal: getDouble(json['max_withdrawal']), minWithdrawal: getDouble(json['min_withdrawal']), + newlyAuthorized: getBool(json['newly_authorized']), paymentAgentName: json['payment_agent_name'], phoneNumbers: json['phone_numbers'] == null ? null @@ -205,16 +204,24 @@ class PaymentagentDetails extends PaymentagentDetailsModel { Map toJson() { final Map resultMap = {}; + resultMap['can_apply'] = canApply; resultMap['affiliate_id'] = affiliateId; resultMap['code_of_conduct_approval'] = codeOfConductApproval; resultMap['commission_deposit'] = commissionDeposit; resultMap['commission_withdrawal'] = commissionWithdrawal; resultMap['currency_code'] = currencyCode; + if (eligibiltyValidation != null) { + resultMap['eligibilty_validation'] = eligibiltyValidation! + .map( + (String item) => item, + ) + .toList(); + } resultMap['email'] = email; resultMap['information'] = information; - resultMap['is_listed'] = isListed; resultMap['max_withdrawal'] = maxWithdrawal; resultMap['min_withdrawal'] = minWithdrawal; + resultMap['newly_authorized'] = newlyAuthorized; resultMap['payment_agent_name'] = paymentAgentName; if (phoneNumbers != null) { resultMap['phone_numbers'] = phoneNumbers! @@ -245,16 +252,18 @@ class PaymentagentDetails extends PaymentagentDetailsModel { /// Creates a copy of instance with given parameters. PaymentagentDetails copyWith({ + bool? canApply, String? affiliateId, bool? codeOfConductApproval, double? commissionDeposit, double? commissionWithdrawal, String? currencyCode, + List? eligibiltyValidation, String? email, String? information, - bool? isListed, double? maxWithdrawal, double? minWithdrawal, + bool? newlyAuthorized, String? paymentAgentName, List? phoneNumbers, Map? status, @@ -263,17 +272,19 @@ class PaymentagentDetails extends PaymentagentDetailsModel { List? urls, }) => PaymentagentDetails( + canApply: canApply ?? this.canApply, affiliateId: affiliateId ?? this.affiliateId, codeOfConductApproval: codeOfConductApproval ?? this.codeOfConductApproval, commissionDeposit: commissionDeposit ?? this.commissionDeposit, commissionWithdrawal: commissionWithdrawal ?? this.commissionWithdrawal, currencyCode: currencyCode ?? this.currencyCode, + eligibiltyValidation: eligibiltyValidation ?? this.eligibiltyValidation, email: email ?? this.email, information: information ?? this.information, - isListed: isListed ?? this.isListed, maxWithdrawal: maxWithdrawal ?? this.maxWithdrawal, minWithdrawal: minWithdrawal ?? this.minWithdrawal, + newlyAuthorized: newlyAuthorized ?? this.newlyAuthorized, paymentAgentName: paymentAgentName ?? this.paymentAgentName, phoneNumbers: phoneNumbers ?? this.phoneNumbers, status: status ?? this.status, @@ -298,10 +309,8 @@ abstract class PhoneNumbersItemModel { class PhoneNumbersItem extends PhoneNumbersItemModel { /// Initializes Phone numbers item class. const PhoneNumbersItem({ - String? phoneNumber, - }) : super( - phoneNumber: phoneNumber, - ); + super.phoneNumber, + }); /// Creates an instance from JSON. factory PhoneNumbersItem.fromJson(Map json) => @@ -341,10 +350,8 @@ abstract class SupportedPaymentMethodsItemModel { class SupportedPaymentMethodsItem extends SupportedPaymentMethodsItemModel { /// Initializes Supported payment methods item class. const SupportedPaymentMethodsItem({ - String? paymentMethod, - }) : super( - paymentMethod: paymentMethod, - ); + super.paymentMethod, + }); /// Creates an instance from JSON. factory SupportedPaymentMethodsItem.fromJson(Map json) => @@ -384,10 +391,8 @@ abstract class UrlsItemModel { class UrlsItem extends UrlsItemModel { /// Initializes Urls item class. const UrlsItem({ - String? url, - }) : super( - url: url, - ); + super.url, + }); /// Creates an instance from JSON. factory UrlsItem.fromJson(Map json) => UrlsItem( diff --git a/lib/api/response/paymentagent_list_response_result.dart b/lib/api/response/paymentagent_list_response_result.dart index fd0c3f7d7b..cdc5822ffc 100644 --- a/lib/api/response/paymentagent_list_response_result.dart +++ b/lib/api/response/paymentagent_list_response_result.dart @@ -25,10 +25,8 @@ abstract class PaymentagentListResponseModel { class PaymentagentListResponse extends PaymentagentListResponseModel { /// Initializes Paymentagent list response class. const PaymentagentListResponse({ - PaymentagentList? paymentagentList, - }) : super( - paymentagentList: paymentagentList, - ); + super.paymentagentList, + }); /// Creates an instance from JSON. factory PaymentagentListResponse.fromJson( @@ -79,7 +77,6 @@ class PaymentagentListResponse extends PaymentagentListResponseModel { paymentagentList: paymentagentList ?? this.paymentagentList, ); } - /// Paymentagent list model class. abstract class PaymentagentListModel { /// Initializes Paymentagent list model class . @@ -99,12 +96,9 @@ abstract class PaymentagentListModel { class PaymentagentList extends PaymentagentListModel { /// Initializes Paymentagent list class. const PaymentagentList({ - required List list, - List>? availableCountries, - }) : super( - list: list, - availableCountries: availableCountries, - ); + required super.list, + super.availableCountries, + }); /// Creates an instance from JSON. factory PaymentagentList.fromJson(Map json) => @@ -162,7 +156,6 @@ class PaymentagentList extends PaymentagentListModel { availableCountries: availableCountries ?? this.availableCountries, ); } - /// List item model class. abstract class ListItemModel { /// Initializes List item model class . @@ -226,34 +219,20 @@ abstract class ListItemModel { class ListItem extends ListItemModel { /// Initializes List item class. const ListItem({ - required String currencies, - required String depositCommission, - required String email, - required String furtherInformation, - required String name, - required String paymentagentLoginid, - required List phoneNumbers, - required String summary, - required List supportedPaymentMethods, - required List urls, - required String withdrawalCommission, - String? maxWithdrawal, - String? minWithdrawal, - }) : super( - currencies: currencies, - depositCommission: depositCommission, - email: email, - furtherInformation: furtherInformation, - name: name, - paymentagentLoginid: paymentagentLoginid, - phoneNumbers: phoneNumbers, - summary: summary, - supportedPaymentMethods: supportedPaymentMethods, - urls: urls, - withdrawalCommission: withdrawalCommission, - maxWithdrawal: maxWithdrawal, - minWithdrawal: minWithdrawal, - ); + required super.currencies, + required super.depositCommission, + required super.email, + required super.furtherInformation, + required super.name, + required super.paymentagentLoginid, + required super.phoneNumbers, + required super.summary, + required super.supportedPaymentMethods, + required super.urls, + required super.withdrawalCommission, + super.maxWithdrawal, + super.minWithdrawal, + }); /// Creates an instance from JSON. factory ListItem.fromJson(Map json) => ListItem( @@ -353,7 +332,6 @@ class ListItem extends ListItemModel { minWithdrawal: minWithdrawal ?? this.minWithdrawal, ); } - /// Phone numbers item model class. abstract class PhoneNumbersItemModel { /// Initializes Phone numbers item model class . @@ -369,10 +347,8 @@ abstract class PhoneNumbersItemModel { class PhoneNumbersItem extends PhoneNumbersItemModel { /// Initializes Phone numbers item class. const PhoneNumbersItem({ - String? phoneNumber, - }) : super( - phoneNumber: phoneNumber, - ); + super.phoneNumber, + }); /// Creates an instance from JSON. factory PhoneNumbersItem.fromJson(Map json) => @@ -397,7 +373,6 @@ class PhoneNumbersItem extends PhoneNumbersItemModel { phoneNumber: phoneNumber ?? this.phoneNumber, ); } - /// Supported payment methods item model class. abstract class SupportedPaymentMethodsItemModel { /// Initializes Supported payment methods item model class . @@ -413,10 +388,8 @@ abstract class SupportedPaymentMethodsItemModel { class SupportedPaymentMethodsItem extends SupportedPaymentMethodsItemModel { /// Initializes Supported payment methods item class. const SupportedPaymentMethodsItem({ - String? paymentMethod, - }) : super( - paymentMethod: paymentMethod, - ); + super.paymentMethod, + }); /// Creates an instance from JSON. factory SupportedPaymentMethodsItem.fromJson(Map json) => @@ -441,7 +414,6 @@ class SupportedPaymentMethodsItem extends SupportedPaymentMethodsItemModel { paymentMethod: paymentMethod ?? this.paymentMethod, ); } - /// Urls item model class. abstract class UrlsItemModel { /// Initializes Urls item model class . @@ -457,10 +429,8 @@ abstract class UrlsItemModel { class UrlsItem extends UrlsItemModel { /// Initializes Urls item class. const UrlsItem({ - String? url, - }) : super( - url: url, - ); + super.url, + }); /// Creates an instance from JSON. factory UrlsItem.fromJson(Map json) => UrlsItem( diff --git a/lib/api/response/paymentagent_transfer_response_result.dart b/lib/api/response/paymentagent_transfer_response_result.dart index 5367e3d2f9..fbac5cfe9e 100644 --- a/lib/api/response/paymentagent_transfer_response_result.dart +++ b/lib/api/response/paymentagent_transfer_response_result.dart @@ -37,16 +37,11 @@ abstract class PaymentagentTransferResponseModel { class PaymentagentTransferResponse extends PaymentagentTransferResponseModel { /// Initializes Paymentagent transfer response class. const PaymentagentTransferResponse({ - int? paymentagentTransfer, - String? clientToFullName, - String? clientToLoginid, - int? transactionId, - }) : super( - paymentagentTransfer: paymentagentTransfer, - clientToFullName: clientToFullName, - clientToLoginid: clientToLoginid, - transactionId: transactionId, - ); + super.paymentagentTransfer, + super.clientToFullName, + super.clientToLoginid, + super.transactionId, + }); /// Creates an instance from JSON. factory PaymentagentTransferResponse.fromJson( diff --git a/lib/api/response/paymentagent_withdraw_justification_response_result.dart b/lib/api/response/paymentagent_withdraw_justification_response_result.dart new file mode 100644 index 0000000000..c03f4cd1d5 --- /dev/null +++ b/lib/api/response/paymentagent_withdraw_justification_response_result.dart @@ -0,0 +1,53 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Paymentagent withdraw justification response model class. +abstract class PaymentagentWithdrawJustificationResponseModel { + /// Initializes Paymentagent withdraw justification response model class . + const PaymentagentWithdrawJustificationResponseModel({ + this.paymentagentWithdrawJustification, + }); + + /// 1 on success + final int? paymentagentWithdrawJustification; +} + +/// Paymentagent withdraw justification response class. +class PaymentagentWithdrawJustificationResponse + extends PaymentagentWithdrawJustificationResponseModel { + /// Initializes Paymentagent withdraw justification response class. + const PaymentagentWithdrawJustificationResponse({ + super.paymentagentWithdrawJustification, + }); + + /// Creates an instance from JSON. + factory PaymentagentWithdrawJustificationResponse.fromJson( + dynamic paymentagentWithdrawJustificationJson, + ) => + PaymentagentWithdrawJustificationResponse( + paymentagentWithdrawJustification: + paymentagentWithdrawJustificationJson, + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['paymentagent_withdraw_justification'] = + paymentagentWithdrawJustification; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + PaymentagentWithdrawJustificationResponse copyWith({ + int? paymentagentWithdrawJustification, + }) => + PaymentagentWithdrawJustificationResponse( + paymentagentWithdrawJustification: paymentagentWithdrawJustification ?? + this.paymentagentWithdrawJustification, + ); +} diff --git a/lib/api/response/paymentagent_withdraw_response_result.dart b/lib/api/response/paymentagent_withdraw_response_result.dart index e416a89f67..7c5a08424c 100644 --- a/lib/api/response/paymentagent_withdraw_response_result.dart +++ b/lib/api/response/paymentagent_withdraw_response_result.dart @@ -33,14 +33,10 @@ abstract class PaymentagentWithdrawResponseModel { class PaymentagentWithdrawResponse extends PaymentagentWithdrawResponseModel { /// Initializes Paymentagent withdraw response class. const PaymentagentWithdrawResponse({ - int? paymentagentWithdraw, - String? paymentagentName, - int? transactionId, - }) : super( - paymentagentWithdraw: paymentagentWithdraw, - paymentagentName: paymentagentName, - transactionId: transactionId, - ); + super.paymentagentWithdraw, + super.paymentagentName, + super.transactionId, + }); /// Creates an instance from JSON. factory PaymentagentWithdrawResponse.fromJson( diff --git a/lib/api/response/payout_currencies_response_result.dart b/lib/api/response/payout_currencies_response_result.dart index 3186bf5fa8..f1ac4b6dfd 100644 --- a/lib/api/response/payout_currencies_response_result.dart +++ b/lib/api/response/payout_currencies_response_result.dart @@ -25,10 +25,8 @@ abstract class PayoutCurrenciesResponseModel { class PayoutCurrenciesResponse extends PayoutCurrenciesResponseModel { /// Initializes Payout currencies response class. const PayoutCurrenciesResponse({ - List? payoutCurrencies, - }) : super( - payoutCurrencies: payoutCurrencies, - ); + super.payoutCurrencies, + }); /// Creates an instance from JSON. factory PayoutCurrenciesResponse.fromJson( diff --git a/lib/api/response/ping_response_result.dart b/lib/api/response/ping_response_result.dart index d9cd881e22..47e863e64e 100644 --- a/lib/api/response/ping_response_result.dart +++ b/lib/api/response/ping_response_result.dart @@ -25,10 +25,8 @@ abstract class PingResponseModel { class PingResponse extends PingResponseModel { /// Initializes Ping response class. const PingResponse({ - PingEnum? ping, - }) : super( - ping: ping, - ); + super.ping, + }); /// Creates an instance from JSON. factory PingResponse.fromJson( diff --git a/lib/api/response/portfolio_response_result.dart b/lib/api/response/portfolio_response_result.dart index 86e4e44e9c..b519748208 100644 --- a/lib/api/response/portfolio_response_result.dart +++ b/lib/api/response/portfolio_response_result.dart @@ -25,10 +25,8 @@ abstract class PortfolioResponseModel { class PortfolioResponse extends PortfolioResponseModel { /// Initializes Portfolio response class. const PortfolioResponse({ - Portfolio? portfolio, - }) : super( - portfolio: portfolio, - ); + super.portfolio, + }); /// Creates an instance from JSON. factory PortfolioResponse.fromJson( @@ -76,7 +74,6 @@ class PortfolioResponse extends PortfolioResponseModel { portfolio: portfolio ?? this.portfolio, ); } - /// Portfolio model class. abstract class PortfolioModel { /// Initializes Portfolio model class . @@ -92,10 +89,8 @@ abstract class PortfolioModel { class Portfolio extends PortfolioModel { /// Initializes Portfolio class. const Portfolio({ - required List contracts, - }) : super( - contracts: contracts, - ); + required super.contracts, + }); /// Creates an instance from JSON. factory Portfolio.fromJson(Map json) => Portfolio( @@ -127,7 +122,6 @@ class Portfolio extends PortfolioModel { contracts: contracts ?? this.contracts, ); } - /// Contracts item model class. abstract class ContractsItemModel { /// Initializes Contracts item model class . @@ -191,34 +185,20 @@ abstract class ContractsItemModel { class ContractsItem extends ContractsItemModel { /// Initializes Contracts item class. const ContractsItem({ - int? appId, - double? buyPrice, - int? contractId, - String? contractType, - String? currency, - DateTime? dateStart, - DateTime? expiryTime, - String? longcode, - double? payout, - DateTime? purchaseTime, - String? shortcode, - String? symbol, - int? transactionId, - }) : super( - appId: appId, - buyPrice: buyPrice, - contractId: contractId, - contractType: contractType, - currency: currency, - dateStart: dateStart, - expiryTime: expiryTime, - longcode: longcode, - payout: payout, - purchaseTime: purchaseTime, - shortcode: shortcode, - symbol: symbol, - transactionId: transactionId, - ); + super.appId, + super.buyPrice, + super.contractId, + super.contractType, + super.currency, + super.dateStart, + super.expiryTime, + super.longcode, + super.payout, + super.purchaseTime, + super.shortcode, + super.symbol, + super.transactionId, + }); /// Creates an instance from JSON. factory ContractsItem.fromJson(Map json) => ContractsItem( diff --git a/lib/api/response/profit_table_response_result.dart b/lib/api/response/profit_table_response_result.dart index a7b41e48e5..fd855dcb63 100644 --- a/lib/api/response/profit_table_response_result.dart +++ b/lib/api/response/profit_table_response_result.dart @@ -1,14 +1,14 @@ // ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import -import 'package:deriv_dependency_injector/dependency_injector.dart'; import 'package:equatable/equatable.dart'; + import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/basic_api/generated/profit_table_receive.dart'; import 'package:flutter_deriv_api/basic_api/generated/profit_table_send.dart'; import 'package:flutter_deriv_api/helpers/helpers.dart'; import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; - +import 'package:deriv_dependency_injector/dependency_injector.dart'; /// Profit table response model class. abstract class ProfitTableResponseModel { /// Initializes Profit table response model class . @@ -24,10 +24,8 @@ abstract class ProfitTableResponseModel { class ProfitTableResponse extends ProfitTableResponseModel { /// Initializes Profit table response class. const ProfitTableResponse({ - ProfitTable? profitTable, - }) : super( - profitTable: profitTable, - ); + super.profitTable, + }); /// Creates an instance from JSON. factory ProfitTableResponse.fromJson( @@ -76,7 +74,6 @@ class ProfitTableResponse extends ProfitTableResponseModel { profitTable: profitTable ?? this.profitTable, ); } - /// Profit table model class. abstract class ProfitTableModel { /// Initializes Profit table model class . @@ -96,12 +93,9 @@ abstract class ProfitTableModel { class ProfitTable extends ProfitTableModel { /// Initializes Profit table class. const ProfitTable({ - double? count, - List? transactions, - }) : super( - count: count, - transactions: transactions, - ); + super.count, + super.transactions, + }); /// Creates an instance from JSON. factory ProfitTable.fromJson(Map json) => ProfitTable( @@ -141,7 +135,6 @@ class ProfitTable extends ProfitTableModel { transactions: transactions ?? this.transactions, ); } - /// Transactions item model class. abstract class TransactionsItemModel { /// Initializes Transactions item model class . @@ -149,8 +142,12 @@ abstract class TransactionsItemModel { this.appId, this.buyPrice, this.contractId, + this.contractType, + this.dealCancellationDuration, this.durationType, + this.growthRate, this.longcode, + this.multiplier, this.payout, this.purchaseTime, this.sellPrice, @@ -158,10 +155,6 @@ abstract class TransactionsItemModel { this.shortcode, this.transactionId, this.underlyingSymbol, - this.contractType, - this.dealCancellationDuration, - this.multiplier, - this.growthRate, }); /// ID of the application where this contract was purchased. @@ -173,12 +166,24 @@ abstract class TransactionsItemModel { /// The unique contract identifier. final int? contractId; - /// The duration type of the contract. + /// [Optional] The contract type for the transaction if description is set to 1. + final String? contractType; + + /// [Optional] Duration set for deal cancellation for Multiplier contracts in synthetic indices if description is set to 1. + final String? dealCancellationDuration; + + /// [Optional] The duration type of the contract if description is set to 1. final String? durationType; - /// The description of contract purchased if description is set to 1 + /// [Optional] The growth rate for Accumulators contract if description is set to 1. + final String? growthRate; + + /// [Optional] The description of contract purchased if description is set to 1 final String? longcode; + /// [Optional] The multiplier for Multiplier contracts if description is set to 1. + final String? multiplier; + /// Payout price final double? payout; @@ -191,66 +196,37 @@ abstract class TransactionsItemModel { /// Epoch sell time of the transaction final DateTime? sellTime; - /// Compact description of the contract purchased if description is set to 1 + /// [Optional] Compact description of the contract purchased if description is set to 1 final String? shortcode; /// The transaction Identifier. Every contract (buy or sell) and every payment has a unique transaction identifier. final int? transactionId; - /// The underlying symbol for the contract. + /// [Optional] Symbol code if description is set to 1 final String? underlyingSymbol; - - /// The contract type. - final String? contractType; - - /// The duration to cancel the contract. - final String? dealCancellationDuration; - - /// The multiplier. - final String? multiplier; - - /// The growth rate. - final String? growthRate; } /// Transactions item class. class TransactionsItem extends TransactionsItemModel { /// Initializes Transactions item class. const TransactionsItem({ - int? appId, - double? buyPrice, - int? contractId, - String? durationType, - String? longcode, - double? payout, - DateTime? purchaseTime, - double? sellPrice, - DateTime? sellTime, - String? shortcode, - int? transactionId, - String? underlyingSymbol, - String? contractType, - String? dealCancellationDuration, - String? multiplier, - String? growthRate, - }) : super( - appId: appId, - buyPrice: buyPrice, - contractId: contractId, - durationType: durationType, - longcode: longcode, - payout: payout, - purchaseTime: purchaseTime, - sellPrice: sellPrice, - sellTime: sellTime, - shortcode: shortcode, - transactionId: transactionId, - underlyingSymbol: underlyingSymbol, - contractType: contractType, - dealCancellationDuration: dealCancellationDuration, - multiplier: multiplier, - growthRate: growthRate, - ); + super.appId, + super.buyPrice, + super.contractId, + super.contractType, + super.dealCancellationDuration, + super.durationType, + super.growthRate, + super.longcode, + super.multiplier, + super.payout, + super.purchaseTime, + super.sellPrice, + super.sellTime, + super.shortcode, + super.transactionId, + super.underlyingSymbol, + }); /// Creates an instance from JSON. factory TransactionsItem.fromJson(Map json) => @@ -258,8 +234,12 @@ class TransactionsItem extends TransactionsItemModel { appId: json['app_id'], buyPrice: getDouble(json['buy_price']), contractId: json['contract_id'], + contractType: json['contract_type'], + dealCancellationDuration: json['deal_cancellation_duration'], durationType: json['duration_type'], + growthRate: json['growth_rate'], longcode: json['longcode'], + multiplier: json['multiplier'], payout: getDouble(json['payout']), purchaseTime: getDateTime(json['purchase_time']), sellPrice: getDouble(json['sell_price']), @@ -267,10 +247,6 @@ class TransactionsItem extends TransactionsItemModel { shortcode: json['shortcode'], transactionId: json['transaction_id'], underlyingSymbol: json['underlying_symbol'], - contractType: json['contract_type'], - dealCancellationDuration: json['deal_cancellation_duration'], - multiplier: json['multiplier'], - growthRate: json['growth_rate'], ); /// Converts an instance to JSON. @@ -280,14 +256,19 @@ class TransactionsItem extends TransactionsItemModel { resultMap['app_id'] = appId; resultMap['buy_price'] = buyPrice; resultMap['contract_id'] = contractId; + resultMap['contract_type'] = contractType; + resultMap['deal_cancellation_duration'] = dealCancellationDuration; resultMap['duration_type'] = durationType; + resultMap['growth_rate'] = growthRate; resultMap['longcode'] = longcode; + resultMap['multiplier'] = multiplier; resultMap['payout'] = payout; resultMap['purchase_time'] = getSecondsSinceEpochDateTime(purchaseTime); resultMap['sell_price'] = sellPrice; resultMap['sell_time'] = getSecondsSinceEpochDateTime(sellTime); resultMap['shortcode'] = shortcode; resultMap['transaction_id'] = transactionId; + resultMap['underlying_symbol'] = underlyingSymbol; return resultMap; } @@ -297,26 +278,37 @@ class TransactionsItem extends TransactionsItemModel { int? appId, double? buyPrice, int? contractId, + String? contractType, + String? dealCancellationDuration, String? durationType, + String? growthRate, String? longcode, + String? multiplier, double? payout, DateTime? purchaseTime, double? sellPrice, DateTime? sellTime, String? shortcode, int? transactionId, + String? underlyingSymbol, }) => TransactionsItem( appId: appId ?? this.appId, buyPrice: buyPrice ?? this.buyPrice, contractId: contractId ?? this.contractId, + contractType: contractType ?? this.contractType, + dealCancellationDuration: + dealCancellationDuration ?? this.dealCancellationDuration, durationType: durationType ?? this.durationType, + growthRate: growthRate ?? this.growthRate, longcode: longcode ?? this.longcode, + multiplier: multiplier ?? this.multiplier, payout: payout ?? this.payout, purchaseTime: purchaseTime ?? this.purchaseTime, sellPrice: sellPrice ?? this.sellPrice, sellTime: sellTime ?? this.sellTime, shortcode: shortcode ?? this.shortcode, transactionId: transactionId ?? this.transactionId, + underlyingSymbol: underlyingSymbol ?? this.underlyingSymbol, ); } diff --git a/lib/api/response/proposal_open_contract_response_result.dart b/lib/api/response/proposal_open_contract_response_result.dart index 35823a6354..d13095390b 100644 --- a/lib/api/response/proposal_open_contract_response_result.dart +++ b/lib/api/response/proposal_open_contract_response_result.dart @@ -271,6 +271,8 @@ abstract class ProposalOpenContractModel { this.purchaseTime, this.resetBarrier, this.resetTime, + this.selectedSpot, + this.selectedTick, this.sellPrice, this.sellSpot, this.sellSpotDisplayValue, @@ -452,6 +454,12 @@ abstract class ProposalOpenContractModel { /// [Only for reset trades i.e. RESETCALL and RESETPUT] The epoch time of a barrier reset. final DateTime? resetTime; + /// Spot value at the selected tick for the contract. + final double? selectedSpot; + + /// [Only for highlowticks trades i.e. TICKHIGH and TICKLOW] Selected tick for the contract. + final int? selectedTick; + /// Price at which contract was sold, only available when contract has been sold. final double? sellPrice; @@ -554,6 +562,8 @@ class ProposalOpenContract extends ProposalOpenContractModel { super.purchaseTime, super.resetBarrier, super.resetTime, + super.selectedSpot, + super.selectedTick, super.sellPrice, super.sellSpot, super.sellSpotDisplayValue, @@ -634,6 +644,8 @@ class ProposalOpenContract extends ProposalOpenContractModel { purchaseTime: getDateTime(json['purchase_time']), resetBarrier: json['reset_barrier'], resetTime: getDateTime(json['reset_time']), + selectedSpot: getDouble(json['selected_spot']), + selectedTick: json['selected_tick'], sellPrice: getDouble(json['sell_price']), sellSpot: getDouble(json['sell_spot']), sellSpotDisplayValue: json['sell_spot_display_value'], @@ -725,6 +737,8 @@ class ProposalOpenContract extends ProposalOpenContractModel { resultMap['purchase_time'] = getSecondsSinceEpochDateTime(purchaseTime); resultMap['reset_barrier'] = resetBarrier; resultMap['reset_time'] = getSecondsSinceEpochDateTime(resetTime); + resultMap['selected_spot'] = selectedSpot; + resultMap['selected_tick'] = selectedTick; resultMap['sell_price'] = sellPrice; resultMap['sell_spot'] = sellSpot; resultMap['sell_spot_display_value'] = sellSpotDisplayValue; @@ -811,6 +825,8 @@ class ProposalOpenContract extends ProposalOpenContractModel { DateTime? purchaseTime, String? resetBarrier, DateTime? resetTime, + double? selectedSpot, + int? selectedTick, double? sellPrice, double? sellSpot, String? sellSpotDisplayValue, @@ -888,6 +904,8 @@ class ProposalOpenContract extends ProposalOpenContractModel { purchaseTime: purchaseTime ?? this.purchaseTime, resetBarrier: resetBarrier ?? this.resetBarrier, resetTime: resetTime ?? this.resetTime, + selectedSpot: selectedSpot ?? this.selectedSpot, + selectedTick: selectedTick ?? this.selectedTick, sellPrice: sellPrice ?? this.sellPrice, sellSpot: sellSpot ?? this.sellSpot, sellSpotDisplayValue: sellSpotDisplayValue ?? this.sellSpotDisplayValue, diff --git a/lib/api/response/reality_check_response_result.dart b/lib/api/response/reality_check_response_result.dart index e2e438b247..bf35c30235 100644 --- a/lib/api/response/reality_check_response_result.dart +++ b/lib/api/response/reality_check_response_result.dart @@ -25,10 +25,8 @@ abstract class RealityCheckResponseModel { class RealityCheckResponse extends RealityCheckResponseModel { /// Initializes Reality check response class. const RealityCheckResponse({ - RealityCheck? realityCheck, - }) : super( - realityCheck: realityCheck, - ); + super.realityCheck, + }); /// Creates an instance from JSON. factory RealityCheckResponse.fromJson( @@ -83,7 +81,6 @@ class RealityCheckResponse extends RealityCheckResponseModel { realityCheck: realityCheck ?? this.realityCheck, ); } - /// Reality check model class. abstract class RealityCheckModel { /// Initializes Reality check model class . @@ -131,26 +128,16 @@ abstract class RealityCheckModel { class RealityCheck extends RealityCheckModel { /// Initializes Reality check class. const RealityCheck({ - double? buyAmount, - int? buyCount, - String? currency, - String? loginid, - int? openContractCount, - double? potentialProfit, - double? sellAmount, - int? sellCount, - DateTime? startTime, - }) : super( - buyAmount: buyAmount, - buyCount: buyCount, - currency: currency, - loginid: loginid, - openContractCount: openContractCount, - potentialProfit: potentialProfit, - sellAmount: sellAmount, - sellCount: sellCount, - startTime: startTime, - ); + super.buyAmount, + super.buyCount, + super.currency, + super.loginid, + super.openContractCount, + super.potentialProfit, + super.sellAmount, + super.sellCount, + super.startTime, + }); /// Creates an instance from JSON. factory RealityCheck.fromJson(Map json) => RealityCheck( diff --git a/lib/api/response/request_report_response_result.dart b/lib/api/response/request_report_response_result.dart index 1da38cd71f..c3ecfc8376 100644 --- a/lib/api/response/request_report_response_result.dart +++ b/lib/api/response/request_report_response_result.dart @@ -19,10 +19,8 @@ abstract class RequestReportResponseModel { class RequestReportResponse extends RequestReportResponseModel { /// Initializes Request report response class. const RequestReportResponse({ - RequestReport? requestReport, - }) : super( - requestReport: requestReport, - ); + super.requestReport, + }); /// Creates an instance from JSON. factory RequestReportResponse.fromJson( @@ -68,10 +66,8 @@ abstract class RequestReportModel { class RequestReport extends RequestReportModel { /// Initializes Request report class. const RequestReport({ - int? reportStatus, - }) : super( - reportStatus: reportStatus, - ); + super.reportStatus, + }); /// Creates an instance from JSON. factory RequestReport.fromJson(Map json) => RequestReport( diff --git a/lib/api/response/reset_password_response_result.dart b/lib/api/response/reset_password_response_result.dart index 12100483f2..45913f001b 100644 --- a/lib/api/response/reset_password_response_result.dart +++ b/lib/api/response/reset_password_response_result.dart @@ -24,10 +24,8 @@ abstract class ResetPasswordResponseModel { class ResetPasswordResponse extends ResetPasswordResponseModel { /// Initializes Reset password response class. const ResetPasswordResponse({ - bool? resetPassword, - }) : super( - resetPassword: resetPassword, - ); + super.resetPassword, + }); /// Creates an instance from JSON. factory ResetPasswordResponse.fromJson( diff --git a/lib/api/response/revoke_oauth_app_response_result.dart b/lib/api/response/revoke_oauth_app_response_result.dart index ab6cda2c65..82103f003f 100644 --- a/lib/api/response/revoke_oauth_app_response_result.dart +++ b/lib/api/response/revoke_oauth_app_response_result.dart @@ -25,10 +25,8 @@ abstract class RevokeOauthAppResponseModel { class RevokeOauthAppResponse extends RevokeOauthAppResponseModel { /// Initializes Revoke oauth app response class. const RevokeOauthAppResponse({ - int? revokeOauthApp, - }) : super( - revokeOauthApp: revokeOauthApp, - ); + super.revokeOauthApp, + }); /// Creates an instance from JSON. factory RevokeOauthAppResponse.fromJson( diff --git a/lib/api/response/sell_contract_for_multiple_accounts_response_result.dart b/lib/api/response/sell_contract_for_multiple_accounts_response_result.dart index d36b026740..9823461f00 100644 --- a/lib/api/response/sell_contract_for_multiple_accounts_response_result.dart +++ b/lib/api/response/sell_contract_for_multiple_accounts_response_result.dart @@ -19,10 +19,8 @@ class SellContractForMultipleAccountsResponse extends SellContractForMultipleAccountsResponseModel { /// Initializes Sell contract for multiple accounts response class. const SellContractForMultipleAccountsResponse({ - SellContractForMultipleAccounts? sellContractForMultipleAccounts, - }) : super( - sellContractForMultipleAccounts: sellContractForMultipleAccounts, - ); + super.sellContractForMultipleAccounts, + }); /// Creates an instance from JSON. factory SellContractForMultipleAccountsResponse.fromJson( @@ -73,10 +71,8 @@ class SellContractForMultipleAccounts extends SellContractForMultipleAccountsModel { /// Initializes Sell contract for multiple accounts class. const SellContractForMultipleAccounts({ - List>? result, - }) : super( - result: result, - ); + super.result, + }); /// Creates an instance from JSON. factory SellContractForMultipleAccounts.fromJson(Map json) => diff --git a/lib/api/response/sell_expired_response_result.dart b/lib/api/response/sell_expired_response_result.dart index dddfd0fcbd..e84c287b30 100644 --- a/lib/api/response/sell_expired_response_result.dart +++ b/lib/api/response/sell_expired_response_result.dart @@ -18,10 +18,8 @@ abstract class SellExpiredResponseModel { class SellExpiredResponse extends SellExpiredResponseModel { /// Initializes Sell expired response class. const SellExpiredResponse({ - SellExpired? sellExpired, - }) : super( - sellExpired: sellExpired, - ); + super.sellExpired, + }); /// Creates an instance from JSON. factory SellExpiredResponse.fromJson( @@ -67,10 +65,8 @@ abstract class SellExpiredModel { class SellExpired extends SellExpiredModel { /// Initializes Sell expired class. const SellExpired({ - int? count, - }) : super( - count: count, - ); + super.count, + }); /// Creates an instance from JSON. factory SellExpired.fromJson(Map json) => SellExpired( diff --git a/lib/api/response/sell_response_result.dart b/lib/api/response/sell_response_result.dart index 8bf308af2c..539c2770e3 100644 --- a/lib/api/response/sell_response_result.dart +++ b/lib/api/response/sell_response_result.dart @@ -28,10 +28,8 @@ abstract class SellResponseModel { class SellResponse extends SellResponseModel { /// Initializes Sell response class. const SellResponse({ - Sell? sell, - }) : super( - sell: sell, - ); + super.sell, + }); /// Creates an instance from JSON. factory SellResponse.fromJson( @@ -96,7 +94,6 @@ class SellResponse extends SellResponseModel { sell: sell ?? this.sell, ); } - /// Sell model class. abstract class SellModel { /// Initializes Sell model class . @@ -128,18 +125,12 @@ abstract class SellModel { class Sell extends SellModel { /// Initializes Sell class. const Sell({ - double? balanceAfter, - int? contractId, - int? referenceId, - double? soldFor, - int? transactionId, - }) : super( - balanceAfter: balanceAfter, - contractId: contractId, - referenceId: referenceId, - soldFor: soldFor, - transactionId: transactionId, - ); + super.balanceAfter, + super.contractId, + super.referenceId, + super.soldFor, + super.transactionId, + }); /// Creates an instance from JSON. factory Sell.fromJson(Map json) => Sell( diff --git a/lib/api/response/set_account_currency_response_result.dart b/lib/api/response/set_account_currency_response_result.dart index e468ea9aa2..dcbc190a30 100644 --- a/lib/api/response/set_account_currency_response_result.dart +++ b/lib/api/response/set_account_currency_response_result.dart @@ -25,10 +25,8 @@ abstract class SetAccountCurrencyResponseModel { class SetAccountCurrencyResponse extends SetAccountCurrencyResponseModel { /// Initializes Set account currency response class. const SetAccountCurrencyResponse({ - bool? setAccountCurrency, - }) : super( - setAccountCurrency: setAccountCurrency, - ); + super.setAccountCurrency, + }); /// Creates an instance from JSON. factory SetAccountCurrencyResponse.fromJson( diff --git a/lib/api/response/set_financial_assessment_response_result.dart b/lib/api/response/set_financial_assessment_response_result.dart index 24f0b02bb8..3c210ccf5a 100644 --- a/lib/api/response/set_financial_assessment_response_result.dart +++ b/lib/api/response/set_financial_assessment_response_result.dart @@ -26,10 +26,8 @@ class SetFinancialAssessmentResponse extends SetFinancialAssessmentResponseModel { /// Initializes Set financial assessment response class. const SetFinancialAssessmentResponse({ - SetFinancialAssessment? setFinancialAssessment, - }) : super( - setFinancialAssessment: setFinancialAssessment, - ); + super.setFinancialAssessment, + }); /// Creates an instance from JSON. factory SetFinancialAssessmentResponse.fromJson( @@ -85,7 +83,6 @@ class SetFinancialAssessmentResponse setFinancialAssessment ?? this.setFinancialAssessment, ); } - /// Set financial assessment model class. abstract class SetFinancialAssessmentModel { /// Initializes Set financial assessment model class . @@ -113,16 +110,11 @@ abstract class SetFinancialAssessmentModel { class SetFinancialAssessment extends SetFinancialAssessmentModel { /// Initializes Set financial assessment class. const SetFinancialAssessment({ - int? cfdScore, - int? financialInformationScore, - int? totalScore, - int? tradingScore, - }) : super( - cfdScore: cfdScore, - financialInformationScore: financialInformationScore, - totalScore: totalScore, - tradingScore: tradingScore, - ); + super.cfdScore, + super.financialInformationScore, + super.totalScore, + super.tradingScore, + }); /// Creates an instance from JSON. factory SetFinancialAssessment.fromJson(Map json) => diff --git a/lib/api/response/set_self_exclusion_response_result.dart b/lib/api/response/set_self_exclusion_response_result.dart index 5e6e1857d6..640eeb8710 100644 --- a/lib/api/response/set_self_exclusion_response_result.dart +++ b/lib/api/response/set_self_exclusion_response_result.dart @@ -25,10 +25,8 @@ abstract class SetSelfExclusionResponseModel { class SetSelfExclusionResponse extends SetSelfExclusionResponseModel { /// Initializes Set self exclusion response class. const SetSelfExclusionResponse({ - int? setSelfExclusion, - }) : super( - setSelfExclusion: setSelfExclusion, - ); + super.setSelfExclusion, + }); /// Creates an instance from JSON. factory SetSelfExclusionResponse.fromJson( diff --git a/lib/api/response/set_settings_response_result.dart b/lib/api/response/set_settings_response_result.dart index a48625a2c4..b96869c1d0 100644 --- a/lib/api/response/set_settings_response_result.dart +++ b/lib/api/response/set_settings_response_result.dart @@ -25,10 +25,8 @@ abstract class SetSettingsResponseModel { class SetSettingsResponse extends SetSettingsResponseModel { /// Initializes Set settings response class. const SetSettingsResponse({ - int? setSettings, - }) : super( - setSettings: setSettings, - ); + super.setSettings, + }); /// Creates an instance from JSON. factory SetSettingsResponse.fromJson( diff --git a/lib/api/response/statement_response_result.dart b/lib/api/response/statement_response_result.dart index c5b60f4ebb..c4fff2da2b 100644 --- a/lib/api/response/statement_response_result.dart +++ b/lib/api/response/statement_response_result.dart @@ -25,10 +25,8 @@ abstract class StatementResponseModel { class StatementResponse extends StatementResponseModel { /// Initializes Statement response class. const StatementResponse({ - Statement? statement, - }) : super( - statement: statement, - ); + super.statement, + }); /// Creates an instance from JSON. factory StatementResponse.fromJson( @@ -120,7 +118,6 @@ enum ActionTypeEnum { /// transfer. transfer, } - /// Statement model class. abstract class StatementModel { /// Initializes Statement model class . @@ -140,12 +137,9 @@ abstract class StatementModel { class Statement extends StatementModel { /// Initializes Statement class. const Statement({ - double? count, - List? transactions, - }) : super( - count: count, - transactions: transactions, - ); + super.count, + super.transactions, + }); /// Creates an instance from JSON. factory Statement.fromJson(Map json) => Statement( @@ -185,7 +179,6 @@ class Statement extends StatementModel { transactions: transactions ?? this.transactions, ); } - /// Transactions item model class. abstract class TransactionsItemModel { /// Initializes Transactions item model class . @@ -261,40 +254,23 @@ abstract class TransactionsItemModel { class TransactionsItem extends TransactionsItemModel { /// Initializes Transactions item class. const TransactionsItem({ - ActionTypeEnum? actionType, - double? amount, - int? appId, - double? balanceAfter, - int? contractId, - Fees? fees, - From? from, - String? longcode, - double? payout, - DateTime? purchaseTime, - int? referenceId, - String? shortcode, - To? to, - int? transactionId, - DateTime? transactionTime, - String? withdrawalDetails, - }) : super( - actionType: actionType, - amount: amount, - appId: appId, - balanceAfter: balanceAfter, - contractId: contractId, - fees: fees, - from: from, - longcode: longcode, - payout: payout, - purchaseTime: purchaseTime, - referenceId: referenceId, - shortcode: shortcode, - to: to, - transactionId: transactionId, - transactionTime: transactionTime, - withdrawalDetails: withdrawalDetails, - ); + super.actionType, + super.amount, + super.appId, + super.balanceAfter, + super.contractId, + super.fees, + super.from, + super.longcode, + super.payout, + super.purchaseTime, + super.referenceId, + super.shortcode, + super.to, + super.transactionId, + super.transactionTime, + super.withdrawalDetails, + }); /// Creates an instance from JSON. factory TransactionsItem.fromJson(Map json) => @@ -391,7 +367,6 @@ class TransactionsItem extends TransactionsItemModel { withdrawalDetails: withdrawalDetails ?? this.withdrawalDetails, ); } - /// Fees model class. abstract class FeesModel { /// Initializes Fees model class . @@ -419,16 +394,11 @@ abstract class FeesModel { class Fees extends FeesModel { /// Initializes Fees class. const Fees({ - double? amount, - String? currency, - double? minimum, - double? percentage, - }) : super( - amount: amount, - currency: currency, - minimum: minimum, - percentage: percentage, - ); + super.amount, + super.currency, + super.minimum, + super.percentage, + }); /// Creates an instance from JSON. factory Fees.fromJson(Map json) => Fees( @@ -464,7 +434,6 @@ class Fees extends FeesModel { percentage: percentage ?? this.percentage, ); } - /// From model class. abstract class FromModel { /// Initializes From model class . @@ -480,10 +449,8 @@ abstract class FromModel { class From extends FromModel { /// Initializes From class. const From({ - String? loginid, - }) : super( - loginid: loginid, - ); + super.loginid, + }); /// Creates an instance from JSON. factory From.fromJson(Map json) => From( @@ -507,7 +474,6 @@ class From extends FromModel { loginid: loginid ?? this.loginid, ); } - /// To model class. abstract class ToModel { /// Initializes To model class . @@ -523,10 +489,8 @@ abstract class ToModel { class To extends ToModel { /// Initializes To class. const To({ - String? loginid, - }) : super( - loginid: loginid, - ); + super.loginid, + }); /// Creates an instance from JSON. factory To.fromJson(Map json) => To( diff --git a/lib/api/response/states_list_response_result.dart b/lib/api/response/states_list_response_result.dart index bab5ab4094..7eb78d692a 100644 --- a/lib/api/response/states_list_response_result.dart +++ b/lib/api/response/states_list_response_result.dart @@ -25,10 +25,8 @@ abstract class StatesListResponseModel { class StatesListResponse extends StatesListResponseModel { /// Initializes States list response class. const StatesListResponse({ - List? statesList, - }) : super( - statesList: statesList, - ); + super.statesList, + }); /// Creates an instance from JSON. factory StatesListResponse.fromJson( @@ -85,7 +83,6 @@ class StatesListResponse extends StatesListResponseModel { statesList: statesList ?? this.statesList, ); } - /// States list item model class. abstract class StatesListItemModel { /// Initializes States list item model class . @@ -105,12 +102,9 @@ abstract class StatesListItemModel { class StatesListItem extends StatesListItemModel { /// Initializes States list item class. const StatesListItem({ - String? text, - String? value, - }) : super( - text: text, - value: value, - ); + super.text, + super.value, + }); /// Creates an instance from JSON. factory StatesListItem.fromJson(Map json) => StatesListItem( diff --git a/lib/api/response/ticks_history_response_result.dart b/lib/api/response/ticks_history_response_result.dart index 6f5ad2d9db..ac19b17778 100644 --- a/lib/api/response/ticks_history_response_result.dart +++ b/lib/api/response/ticks_history_response_result.dart @@ -45,16 +45,11 @@ abstract class TicksHistoryResponseModel { class TicksHistoryResponse extends TicksHistoryResponseModel { /// Initializes Ticks history response class. const TicksHistoryResponse({ - List? candles, - History? history, - double? pipSize, - Subscription? subscription, - }) : super( - candles: candles, - history: history, - pipSize: pipSize, - subscription: subscription, - ); + super.candles, + super.history, + super.pipSize, + super.subscription, + }); /// Creates an instance from JSON. factory TicksHistoryResponse.fromJson( @@ -190,7 +185,6 @@ class TicksHistoryResponse extends TicksHistoryResponseModel { subscription: subscription ?? this.subscription, ); } - /// Candles item model class. abstract class CandlesItemModel { /// Initializes Candles item model class . @@ -222,18 +216,12 @@ abstract class CandlesItemModel { class CandlesItem extends CandlesItemModel { /// Initializes Candles item class. const CandlesItem({ - double? close, - DateTime? epoch, - double? high, - double? low, - double? open, - }) : super( - close: close, - epoch: epoch, - high: high, - low: low, - open: open, - ); + super.close, + super.epoch, + super.high, + super.low, + super.open, + }); /// Creates an instance from JSON. factory CandlesItem.fromJson(Map json) => CandlesItem( @@ -273,7 +261,6 @@ class CandlesItem extends CandlesItemModel { open: open ?? this.open, ); } - /// History model class. abstract class HistoryModel { /// Initializes History model class . @@ -293,12 +280,9 @@ abstract class HistoryModel { class History extends HistoryModel { /// Initializes History class. const History({ - List? prices, - List? times, - }) : super( - prices: prices, - times: times, - ); + super.prices, + super.times, + }); /// Creates an instance from JSON. factory History.fromJson(Map json) => History( @@ -350,7 +334,6 @@ class History extends HistoryModel { times: times ?? this.times, ); } - /// Subscription model class. abstract class SubscriptionModel { /// Initializes Subscription model class . @@ -366,10 +349,8 @@ abstract class SubscriptionModel { class Subscription extends SubscriptionModel { /// Initializes Subscription class. const Subscription({ - required String id, - }) : super( - id: id, - ); + required super.id, + }); /// Creates an instance from JSON. factory Subscription.fromJson(Map json) => Subscription( diff --git a/lib/api/response/ticks_response_result.dart b/lib/api/response/ticks_response_result.dart index d689bceb68..4c1fa3a488 100644 --- a/lib/api/response/ticks_response_result.dart +++ b/lib/api/response/ticks_response_result.dart @@ -34,12 +34,9 @@ abstract class TicksResponseModel { class TicksResponse extends TicksResponseModel { /// Initializes Ticks response class. const TicksResponse({ - Tick? tick, - Subscription? subscription, - }) : super( - tick: tick, - subscription: subscription, - ); + super.tick, + super.subscription, + }); /// Creates an instance from JSON. factory TicksResponse.fromJson( @@ -121,7 +118,6 @@ class TicksResponse extends TicksResponseModel { subscription: subscription ?? this.subscription, ); } - /// Tick model class. abstract class TickModel { /// Initializes Tick model class . @@ -161,22 +157,14 @@ abstract class TickModel { class Tick extends TickModel { /// Initializes Tick class. const Tick({ - required double pipSize, - double? ask, - double? bid, - DateTime? epoch, - String? id, - double? quote, - String? symbol, - }) : super( - pipSize: pipSize, - ask: ask, - bid: bid, - epoch: epoch, - id: id, - quote: quote, - symbol: symbol, - ); + required super.pipSize, + super.ask, + super.bid, + super.epoch, + super.id, + super.quote, + super.symbol, + }); /// Creates an instance from JSON. factory Tick.fromJson(Map json) => Tick( @@ -224,7 +212,6 @@ class Tick extends TickModel { symbol: symbol ?? this.symbol, ); } - /// Subscription model class. abstract class SubscriptionModel { /// Initializes Subscription model class . @@ -240,10 +227,8 @@ abstract class SubscriptionModel { class Subscription extends SubscriptionModel { /// Initializes Subscription class. const Subscription({ - required String id, - }) : super( - id: id, - ); + required super.id, + }); /// Creates an instance from JSON. factory Subscription.fromJson(Map json) => Subscription( diff --git a/lib/api/response/time_response_result.dart b/lib/api/response/time_response_result.dart index 08a3227a67..a65add00d4 100644 --- a/lib/api/response/time_response_result.dart +++ b/lib/api/response/time_response_result.dart @@ -25,10 +25,8 @@ abstract class TimeResponseModel { class TimeResponse extends TimeResponseModel { /// Initializes Time response class. const TimeResponse({ - DateTime? time, - }) : super( - time: time, - ); + super.time, + }); /// Creates an instance from JSON. factory TimeResponse.fromJson( @@ -61,7 +59,7 @@ class TimeResponse extends TimeResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - BaseAPIException(baseExceptionModel: baseExceptionModel), + ServerTimeException(), ); return response; diff --git a/lib/api/response/tnc_approval_response_result.dart b/lib/api/response/tnc_approval_response_result.dart index 1966a1926e..181fa6bfb6 100644 --- a/lib/api/response/tnc_approval_response_result.dart +++ b/lib/api/response/tnc_approval_response_result.dart @@ -25,10 +25,8 @@ abstract class TncApprovalResponseModel { class TncApprovalResponse extends TncApprovalResponseModel { /// Initializes Tnc approval response class. const TncApprovalResponse({ - int? tncApproval, - }) : super( - tncApproval: tncApproval, - ); + super.tncApproval, + }); /// Creates an instance from JSON. factory TncApprovalResponse.fromJson( diff --git a/lib/api/response/topup_virtual_response_result.dart b/lib/api/response/topup_virtual_response_result.dart index fb843a85b6..30734ab493 100644 --- a/lib/api/response/topup_virtual_response_result.dart +++ b/lib/api/response/topup_virtual_response_result.dart @@ -25,10 +25,8 @@ abstract class TopupVirtualResponseModel { class TopupVirtualResponse extends TopupVirtualResponseModel { /// Initializes Topup virtual response class. const TopupVirtualResponse({ - TopupVirtual? topupVirtual, - }) : super( - topupVirtual: topupVirtual, - ); + super.topupVirtual, + }); /// Creates an instance from JSON. factory TopupVirtualResponse.fromJson( @@ -81,7 +79,6 @@ class TopupVirtualResponse extends TopupVirtualResponseModel { topupVirtual: topupVirtual ?? this.topupVirtual, ); } - /// Topup virtual model class. abstract class TopupVirtualModel { /// Initializes Topup virtual model class . @@ -101,12 +98,9 @@ abstract class TopupVirtualModel { class TopupVirtual extends TopupVirtualModel { /// Initializes Topup virtual class. const TopupVirtual({ - double? amount, - String? currency, - }) : super( - amount: amount, - currency: currency, - ); + super.amount, + super.currency, + }); /// Creates an instance from JSON. factory TopupVirtual.fromJson(Map json) => TopupVirtual( diff --git a/lib/api/response/trading_durations_response_result.dart b/lib/api/response/trading_durations_response_result.dart index 9cc7dd36aa..c6e112eaf5 100644 --- a/lib/api/response/trading_durations_response_result.dart +++ b/lib/api/response/trading_durations_response_result.dart @@ -25,10 +25,8 @@ abstract class TradingDurationsResponseModel { class TradingDurationsResponse extends TradingDurationsResponseModel { /// Initializes Trading durations response class. const TradingDurationsResponse({ - List? tradingDurations, - }) : super( - tradingDurations: tradingDurations, - ); + super.tradingDurations, + }); /// Creates an instance from JSON. factory TradingDurationsResponse.fromJson( @@ -88,7 +86,6 @@ class TradingDurationsResponse extends TradingDurationsResponseModel { tradingDurations: tradingDurations ?? this.tradingDurations, ); } - /// Trading durations item model class. abstract class TradingDurationsItemModel { /// Initializes Trading durations item model class . @@ -112,14 +109,10 @@ abstract class TradingDurationsItemModel { class TradingDurationsItem extends TradingDurationsItemModel { /// Initializes Trading durations item class. const TradingDurationsItem({ - List? data, - TradingDurationsItemMarket? market, - TradingDurationsItemSubmarket? submarket, - }) : super( - data: data, - market: market, - submarket: submarket, - ); + super.data, + super.market, + super.submarket, + }); /// Creates an instance from JSON. factory TradingDurationsItem.fromJson(Map json) => @@ -172,7 +165,6 @@ class TradingDurationsItem extends TradingDurationsItemModel { submarket: submarket ?? this.submarket, ); } - /// Data item model class. abstract class DataItemModel { /// Initializes Data item model class . @@ -200,16 +192,11 @@ abstract class DataItemModel { class DataItem extends DataItemModel { /// Initializes Data item class. const DataItem({ - Market? market, - Submarket? submarket, - List? symbol, - List? tradeDurations, - }) : super( - market: market, - submarket: submarket, - symbol: symbol, - tradeDurations: tradeDurations, - ); + super.market, + super.submarket, + super.symbol, + super.tradeDurations, + }); /// Creates an instance from JSON. factory DataItem.fromJson(Map json) => DataItem( @@ -275,7 +262,6 @@ class DataItem extends DataItemModel { tradeDurations: tradeDurations ?? this.tradeDurations, ); } - /// Market model class. abstract class MarketModel { /// Initializes Market model class . @@ -295,12 +281,9 @@ abstract class MarketModel { class Market extends MarketModel { /// Initializes Market class. const Market({ - String? displayName, - String? name, - }) : super( - displayName: displayName, - name: name, - ); + super.displayName, + super.name, + }); /// Creates an instance from JSON. factory Market.fromJson(Map json) => Market( @@ -328,7 +311,6 @@ class Market extends MarketModel { name: name ?? this.name, ); } - /// Submarket model class. abstract class SubmarketModel { /// Initializes Submarket model class . @@ -348,12 +330,9 @@ abstract class SubmarketModel { class Submarket extends SubmarketModel { /// Initializes Submarket class. const Submarket({ - String? displayName, - String? name, - }) : super( - displayName: displayName, - name: name, - ); + super.displayName, + super.name, + }); /// Creates an instance from JSON. factory Submarket.fromJson(Map json) => Submarket( @@ -381,7 +360,6 @@ class Submarket extends SubmarketModel { name: name ?? this.name, ); } - /// Symbol item model class. abstract class SymbolItemModel { /// Initializes Symbol item model class . @@ -401,12 +379,9 @@ abstract class SymbolItemModel { class SymbolItem extends SymbolItemModel { /// Initializes Symbol item class. const SymbolItem({ - String? displayName, - String? name, - }) : super( - displayName: displayName, - name: name, - ); + super.displayName, + super.name, + }); /// Creates an instance from JSON. factory SymbolItem.fromJson(Map json) => SymbolItem( @@ -434,7 +409,6 @@ class SymbolItem extends SymbolItemModel { name: name ?? this.name, ); } - /// Trade durations item model class. abstract class TradeDurationsItemModel { /// Initializes Trade durations item model class . @@ -454,12 +428,9 @@ abstract class TradeDurationsItemModel { class TradeDurationsItem extends TradeDurationsItemModel { /// Initializes Trade durations item class. const TradeDurationsItem({ - List? durations, - TradeType? tradeType, - }) : super( - durations: durations, - tradeType: tradeType, - ); + super.durations, + super.tradeType, + }); /// Creates an instance from JSON. factory TradeDurationsItem.fromJson(Map json) => @@ -504,7 +475,6 @@ class TradeDurationsItem extends TradeDurationsItemModel { tradeType: tradeType ?? this.tradeType, ); } - /// Durations item model class. abstract class DurationsItemModel { /// Initializes Durations item model class . @@ -532,16 +502,11 @@ abstract class DurationsItemModel { class DurationsItem extends DurationsItemModel { /// Initializes Durations item class. const DurationsItem({ - String? displayName, - int? max, - int? min, - String? name, - }) : super( - displayName: displayName, - max: max, - min: min, - name: name, - ); + super.displayName, + super.max, + super.min, + super.name, + }); /// Creates an instance from JSON. factory DurationsItem.fromJson(Map json) => DurationsItem( @@ -577,7 +542,6 @@ class DurationsItem extends DurationsItemModel { name: name ?? this.name, ); } - /// Trade type model class. abstract class TradeTypeModel { /// Initializes Trade type model class . @@ -597,12 +561,9 @@ abstract class TradeTypeModel { class TradeType extends TradeTypeModel { /// Initializes Trade type class. const TradeType({ - String? displayName, - String? name, - }) : super( - displayName: displayName, - name: name, - ); + super.displayName, + super.name, + }); /// Creates an instance from JSON. factory TradeType.fromJson(Map json) => TradeType( @@ -630,7 +591,6 @@ class TradeType extends TradeTypeModel { name: name ?? this.name, ); } - /// Trading durations item market model class. abstract class TradingDurationsItemMarketModel { /// Initializes Trading durations item market model class . @@ -650,12 +610,9 @@ abstract class TradingDurationsItemMarketModel { class TradingDurationsItemMarket extends TradingDurationsItemMarketModel { /// Initializes Trading durations item market class. const TradingDurationsItemMarket({ - String? displayName, - String? name, - }) : super( - displayName: displayName, - name: name, - ); + super.displayName, + super.name, + }); /// Creates an instance from JSON. factory TradingDurationsItemMarket.fromJson(Map json) => @@ -684,7 +641,6 @@ class TradingDurationsItemMarket extends TradingDurationsItemMarketModel { name: name ?? this.name, ); } - /// Trading durations item submarket model class. abstract class TradingDurationsItemSubmarketModel { /// Initializes Trading durations item submarket model class . @@ -704,12 +660,9 @@ abstract class TradingDurationsItemSubmarketModel { class TradingDurationsItemSubmarket extends TradingDurationsItemSubmarketModel { /// Initializes Trading durations item submarket class. const TradingDurationsItemSubmarket({ - String? displayName, - String? name, - }) : super( - displayName: displayName, - name: name, - ); + super.displayName, + super.name, + }); /// Creates an instance from JSON. factory TradingDurationsItemSubmarket.fromJson(Map json) => diff --git a/lib/api/response/trading_platform_accounts_response_result.dart b/lib/api/response/trading_platform_accounts_response_result.dart index a73ddb45c2..b110666dc4 100644 --- a/lib/api/response/trading_platform_accounts_response_result.dart +++ b/lib/api/response/trading_platform_accounts_response_result.dart @@ -187,6 +187,7 @@ final Map environmentEnumMapper = "Deriv-Demo": EnvironmentEnum.derivDemo, "Deriv-Server": EnvironmentEnum.derivServer, "Deriv-Server-02": EnvironmentEnum.derivServer02, + "Deriv-Server-03": EnvironmentEnum.derivServer03, }; /// Environment Enum. @@ -199,6 +200,9 @@ enum EnvironmentEnum { /// Deriv-Server-02. derivServer02, + + /// Deriv-Server-03. + derivServer03, } /// SubAccountTypeEnum mapper. diff --git a/lib/api/response/trading_platform_investor_password_change_response_result.dart b/lib/api/response/trading_platform_investor_password_change_response_result.dart index d882d0ba30..67af3220f9 100644 --- a/lib/api/response/trading_platform_investor_password_change_response_result.dart +++ b/lib/api/response/trading_platform_investor_password_change_response_result.dart @@ -20,10 +20,8 @@ class TradingPlatformInvestorPasswordChangeResponse extends TradingPlatformInvestorPasswordChangeResponseModel { /// Initializes Trading platform investor password change response class. const TradingPlatformInvestorPasswordChangeResponse({ - bool? tradingPlatformPasswordChange, - }) : super( - tradingPlatformPasswordChange: tradingPlatformPasswordChange, - ); + super.tradingPlatformPasswordChange, + }); /// Creates an instance from JSON. factory TradingPlatformInvestorPasswordChangeResponse.fromJson( diff --git a/lib/api/response/trading_platform_investor_password_reset_response_result.dart b/lib/api/response/trading_platform_investor_password_reset_response_result.dart index cceff99f4c..8b7a114bef 100644 --- a/lib/api/response/trading_platform_investor_password_reset_response_result.dart +++ b/lib/api/response/trading_platform_investor_password_reset_response_result.dart @@ -19,10 +19,8 @@ class TradingPlatformInvestorPasswordResetResponse extends TradingPlatformInvestorPasswordResetResponseModel { /// Initializes Trading platform investor password reset response class. const TradingPlatformInvestorPasswordResetResponse({ - bool? tradingPlatformPasswordReset, - }) : super( - tradingPlatformPasswordReset: tradingPlatformPasswordReset, - ); + super.tradingPlatformPasswordReset, + }); /// Creates an instance from JSON. factory TradingPlatformInvestorPasswordResetResponse.fromJson( diff --git a/lib/api/response/trading_platform_leverage_response_result.dart b/lib/api/response/trading_platform_leverage_response_result.dart new file mode 100644 index 0000000000..b7e4ff2985 --- /dev/null +++ b/lib/api/response/trading_platform_leverage_response_result.dart @@ -0,0 +1,314 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Trading platform leverage response model class. +abstract class TradingPlatformLeverageResponseModel { + /// Initializes Trading platform leverage response model class . + const TradingPlatformLeverageResponseModel({ + this.tradingPlatformLeverage, + }); + + /// Information for dynamic leverage for the requested trading platform + final TradingPlatformLeverage? tradingPlatformLeverage; +} + +/// Trading platform leverage response class. +class TradingPlatformLeverageResponse + extends TradingPlatformLeverageResponseModel { + /// Initializes Trading platform leverage response class. + const TradingPlatformLeverageResponse({ + super.tradingPlatformLeverage, + }); + + /// Creates an instance from JSON. + factory TradingPlatformLeverageResponse.fromJson( + dynamic tradingPlatformLeverageJson, + ) => + TradingPlatformLeverageResponse( + tradingPlatformLeverage: tradingPlatformLeverageJson == null + ? null + : TradingPlatformLeverage.fromJson(tradingPlatformLeverageJson), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (tradingPlatformLeverage != null) { + resultMap['trading_platform_leverage'] = + tradingPlatformLeverage!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + TradingPlatformLeverageResponse copyWith({ + TradingPlatformLeverage? tradingPlatformLeverage, + }) => + TradingPlatformLeverageResponse( + tradingPlatformLeverage: + tradingPlatformLeverage ?? this.tradingPlatformLeverage, + ); +} +/// Trading platform leverage model class. +abstract class TradingPlatformLeverageModel { + /// Initializes Trading platform leverage model class . + const TradingPlatformLeverageModel({ + this.leverage, + }); + + /// List of objects containing leverage data by category + final Map? leverage; +} + +/// Trading platform leverage class. +class TradingPlatformLeverage extends TradingPlatformLeverageModel { + /// Initializes Trading platform leverage class. + const TradingPlatformLeverage({ + super.leverage, + }); + + /// Creates an instance from JSON. + factory TradingPlatformLeverage.fromJson(Map json) => + TradingPlatformLeverage( + leverage: json['leverage'] == null + ? null + : Map.fromEntries(json['leverage'] + .entries + .map>( + (MapEntry entry) => + MapEntry(entry.key, + LeverageProperty.fromJson(entry.value)))), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['leverage'] = leverage; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + TradingPlatformLeverage copyWith({ + Map? leverage, + }) => + TradingPlatformLeverage( + leverage: leverage ?? this.leverage, + ); +} +/// Leverage property model class. +abstract class LeveragePropertyModel { + /// Initializes Leverage property model class . + const LeveragePropertyModel({ + this.displayName, + this.instruments, + this.max, + this.min, + this.volume, + }); + + /// Display name for each category + final String? displayName; + + /// List of instruments supported for the category + final List? instruments; + + /// Maximum leverage + final int? max; + + /// Minimum leverage + final int? min; + + /// Range of data and its corressponding leverage + final Volume? volume; +} + +/// Leverage property class. +class LeverageProperty extends LeveragePropertyModel { + /// Initializes Leverage property class. + const LeverageProperty({ + super.displayName, + super.instruments, + super.max, + super.min, + super.volume, + }); + + /// Creates an instance from JSON. + factory LeverageProperty.fromJson(Map json) => + LeverageProperty( + displayName: json['display_name'], + instruments: json['instruments'] == null + ? null + : List.from( + json['instruments']?.map( + (dynamic item) => item, + ), + ), + max: json['max'], + min: json['min'], + volume: json['volume'] == null ? null : Volume.fromJson(json['volume']), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['display_name'] = displayName; + if (instruments != null) { + resultMap['instruments'] = instruments! + .map( + (dynamic item) => item, + ) + .toList(); + } + resultMap['max'] = max; + resultMap['min'] = min; + if (volume != null) { + resultMap['volume'] = volume!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + LeverageProperty copyWith({ + String? displayName, + List? instruments, + int? max, + int? min, + Volume? volume, + }) => + LeverageProperty( + displayName: displayName ?? this.displayName, + instruments: instruments ?? this.instruments, + max: max ?? this.max, + min: min ?? this.min, + volume: volume ?? this.volume, + ); +} +/// Volume model class. +abstract class VolumeModel { + /// Initializes Volume model class . + const VolumeModel({ + this.data, + this.unit, + }); + + /// Leverage data + final List? data; + + /// Measurable unit of leverage + final String? unit; +} + +/// Volume class. +class Volume extends VolumeModel { + /// Initializes Volume class. + const Volume({ + super.data, + super.unit, + }); + + /// Creates an instance from JSON. + factory Volume.fromJson(Map json) => Volume( + data: json['data'] == null + ? null + : List.from( + json['data']?.map( + (dynamic item) => DataItem.fromJson(item), + ), + ), + unit: json['unit'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (data != null) { + resultMap['data'] = data! + .map( + (DataItem item) => item.toJson(), + ) + .toList(); + } + resultMap['unit'] = unit; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + Volume copyWith({ + List? data, + String? unit, + }) => + Volume( + data: data ?? this.data, + unit: unit ?? this.unit, + ); +} +/// Data item model class. +abstract class DataItemModel { + /// Initializes Data item model class . + const DataItemModel({ + this.from, + this.leverage, + this.to, + }); + + /// Range start point + final double? from; + + /// Record leverage + final int? leverage; + + /// Range end point + final int? to; +} + +/// Data item class. +class DataItem extends DataItemModel { + /// Initializes Data item class. + const DataItem({ + super.from, + super.leverage, + super.to, + }); + + /// Creates an instance from JSON. + factory DataItem.fromJson(Map json) => DataItem( + from: getDouble(json['from']), + leverage: json['leverage'], + to: json['to'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['from'] = from; + resultMap['leverage'] = leverage; + resultMap['to'] = to; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + DataItem copyWith({ + double? from, + int? leverage, + int? to, + }) => + DataItem( + from: from ?? this.from, + leverage: leverage ?? this.leverage, + to: to ?? this.to, + ); +} diff --git a/lib/api/response/trading_servers_response_result.dart b/lib/api/response/trading_servers_response_result.dart index 8807252094..bb74a89c09 100644 --- a/lib/api/response/trading_servers_response_result.dart +++ b/lib/api/response/trading_servers_response_result.dart @@ -25,10 +25,8 @@ abstract class TradingServersResponseModel { class TradingServersResponse extends TradingServersResponseModel { /// Initializes Trading servers response class. const TradingServersResponse({ - List? tradingServers, - }) : super( - tradingServers: tradingServers, - ); + super.tradingServers, + }); /// Creates an instance from JSON. factory TradingServersResponse.fromJson( @@ -110,6 +108,7 @@ final Map environmentEnumMapper = "Deriv-Demo": EnvironmentEnum.derivDemo, "Deriv-Server": EnvironmentEnum.derivServer, "Deriv-Server-02": EnvironmentEnum.derivServer02, + "Deriv-Server-03": EnvironmentEnum.derivServer03, }; /// Environment Enum. @@ -122,6 +121,9 @@ enum EnvironmentEnum { /// Deriv-Server-02. derivServer02, + + /// Deriv-Server-03. + derivServer03, } /// IdEnum mapper. @@ -131,6 +133,7 @@ final Map idEnumMapper = { "p01_ts03": IdEnum.p01Ts03, "p01_ts04": IdEnum.p01Ts04, "p02_ts02": IdEnum.p02Ts02, + "p03_ts01": IdEnum.p03Ts01, }; /// Id Enum. @@ -149,8 +152,10 @@ enum IdEnum { /// p02_ts02. p02Ts02, -} + /// p03_ts01. + p03Ts01, +} /// Trading servers item model class. abstract class TradingServersItemModel { /// Initializes Trading servers item model class . @@ -198,26 +203,16 @@ abstract class TradingServersItemModel { class TradingServersItem extends TradingServersItemModel { /// Initializes Trading servers item class. const TradingServersItem({ - AccountTypeEnum? accountType, - bool? disabled, - EnvironmentEnum? environment, - Geolocation? geolocation, - IdEnum? id, - String? marketType, - String? messageToClient, - bool? recommended, - List? supportedAccounts, - }) : super( - accountType: accountType, - disabled: disabled, - environment: environment, - geolocation: geolocation, - id: id, - marketType: marketType, - messageToClient: messageToClient, - recommended: recommended, - supportedAccounts: supportedAccounts, - ); + super.accountType, + super.disabled, + super.environment, + super.geolocation, + super.id, + super.marketType, + super.messageToClient, + super.recommended, + super.supportedAccounts, + }); /// Creates an instance from JSON. factory TradingServersItem.fromJson(Map json) => @@ -302,7 +297,6 @@ class TradingServersItem extends TradingServersItemModel { supportedAccounts: supportedAccounts ?? this.supportedAccounts, ); } - /// Geolocation model class. abstract class GeolocationModel { /// Initializes Geolocation model class . @@ -330,16 +324,11 @@ abstract class GeolocationModel { class Geolocation extends GeolocationModel { /// Initializes Geolocation class. const Geolocation({ - String? group, - String? location, - String? region, - int? sequence, - }) : super( - group: group, - location: location, - region: region, - sequence: sequence, - ); + super.group, + super.location, + super.region, + super.sequence, + }); /// Creates an instance from JSON. factory Geolocation.fromJson(Map json) => Geolocation( diff --git a/lib/api/response/trading_times_response_result.dart b/lib/api/response/trading_times_response_result.dart index 6c4af9d1b0..af5616fa00 100644 --- a/lib/api/response/trading_times_response_result.dart +++ b/lib/api/response/trading_times_response_result.dart @@ -25,10 +25,8 @@ abstract class TradingTimesResponseModel { class TradingTimesResponse extends TradingTimesResponseModel { /// Initializes Trading times response class. const TradingTimesResponse({ - TradingTimes? tradingTimes, - }) : super( - tradingTimes: tradingTimes, - ); + super.tradingTimes, + }); /// Creates an instance from JSON. factory TradingTimesResponse.fromJson( @@ -115,7 +113,6 @@ enum TradingDaysItemEnum { /// Sat. sat, } - /// Trading times model class. abstract class TradingTimesModel { /// Initializes Trading times model class . @@ -131,10 +128,8 @@ abstract class TradingTimesModel { class TradingTimes extends TradingTimesModel { /// Initializes Trading times class. const TradingTimes({ - required List markets, - }) : super( - markets: markets, - ); + required super.markets, + }); /// Creates an instance from JSON. factory TradingTimes.fromJson(Map json) => TradingTimes( @@ -166,7 +161,6 @@ class TradingTimes extends TradingTimesModel { markets: markets ?? this.markets, ); } - /// Markets item model class. abstract class MarketsItemModel { /// Initializes Markets item model class . @@ -186,12 +180,9 @@ abstract class MarketsItemModel { class MarketsItem extends MarketsItemModel { /// Initializes Markets item class. const MarketsItem({ - required String name, - List? submarkets, - }) : super( - name: name, - submarkets: submarkets, - ); + required super.name, + super.submarkets, + }); /// Creates an instance from JSON. factory MarketsItem.fromJson(Map json) => MarketsItem( @@ -231,7 +222,6 @@ class MarketsItem extends MarketsItemModel { submarkets: submarkets ?? this.submarkets, ); } - /// Submarkets item model class. abstract class SubmarketsItemModel { /// Initializes Submarkets item model class . @@ -251,12 +241,9 @@ abstract class SubmarketsItemModel { class SubmarketsItem extends SubmarketsItemModel { /// Initializes Submarkets item class. const SubmarketsItem({ - required String name, - List? symbols, - }) : super( - name: name, - symbols: symbols, - ); + required super.name, + super.symbols, + }); /// Creates an instance from JSON. factory SubmarketsItem.fromJson(Map json) => SubmarketsItem( @@ -296,7 +283,6 @@ class SubmarketsItem extends SubmarketsItemModel { symbols: symbols ?? this.symbols, ); } - /// Symbols item model class. abstract class SymbolsItemModel { /// Initializes Symbols item model class . @@ -328,18 +314,12 @@ abstract class SymbolsItemModel { class SymbolsItem extends SymbolsItemModel { /// Initializes Symbols item class. const SymbolsItem({ - required String name, - required String symbol, - List? events, - Map? times, - List? tradingDays, - }) : super( - name: name, - symbol: symbol, - events: events, - times: times, - tradingDays: tradingDays, - ); + required super.name, + required super.symbol, + super.events, + super.times, + super.tradingDays, + }); /// Creates an instance from JSON. factory SymbolsItem.fromJson(Map json) => SymbolsItem( diff --git a/lib/api/response/transaction_response_result.dart b/lib/api/response/transaction_response_result.dart index 0d97e9a495..2723dea79d 100644 --- a/lib/api/response/transaction_response_result.dart +++ b/lib/api/response/transaction_response_result.dart @@ -36,12 +36,9 @@ abstract class TransactionResponseModel { class TransactionResponse extends TransactionResponseModel { /// Initializes Transaction response class. const TransactionResponse({ - Transaction? transaction, - Subscription? subscription, - }) : super( - transaction: transaction, - subscription: subscription, - ); + super.transaction, + super.subscription, + }); /// Creates an instance from JSON. factory TransactionResponse.fromJson( @@ -184,7 +181,6 @@ enum ActionEnum { /// transfer. transfer, } - /// Transaction model class. abstract class TransactionModel { /// Initializes Transaction model class . @@ -272,46 +268,26 @@ abstract class TransactionModel { class Transaction extends TransactionModel { /// Initializes Transaction class. const Transaction({ - ActionEnum? action, - double? amount, - double? balance, - dynamic barrier, - int? contractId, - String? currency, - DateTime? dateExpiry, - String? displayName, - dynamic highBarrier, - String? id, - String? longcode, - String? lowBarrier, - DateTime? purchaseTime, - String? stopLoss, - String? stopOut, - String? symbol, - String? takeProfit, - int? transactionId, - DateTime? transactionTime, - }) : super( - action: action, - amount: amount, - balance: balance, - barrier: barrier, - contractId: contractId, - currency: currency, - dateExpiry: dateExpiry, - displayName: displayName, - highBarrier: highBarrier, - id: id, - longcode: longcode, - lowBarrier: lowBarrier, - purchaseTime: purchaseTime, - stopLoss: stopLoss, - stopOut: stopOut, - symbol: symbol, - takeProfit: takeProfit, - transactionId: transactionId, - transactionTime: transactionTime, - ); + super.action, + super.amount, + super.balance, + super.barrier, + super.contractId, + super.currency, + super.dateExpiry, + super.displayName, + super.highBarrier, + super.id, + super.longcode, + super.lowBarrier, + super.purchaseTime, + super.stopLoss, + super.stopOut, + super.symbol, + super.takeProfit, + super.transactionId, + super.transactionTime, + }); /// Creates an instance from JSON. factory Transaction.fromJson(Map json) => Transaction( @@ -412,7 +388,6 @@ class Transaction extends TransactionModel { transactionTime: transactionTime ?? this.transactionTime, ); } - /// Subscription model class. abstract class SubscriptionModel { /// Initializes Subscription model class . @@ -428,10 +403,8 @@ abstract class SubscriptionModel { class Subscription extends SubscriptionModel { /// Initializes Subscription class. const Subscription({ - required String id, - }) : super( - id: id, - ); + required super.id, + }); /// Creates an instance from JSON. factory Subscription.fromJson(Map json) => Subscription( diff --git a/lib/api/response/transfer_between_accounts_response_result.dart b/lib/api/response/transfer_between_accounts_response_result.dart index 301a58247e..9e7d3c758a 100644 --- a/lib/api/response/transfer_between_accounts_response_result.dart +++ b/lib/api/response/transfer_between_accounts_response_result.dart @@ -136,28 +136,52 @@ class TransferBetweenAccountsResponse ); } +/// AccountCategoryEnum mapper. +final Map accountCategoryEnumMapper = + { + "trading": AccountCategoryEnum.trading, + "wallet": AccountCategoryEnum.wallet, +}; + +/// AccountCategory Enum. +enum AccountCategoryEnum { + /// trading. + trading, + + /// wallet. + wallet, +} + /// AccountTypeEnum mapper. final Map accountTypeEnumMapper = { - "trading": AccountTypeEnum.trading, - "mt5": AccountTypeEnum.mt5, - "wallet": AccountTypeEnum.wallet, - "dxtrade": AccountTypeEnum.dxtrade, - "derivez": AccountTypeEnum.derivez, "binary": AccountTypeEnum.binary, + "crypto": AccountTypeEnum.crypto, "ctrader": AccountTypeEnum.ctrader, + "doughflow": AccountTypeEnum.doughflow, + "dxtrade": AccountTypeEnum.dxtrade, + "derivez": AccountTypeEnum.derivez, + "mt5": AccountTypeEnum.mt5, + "p2p": AccountTypeEnum.p2p, + "paymentagent": AccountTypeEnum.paymentagent, + "paymentagent_client": AccountTypeEnum.paymentagentClient, + "standard": AccountTypeEnum.standard, + "virtual": AccountTypeEnum.virtual, }; /// AccountType Enum. enum AccountTypeEnum { - /// trading. - trading, + /// binary. + binary, - /// mt5. - mt5, + /// crypto. + crypto, - /// wallet. - wallet, + /// ctrader. + ctrader, + + /// doughflow. + doughflow, /// dxtrade. dxtrade, @@ -165,36 +189,72 @@ enum AccountTypeEnum { /// derivez. derivez, - /// binary. - binary, + /// mt5. + mt5, - /// ctrader. - ctrader, + /// p2p. + p2p, + + /// paymentagent. + paymentagent, + + /// paymentagent_client. + paymentagentClient, + + /// standard. + standard, + + /// virtual. + virtual, } /// MarketTypeEnum mapper. final Map marketTypeEnumMapper = { + "all": MarketTypeEnum.all, "financial": MarketTypeEnum.financial, "synthetic": MarketTypeEnum.synthetic, - "all": MarketTypeEnum.all, }; /// MarketType Enum. enum MarketTypeEnum { + /// all. + all, + /// financial. financial, /// synthetic. synthetic, +} + +/// TransfersEnum mapper. +final Map transfersEnumMapper = { + "all": TransfersEnum.all, + "deposit": TransfersEnum.deposit, + "none": TransfersEnum.none, + "withdrawal": TransfersEnum.withdrawal, +}; +/// Transfers Enum. +enum TransfersEnum { /// all. all, + + /// deposit. + deposit, + + /// none. + none, + + /// withdrawal. + withdrawal, } /// Accounts item model class. abstract class AccountsItemModel { /// Initializes Accounts item model class . const AccountsItemModel({ + this.accountCategory, this.accountType, this.balance, this.currency, @@ -204,9 +264,13 @@ abstract class AccountsItemModel { this.marketType, this.mt5Group, this.status, + this.transfers, }); - /// Type of the account. Please note that `binary` is deprecated and replaced by `trading` + /// Category of the account. + final AccountCategoryEnum? accountCategory; + + /// Type of the account. final AccountTypeEnum? accountType; /// Account balance. @@ -232,12 +296,16 @@ abstract class AccountsItemModel { /// The status of account. final String? status; + + /// Type of transfers allowed between the account and the currently authorized account. + final TransfersEnum? transfers; } /// Accounts item class. class AccountsItem extends AccountsItemModel { /// Initializes Accounts item class. const AccountsItem({ + super.accountCategory, super.accountType, super.balance, super.currency, @@ -247,10 +315,14 @@ class AccountsItem extends AccountsItemModel { super.marketType, super.mt5Group, super.status, + super.transfers, }); /// Creates an instance from JSON. factory AccountsItem.fromJson(Map json) => AccountsItem( + accountCategory: json['account_category'] == null + ? null + : accountCategoryEnumMapper[json['account_category']], accountType: json['account_type'] == null ? null : accountTypeEnumMapper[json['account_type']], @@ -264,12 +336,19 @@ class AccountsItem extends AccountsItemModel { : marketTypeEnumMapper[json['market_type']], mt5Group: json['mt5_group'], status: json['status'], + transfers: json['transfers'] == null + ? null + : transfersEnumMapper[json['transfers']], ); /// Converts an instance to JSON. Map toJson() { final Map resultMap = {}; + resultMap['account_category'] = accountCategoryEnumMapper.entries + .firstWhere((MapEntry entry) => + entry.value == accountCategory) + .key; resultMap['account_type'] = accountTypeEnumMapper.entries .firstWhere((MapEntry entry) => entry.value == accountType) @@ -285,12 +364,17 @@ class AccountsItem extends AccountsItemModel { .key; resultMap['mt5_group'] = mt5Group; resultMap['status'] = status; + resultMap['transfers'] = transfersEnumMapper.entries + .firstWhere( + (MapEntry entry) => entry.value == transfers) + .key; return resultMap; } /// Creates a copy of instance with given parameters. AccountsItem copyWith({ + AccountCategoryEnum? accountCategory, AccountTypeEnum? accountType, String? balance, String? currency, @@ -300,8 +384,10 @@ class AccountsItem extends AccountsItemModel { MarketTypeEnum? marketType, String? mt5Group, String? status, + TransfersEnum? transfers, }) => AccountsItem( + accountCategory: accountCategory ?? this.accountCategory, accountType: accountType ?? this.accountType, balance: balance ?? this.balance, currency: currency ?? this.currency, @@ -311,5 +397,6 @@ class AccountsItem extends AccountsItemModel { marketType: marketType ?? this.marketType, mt5Group: mt5Group ?? this.mt5Group, status: status ?? this.status, + transfers: transfers ?? this.transfers, ); } diff --git a/lib/api/response/unsubscribe_email_response_result.dart b/lib/api/response/unsubscribe_email_response_result.dart index 9cd6c2800d..c583bd8dfe 100644 --- a/lib/api/response/unsubscribe_email_response_result.dart +++ b/lib/api/response/unsubscribe_email_response_result.dart @@ -23,12 +23,9 @@ abstract class UnsubscribeEmailResponseModel { class UnsubscribeEmailResponse extends UnsubscribeEmailResponseModel { /// Initializes Unsubscribe email response class. const UnsubscribeEmailResponse({ - double? binaryUserId, - bool? emailUnsubscribeStatus, - }) : super( - binaryUserId: binaryUserId, - emailUnsubscribeStatus: emailUnsubscribeStatus, - ); + super.binaryUserId, + super.emailUnsubscribeStatus, + }); /// Creates an instance from JSON. factory UnsubscribeEmailResponse.fromJson( diff --git a/lib/api/response/verify_email_cellxpert_response_result.dart b/lib/api/response/verify_email_cellxpert_response_result.dart index 1c1887b9fa..d403c4de32 100644 --- a/lib/api/response/verify_email_cellxpert_response_result.dart +++ b/lib/api/response/verify_email_cellxpert_response_result.dart @@ -19,10 +19,8 @@ abstract class VerifyEmailCellxpertResponseModel { class VerifyEmailCellxpertResponse extends VerifyEmailCellxpertResponseModel { /// Initializes Verify email cellxpert response class. const VerifyEmailCellxpertResponse({ - bool? verifyEmailCellxpert, - }) : super( - verifyEmailCellxpert: verifyEmailCellxpert, - ); + super.verifyEmailCellxpert, + }); /// Creates an instance from JSON. factory VerifyEmailCellxpertResponse.fromJson( diff --git a/lib/api/response/verify_email_response_result.dart b/lib/api/response/verify_email_response_result.dart index 03468dfd66..7ca125ab51 100644 --- a/lib/api/response/verify_email_response_result.dart +++ b/lib/api/response/verify_email_response_result.dart @@ -25,10 +25,8 @@ abstract class VerifyEmailResponseModel { class VerifyEmailResponse extends VerifyEmailResponseModel { /// Initializes Verify email response class. const VerifyEmailResponse({ - bool? verifyEmail, - }) : super( - verifyEmail: verifyEmail, - ); + super.verifyEmail, + }); /// Creates an instance from JSON. factory VerifyEmailResponse.fromJson( diff --git a/lib/api/response/website_config_response_result.dart b/lib/api/response/website_config_response_result.dart new file mode 100644 index 0000000000..4b66bacf0f --- /dev/null +++ b/lib/api/response/website_config_response_result.dart @@ -0,0 +1,528 @@ +// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import + +import 'package:equatable/equatable.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; + +/// Website config response model class. +abstract class WebsiteConfigResponseModel { + /// Initializes Website config response model class . + const WebsiteConfigResponseModel({ + this.websiteConfig, + this.subscription, + }); + + /// Server status and other information regarding general settings + final WebsiteConfig? websiteConfig; + + /// For subscription requests only. + final Subscription? subscription; +} + +/// Website config response class. +class WebsiteConfigResponse extends WebsiteConfigResponseModel { + /// Initializes Website config response class. + const WebsiteConfigResponse({ + super.websiteConfig, + super.subscription, + }); + + /// Creates an instance from JSON. + factory WebsiteConfigResponse.fromJson( + dynamic websiteConfigJson, + dynamic subscriptionJson, + ) => + WebsiteConfigResponse( + websiteConfig: websiteConfigJson == null + ? null + : WebsiteConfig.fromJson(websiteConfigJson), + subscription: subscriptionJson == null + ? null + : Subscription.fromJson(subscriptionJson), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + if (websiteConfig != null) { + resultMap['website_config'] = websiteConfig!.toJson(); + } + if (subscription != null) { + resultMap['subscription'] = subscription!.toJson(); + } + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + WebsiteConfigResponse copyWith({ + WebsiteConfig? websiteConfig, + Subscription? subscription, + }) => + WebsiteConfigResponse( + websiteConfig: websiteConfig ?? this.websiteConfig, + subscription: subscription ?? this.subscription, + ); +} + +/// TypeEnum mapper. +final Map typeEnumMapper = { + "fiat": TypeEnum.fiat, + "crypto": TypeEnum.crypto, +}; + +/// Type Enum. +enum TypeEnum { + /// fiat. + fiat, + + /// crypto. + crypto, +} +/// Website config model class. +abstract class WebsiteConfigModel { + /// Initializes Website config model class . + const WebsiteConfigModel({ + required this.currenciesConfig, + this.featureFlags, + this.paymentAgents, + this.supportedLanguages, + this.termsConditionsVersion, + }); + + /// Available currencies and their information + final Map currenciesConfig; + + /// Feature flags related to the website/server for various features and options: + /// - 'signup_with_optional_email_verification': Allow signup with optional email verification. + final List? featureFlags; + + /// Payments Agents system settings. + final PaymentAgents? paymentAgents; + + /// Provides codes for languages supported. + final List? supportedLanguages; + + /// Latest terms and conditions version. + final String? termsConditionsVersion; +} + +/// Website config class. +class WebsiteConfig extends WebsiteConfigModel { + /// Initializes Website config class. + const WebsiteConfig({ + required super.currenciesConfig, + super.featureFlags, + super.paymentAgents, + super.supportedLanguages, + super.termsConditionsVersion, + }); + + /// Creates an instance from JSON. + factory WebsiteConfig.fromJson(Map json) => WebsiteConfig( + currenciesConfig: Map.fromEntries( + json['currencies_config'] + .entries + .map>( + (MapEntry entry) => + MapEntry(entry.key, + CurrenciesConfigProperty.fromJson(entry.value)))), + featureFlags: json['feature_flags'] == null + ? null + : List.from( + json['feature_flags']?.map( + (dynamic item) => item, + ), + ), + paymentAgents: json['payment_agents'] == null + ? null + : PaymentAgents.fromJson(json['payment_agents']), + supportedLanguages: json['supported_languages'] == null + ? null + : List.from( + json['supported_languages']?.map( + (dynamic item) => item, + ), + ), + termsConditionsVersion: json['terms_conditions_version'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['currencies_config'] = currenciesConfig; + if (featureFlags != null) { + resultMap['feature_flags'] = featureFlags! + .map( + (String item) => item, + ) + .toList(); + } + if (paymentAgents != null) { + resultMap['payment_agents'] = paymentAgents!.toJson(); + } + if (supportedLanguages != null) { + resultMap['supported_languages'] = supportedLanguages! + .map( + (String item) => item, + ) + .toList(); + } + resultMap['terms_conditions_version'] = termsConditionsVersion; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + WebsiteConfig copyWith({ + Map? currenciesConfig, + List? featureFlags, + PaymentAgents? paymentAgents, + List? supportedLanguages, + String? termsConditionsVersion, + }) => + WebsiteConfig( + currenciesConfig: currenciesConfig ?? this.currenciesConfig, + featureFlags: featureFlags ?? this.featureFlags, + paymentAgents: paymentAgents ?? this.paymentAgents, + supportedLanguages: supportedLanguages ?? this.supportedLanguages, + termsConditionsVersion: + termsConditionsVersion ?? this.termsConditionsVersion, + ); +} +/// Currencies config property model class. +abstract class CurrenciesConfigPropertyModel { + /// Initializes Currencies config property model class . + const CurrenciesConfigPropertyModel({ + required this.type, + required this.transferBetweenAccounts, + required this.stakeDefault, + required this.isWithdrawalSuspended, + required this.isSuspended, + required this.isDepositSuspended, + required this.fractionalDigits, + this.name, + }); + + /// Type of the currency. + final TypeEnum type; + + /// Fees and range of allowed amount for transfer between accounts with different types of currencies. + final TransferBetweenAccounts transferBetweenAccounts; + + /// Default stake value for the currency. + final double stakeDefault; + + /// Current status for payment withdrawal for the currency + final double isWithdrawalSuspended; + + /// Current status for the currency + final double isSuspended; + + /// Current status for payment deposit for the currency + final double isDepositSuspended; + + /// Number of fractional digits. + final double fractionalDigits; + + /// Name of the currency. + final String? name; +} + +/// Currencies config property class. +class CurrenciesConfigProperty extends CurrenciesConfigPropertyModel { + /// Initializes Currencies config property class. + const CurrenciesConfigProperty({ + required super.fractionalDigits, + required super.isDepositSuspended, + required super.isSuspended, + required super.isWithdrawalSuspended, + required super.stakeDefault, + required super.transferBetweenAccounts, + required super.type, + super.name, + }); + + /// Creates an instance from JSON. + factory CurrenciesConfigProperty.fromJson(Map json) => + CurrenciesConfigProperty( + fractionalDigits: getDouble(json['fractional_digits'])!, + isDepositSuspended: getDouble(json['is_deposit_suspended'])!, + isSuspended: getDouble(json['is_suspended'])!, + isWithdrawalSuspended: getDouble(json['is_withdrawal_suspended'])!, + stakeDefault: getDouble(json['stake_default'])!, + transferBetweenAccounts: + TransferBetweenAccounts.fromJson(json['transfer_between_accounts']), + type: typeEnumMapper[json['type']]!, + name: json['name'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['fractional_digits'] = fractionalDigits; + resultMap['is_deposit_suspended'] = isDepositSuspended; + resultMap['is_suspended'] = isSuspended; + resultMap['is_withdrawal_suspended'] = isWithdrawalSuspended; + resultMap['stake_default'] = stakeDefault; + resultMap['transfer_between_accounts'] = transferBetweenAccounts.toJson(); + + resultMap['type'] = typeEnumMapper.entries + .firstWhere((MapEntry entry) => entry.value == type) + .key; + resultMap['name'] = name; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + CurrenciesConfigProperty copyWith({ + double? fractionalDigits, + double? isDepositSuspended, + double? isSuspended, + double? isWithdrawalSuspended, + double? stakeDefault, + TransferBetweenAccounts? transferBetweenAccounts, + TypeEnum? type, + String? name, + }) => + CurrenciesConfigProperty( + fractionalDigits: fractionalDigits ?? this.fractionalDigits, + isDepositSuspended: isDepositSuspended ?? this.isDepositSuspended, + isSuspended: isSuspended ?? this.isSuspended, + isWithdrawalSuspended: + isWithdrawalSuspended ?? this.isWithdrawalSuspended, + stakeDefault: stakeDefault ?? this.stakeDefault, + transferBetweenAccounts: + transferBetweenAccounts ?? this.transferBetweenAccounts, + type: type ?? this.type, + name: name ?? this.name, + ); +} +/// Transfer between accounts model class. +abstract class TransferBetweenAccountsModel { + /// Initializes Transfer between accounts model class . + const TransferBetweenAccountsModel({ + required this.limits, + required this.fees, + this.limitsCtrader, + this.limitsDerivez, + this.limitsDxtrade, + this.limitsMt5, + }); + + /// + final Limits limits; + + /// The fee that applies for transfer between accounts with different types of currencies. + final Map fees; + + /// Range of allowed amount for transfer between ctrader accounts. + final Map? limitsCtrader; + + /// Range of allowed amount for transfer between derivez accounts. + final Map? limitsDerivez; + + /// Range of allowed amount for transfer between dxtrade accounts. + final Map? limitsDxtrade; + + /// Range of allowed amount for transfer between mt5 accounts. + final Map? limitsMt5; +} + +/// Transfer between accounts class. +class TransferBetweenAccounts extends TransferBetweenAccountsModel { + /// Initializes Transfer between accounts class. + const TransferBetweenAccounts({ + required super.fees, + required super.limits, + super.limitsCtrader, + super.limitsDerivez, + super.limitsDxtrade, + super.limitsMt5, + }); + + /// Creates an instance from JSON. + factory TransferBetweenAccounts.fromJson(Map json) => + TransferBetweenAccounts( + fees: Map.fromEntries(json['fees'] + .entries + .map>((MapEntry entry) => + MapEntry(entry.key, getDouble(entry.value)!))), + limits: Limits.fromJson(json['limits']), + limitsCtrader: json['limits_ctrader'], + limitsDerivez: json['limits_derivez'], + limitsDxtrade: json['limits_dxtrade'], + limitsMt5: json['limits_mt5'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['fees'] = fees; + resultMap['limits'] = limits.toJson(); + + resultMap['limits_ctrader'] = limitsCtrader; + resultMap['limits_derivez'] = limitsDerivez; + resultMap['limits_dxtrade'] = limitsDxtrade; + resultMap['limits_mt5'] = limitsMt5; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + TransferBetweenAccounts copyWith({ + Map? fees, + Limits? limits, + Map? limitsCtrader, + Map? limitsDerivez, + Map? limitsDxtrade, + Map? limitsMt5, + }) => + TransferBetweenAccounts( + fees: fees ?? this.fees, + limits: limits ?? this.limits, + limitsCtrader: limitsCtrader ?? this.limitsCtrader, + limitsDerivez: limitsDerivez ?? this.limitsDerivez, + limitsDxtrade: limitsDxtrade ?? this.limitsDxtrade, + limitsMt5: limitsMt5 ?? this.limitsMt5, + ); +} +/// Limits model class. +abstract class LimitsModel { + /// Initializes Limits model class . + const LimitsModel({ + required this.min, + this.max, + }); + + /// Minimum allowed amount for transfer between accounts with different types of currencies. + final double min; + + /// Maximum allowed amount for transfer between accounts with different types of currencies. + final double? max; +} + +/// Limits class. +class Limits extends LimitsModel { + /// Initializes Limits class. + const Limits({ + required super.min, + super.max, + }); + + /// Creates an instance from JSON. + factory Limits.fromJson(Map json) => Limits( + min: getDouble(json['min'])!, + max: getDouble(json['max']), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['min'] = min; + resultMap['max'] = max; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + Limits copyWith({ + double? min, + double? max, + }) => + Limits( + min: min ?? this.min, + max: max ?? this.max, + ); +} +/// Payment agents model class. +abstract class PaymentAgentsModel { + /// Initializes Payment agents model class . + const PaymentAgentsModel({ + required this.initialDepositPerCountry, + }); + + /// Initial deposit requirement per country. + final Map initialDepositPerCountry; +} + +/// Payment agents class. +class PaymentAgents extends PaymentAgentsModel { + /// Initializes Payment agents class. + const PaymentAgents({ + required super.initialDepositPerCountry, + }); + + /// Creates an instance from JSON. + factory PaymentAgents.fromJson(Map json) => PaymentAgents( + initialDepositPerCountry: Map.fromEntries(json[ + 'initial_deposit_per_country'] + .entries + .map>((MapEntry entry) => + MapEntry(entry.key, getDouble(entry.value)!))), + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['initial_deposit_per_country'] = initialDepositPerCountry; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + PaymentAgents copyWith({ + Map? initialDepositPerCountry, + }) => + PaymentAgents( + initialDepositPerCountry: + initialDepositPerCountry ?? this.initialDepositPerCountry, + ); +} +/// Subscription model class. +abstract class SubscriptionModel { + /// Initializes Subscription model class . + const SubscriptionModel({ + required this.id, + }); + + /// A per-connection unique identifier. Can be passed to the `forget` API call to unsubscribe. + final String id; +} + +/// Subscription class. +class Subscription extends SubscriptionModel { + /// Initializes Subscription class. + const Subscription({ + required super.id, + }); + + /// Creates an instance from JSON. + factory Subscription.fromJson(Map json) => Subscription( + id: json['id'], + ); + + /// Converts an instance to JSON. + Map toJson() { + final Map resultMap = {}; + + resultMap['id'] = id; + + return resultMap; + } + + /// Creates a copy of instance with given parameters. + Subscription copyWith({ + String? id, + }) => + Subscription( + id: id ?? this.id, + ); +} diff --git a/lib/basic_api/generated/account_closure_receive.dart b/lib/basic_api/generated/account_closure_receive.dart index a0c490febd..6513aeb366 100644 --- a/lib/basic_api/generated/account_closure_receive.dart +++ b/lib/basic_api/generated/account_closure_receive.dart @@ -9,16 +9,11 @@ class AccountClosureReceive extends Response { /// Initialize AccountClosureReceive. const AccountClosureReceive({ this.accountClosure, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory AccountClosureReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/account_closure_send.dart b/lib/basic_api/generated/account_closure_send.dart index 2ba5ed7be7..a36a91b235 100644 --- a/lib/basic_api/generated/account_closure_send.dart +++ b/lib/basic_api/generated/account_closure_send.dart @@ -9,14 +9,12 @@ class AccountClosureRequest extends Request { /// Initialize AccountClosureRequest. const AccountClosureRequest({ this.accountClosure = true, + this.loginid, required this.reason, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'account_closure', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'account_closure', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory AccountClosureRequest.fromJson(Map json) => @@ -24,6 +22,7 @@ class AccountClosureRequest extends Request { accountClosure: json['account_closure'] == null ? null : json['account_closure'] == 1, + loginid: json['loginid'] as String?, reason: json['reason'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, @@ -32,6 +31,9 @@ class AccountClosureRequest extends Request { /// Must be `true` final bool? accountClosure; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Reason for closing off accounts. final String? reason; @@ -43,6 +45,7 @@ class AccountClosureRequest extends Request { : accountClosure! ? 1 : 0, + 'loginid': loginid, 'reason': reason, 'passthrough': passthrough, 'req_id': reqId, @@ -52,12 +55,14 @@ class AccountClosureRequest extends Request { @override AccountClosureRequest copyWith({ bool? accountClosure, + String? loginid, String? reason, Map? passthrough, int? reqId, }) => AccountClosureRequest( accountClosure: accountClosure ?? this.accountClosure, + loginid: loginid ?? this.loginid, reason: reason ?? this.reason, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/account_list_receive.dart b/lib/basic_api/generated/account_list_receive.dart new file mode 100644 index 0000000000..cb47d31d92 --- /dev/null +++ b/lib/basic_api/generated/account_list_receive.dart @@ -0,0 +1,64 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/account_list_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Account list receive class. +class AccountListReceive extends Response { + /// Initialize AccountListReceive. + const AccountListReceive({ + this.accountList, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory AccountListReceive.fromJson(Map json) => + AccountListReceive( + accountList: (json['account_list'] as List?) + ?.map>( + (dynamic item) => item as Map) + .toList(), + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// List of accounts for current user. This is also available from the `authroize` call. + final List>? accountList; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'account_list': accountList, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + AccountListReceive copyWith({ + List>? accountList, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + AccountListReceive( + accountList: accountList ?? this.accountList, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/account_list_send.dart b/lib/basic_api/generated/account_list_send.dart new file mode 100644 index 0000000000..e16e9c6475 --- /dev/null +++ b/lib/basic_api/generated/account_list_send.dart @@ -0,0 +1,57 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/account_list_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Account list request class. +class AccountListRequest extends Request { + /// Initialize AccountListRequest. + const AccountListRequest({ + this.accountList = true, + super.msgType = 'account_list', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory AccountListRequest.fromJson(Map json) => + AccountListRequest( + accountList: + json['account_list'] == null ? null : json['account_list'] == 1, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// Must be `true` + final bool? accountList; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'account_list': accountList == null + ? null + : accountList! + ? 1 + : 0, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + AccountListRequest copyWith({ + bool? accountList, + Map? passthrough, + int? reqId, + }) => + AccountListRequest( + accountList: accountList ?? this.accountList, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/account_security_receive.dart b/lib/basic_api/generated/account_security_receive.dart index b60aca7fdf..53bd28474c 100644 --- a/lib/basic_api/generated/account_security_receive.dart +++ b/lib/basic_api/generated/account_security_receive.dart @@ -9,16 +9,11 @@ class AccountSecurityReceive extends Response { /// Initialize AccountSecurityReceive. const AccountSecurityReceive({ this.accountSecurity, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory AccountSecurityReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/account_security_send.dart b/lib/basic_api/generated/account_security_send.dart index ce89f926c3..01d5c034df 100644 --- a/lib/basic_api/generated/account_security_send.dart +++ b/lib/basic_api/generated/account_security_send.dart @@ -9,15 +9,13 @@ class AccountSecurityRequest extends Request { /// Initialize AccountSecurityRequest. const AccountSecurityRequest({ this.accountSecurity = true, + this.loginid, this.otp, this.totpAction, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'account_security', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'account_security', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory AccountSecurityRequest.fromJson(Map json) => @@ -25,6 +23,7 @@ class AccountSecurityRequest extends Request { accountSecurity: json['account_security'] == null ? null : json['account_security'] == 1, + loginid: json['loginid'] as String?, otp: json['otp'] as String?, totpAction: json['totp_action'] as String?, passthrough: json['passthrough'] as Map?, @@ -34,6 +33,9 @@ class AccountSecurityRequest extends Request { /// Must be `true` final bool? accountSecurity; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] OTP (one-time passcode) generated by a 2FA application like Authy, Google Authenticator or Yubikey. final String? otp; @@ -48,6 +50,7 @@ class AccountSecurityRequest extends Request { : accountSecurity! ? 1 : 0, + 'loginid': loginid, 'otp': otp, 'totp_action': totpAction, 'passthrough': passthrough, @@ -58,6 +61,7 @@ class AccountSecurityRequest extends Request { @override AccountSecurityRequest copyWith({ bool? accountSecurity, + String? loginid, String? otp, String? totpAction, Map? passthrough, @@ -65,6 +69,7 @@ class AccountSecurityRequest extends Request { }) => AccountSecurityRequest( accountSecurity: accountSecurity ?? this.accountSecurity, + loginid: loginid ?? this.loginid, otp: otp ?? this.otp, totpAction: totpAction ?? this.totpAction, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/account_statistics_receive.dart b/lib/basic_api/generated/account_statistics_receive.dart index 109ee867ae..78d822532d 100644 --- a/lib/basic_api/generated/account_statistics_receive.dart +++ b/lib/basic_api/generated/account_statistics_receive.dart @@ -9,16 +9,11 @@ class AccountStatisticsReceive extends Response { /// Initialize AccountStatisticsReceive. const AccountStatisticsReceive({ this.accountStatistics, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory AccountStatisticsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/account_statistics_send.dart b/lib/basic_api/generated/account_statistics_send.dart index 5641955a42..446d0e0d06 100644 --- a/lib/basic_api/generated/account_statistics_send.dart +++ b/lib/basic_api/generated/account_statistics_send.dart @@ -9,13 +9,11 @@ class AccountStatisticsRequest extends Request { /// Initialize AccountStatisticsRequest. const AccountStatisticsRequest({ this.accountStatistics = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'account_statistics', - passthrough: passthrough, - reqId: reqId, - ); + this.loginid, + super.msgType = 'account_statistics', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory AccountStatisticsRequest.fromJson(Map json) => @@ -23,6 +21,7 @@ class AccountStatisticsRequest extends Request { accountStatistics: json['account_statistics'] == null ? null : json['account_statistics'] == 1, + loginid: json['loginid'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -30,6 +29,9 @@ class AccountStatisticsRequest extends Request { /// Must be `true` final bool? accountStatistics; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Converts this instance to JSON @override Map toJson() => { @@ -38,6 +40,7 @@ class AccountStatisticsRequest extends Request { : accountStatistics! ? 1 : 0, + 'loginid': loginid, 'passthrough': passthrough, 'req_id': reqId, }; @@ -46,11 +49,13 @@ class AccountStatisticsRequest extends Request { @override AccountStatisticsRequest copyWith({ bool? accountStatistics, + String? loginid, Map? passthrough, int? reqId, }) => AccountStatisticsRequest( accountStatistics: accountStatistics ?? this.accountStatistics, + loginid: loginid ?? this.loginid, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/active_symbols_receive.dart b/lib/basic_api/generated/active_symbols_receive.dart index 623f962170..11d8cfb9ce 100644 --- a/lib/basic_api/generated/active_symbols_receive.dart +++ b/lib/basic_api/generated/active_symbols_receive.dart @@ -9,16 +9,11 @@ class ActiveSymbolsReceive extends Response { /// Initialize ActiveSymbolsReceive. const ActiveSymbolsReceive({ this.activeSymbols, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory ActiveSymbolsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/active_symbols_send.dart b/lib/basic_api/generated/active_symbols_send.dart index 7881e17d16..116d56c523 100644 --- a/lib/basic_api/generated/active_symbols_send.dart +++ b/lib/basic_api/generated/active_symbols_send.dart @@ -9,21 +9,26 @@ class ActiveSymbolsRequest extends Request { /// Initialize ActiveSymbolsRequest. const ActiveSymbolsRequest({ required this.activeSymbols, - this.landingCompany, + this.contractType, + required this.landingCompany, + this.landingCompanyShort, + this.loginid, this.productType, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'active_symbols', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'active_symbols', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory ActiveSymbolsRequest.fromJson(Map json) => ActiveSymbolsRequest( activeSymbols: json['active_symbols'] as String?, + contractType: (json['contract_type'] as List?) + ?.map((dynamic item) => item as String) + .toList(), landingCompany: json['landing_company'] as String?, + landingCompanyShort: json['landing_company_short'] as String?, + loginid: json['loginid'] as String?, productType: json['product_type'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, @@ -32,9 +37,18 @@ class ActiveSymbolsRequest extends Request { /// If you use `brief`, only a subset of fields will be returned. final String? activeSymbols; - /// [Optional] If you specify this field, only symbols available for trading by that landing company will be returned. If you are logged in, only symbols available for trading by your landing company will be returned regardless of what you specify in this field. + /// [Optional] The proposed contract type + final List? contractType; + + /// Deprecated - replaced by landing_company_short. final String? landingCompany; + /// [Optional] If you specify this field, only symbols available for trading by that landing company will be returned. If you are logged in, only symbols available for trading by your landing company will be returned regardless of what you specify in this field. + final String? landingCompanyShort; + + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] If you specify this field, only symbols that can be traded through that product type will be returned. final String? productType; @@ -42,7 +56,10 @@ class ActiveSymbolsRequest extends Request { @override Map toJson() => { 'active_symbols': activeSymbols, + 'contract_type': contractType, 'landing_company': landingCompany, + 'landing_company_short': landingCompanyShort, + 'loginid': loginid, 'product_type': productType, 'passthrough': passthrough, 'req_id': reqId, @@ -52,14 +69,20 @@ class ActiveSymbolsRequest extends Request { @override ActiveSymbolsRequest copyWith({ String? activeSymbols, + List? contractType, String? landingCompany, + String? landingCompanyShort, + String? loginid, String? productType, Map? passthrough, int? reqId, }) => ActiveSymbolsRequest( activeSymbols: activeSymbols ?? this.activeSymbols, + contractType: contractType ?? this.contractType, landingCompany: landingCompany ?? this.landingCompany, + landingCompanyShort: landingCompanyShort ?? this.landingCompanyShort, + loginid: loginid ?? this.loginid, productType: productType ?? this.productType, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/affiliate_add_company_receive.dart b/lib/basic_api/generated/affiliate_add_company_receive.dart new file mode 100644 index 0000000000..6eeea4e118 --- /dev/null +++ b/lib/basic_api/generated/affiliate_add_company_receive.dart @@ -0,0 +1,62 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/affiliate_add_company_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Affiliate add company receive class. +class AffiliateAddCompanyReceive extends Response { + /// Initialize AffiliateAddCompanyReceive. + const AffiliateAddCompanyReceive({ + this.affiliateAddCompany, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory AffiliateAddCompanyReceive.fromJson(Map json) => + AffiliateAddCompanyReceive( + affiliateAddCompany: + json['affiliate_add_company'] as Map?, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// The information of the affiliate user trying to register. + final Map? affiliateAddCompany; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'affiliate_add_company': affiliateAddCompany, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + AffiliateAddCompanyReceive copyWith({ + Map? affiliateAddCompany, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + AffiliateAddCompanyReceive( + affiliateAddCompany: affiliateAddCompany ?? this.affiliateAddCompany, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/affiliate_add_company_send.dart b/lib/basic_api/generated/affiliate_add_company_send.dart new file mode 100644 index 0000000000..42c2fdbda3 --- /dev/null +++ b/lib/basic_api/generated/affiliate_add_company_send.dart @@ -0,0 +1,252 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/affiliate_add_company_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Affiliate add company request class. +class AffiliateAddCompanyRequest extends Request { + /// Initialize AffiliateAddCompanyRequest. + const AffiliateAddCompanyRequest({ + required this.addressCity, + required this.addressPostcode, + required this.addressState, + required this.addressStreet, + this.affiliateAddCompany = true, + this.bta, + required this.citizenship, + required this.companyName, + required this.companyRegisterNumber, + required this.country, + required this.currency, + required this.dateOfBirth, + required this.firstName, + required this.lastName, + this.loginid, + required this.nonPepDeclaration, + required this.password, + required this.phone, + required this.promoteEu, + required this.receiveMarketingEmails, + required this.socialMediaUrl, + required this.tncAccepted, + required this.tncAffiliateAccepted, + required this.verificationCode, + required this.websiteUrl, + super.msgType = 'affiliate_add_company', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory AffiliateAddCompanyRequest.fromJson(Map json) => + AffiliateAddCompanyRequest( + addressCity: json['address_city'] as String?, + addressPostcode: json['address_postcode'] as String?, + addressState: json['address_state'] as String?, + addressStreet: json['address_street'] as String?, + affiliateAddCompany: json['affiliate_add_company'] == null + ? null + : json['affiliate_add_company'] == 1, + bta: json['bta'] as int?, + citizenship: json['citizenship'] as String?, + companyName: json['company_name'] as String?, + companyRegisterNumber: json['company_register_number'] as String?, + country: json['country'] as String?, + currency: json['currency'] as String?, + dateOfBirth: json['date_of_birth'] as String?, + firstName: json['first_name'] as String?, + lastName: json['last_name'] as String?, + loginid: json['loginid'] as String?, + nonPepDeclaration: json['non_pep_declaration'] as int?, + password: json['password'] as String?, + phone: json['phone'] as String?, + promoteEu: json['promote_eu'] as int?, + receiveMarketingEmails: json['receive_marketing_emails'] as int?, + socialMediaUrl: json['social_media_url'] as String?, + tncAccepted: json['tnc_accepted'] as int?, + tncAffiliateAccepted: json['tnc_affiliate_accepted'] as int?, + verificationCode: json['verification_code'] as String?, + websiteUrl: json['website_url'] as String?, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// City name within 50 characters. + final String? addressCity; + + /// Within 20 characters and may not contain '+'. + final String? addressPostcode; + + /// Possible value receive from `states_list` call. + final String? addressState; + + /// Within 70 characters, with no leading whitespaces and may contain letters/numbers and/or any of following characters '.,:;()@#/- + final String? addressStreet; + + /// [Required] Must be `true` + final bool? affiliateAddCompany; + + /// [Optional] BTA id field for master affiliate. + final int? bta; + + /// Country of citizenship, 2-letter country code. + final String? citizenship; + + /// Name of the company. + final String? companyName; + + /// Social media URL of the affiliate trying to register. + final String? companyRegisterNumber; + + /// Name of the country that currently reside, 2-letter country code. + final String? country; + + /// Currency of affiliate that wants to work with. + final String? currency; + + /// Birth date of affiliate user trying to register + final String? dateOfBirth; + + /// The official first name of the affiliate. Within 2-50 characters, use only letters, spaces, hyphens, full-stops or apostrophes. + final String? firstName; + + /// The official last name of the affiliate. Within 2-50 characters, use only letters, spaces, hyphens, full-stops or apostrophes. + final String? lastName; + + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + + /// Indicates client's self-declaration of not being a PEP/RCA (Politically Exposed Person/Relatives and Close Associates). + final int? nonPepDeclaration; + + /// Password for the affiliate account. (Accepts any printable ASCII character. Must be between 6-50 characters, and include numbers, lowercase and uppercase letters.). + final String? password; + + /// Registered phone number of the affiliate. Starting with `+` followed by 8-35 digits, allowing hyphens or space. + final String? phone; + + /// Indicates client is going to promote its account to EU or not. + final int? promoteEu; + + /// Indicates client has agreed to receive marketing emails or not. + final int? receiveMarketingEmails; + + /// Social media URL of the affiliate trying to register. + final String? socialMediaUrl; + + /// Indicates client has agreed to the terms and conditions. + final int? tncAccepted; + + /// Indicates client has agreed to the terms and conditions for affiliates. + final int? tncAffiliateAccepted; + + /// Email verification code (received from a `verify_email` call, which must be done first). + final String? verificationCode; + + /// Social media URL of the affiliate trying to register. + final String? websiteUrl; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'address_city': addressCity, + 'address_postcode': addressPostcode, + 'address_state': addressState, + 'address_street': addressStreet, + 'affiliate_add_company': affiliateAddCompany == null + ? null + : affiliateAddCompany! + ? 1 + : 0, + 'bta': bta, + 'citizenship': citizenship, + 'company_name': companyName, + 'company_register_number': companyRegisterNumber, + 'country': country, + 'currency': currency, + 'date_of_birth': dateOfBirth, + 'first_name': firstName, + 'last_name': lastName, + 'loginid': loginid, + 'non_pep_declaration': nonPepDeclaration, + 'password': password, + 'phone': phone, + 'promote_eu': promoteEu, + 'receive_marketing_emails': receiveMarketingEmails, + 'social_media_url': socialMediaUrl, + 'tnc_accepted': tncAccepted, + 'tnc_affiliate_accepted': tncAffiliateAccepted, + 'verification_code': verificationCode, + 'website_url': websiteUrl, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + AffiliateAddCompanyRequest copyWith({ + String? addressCity, + String? addressPostcode, + String? addressState, + String? addressStreet, + bool? affiliateAddCompany, + int? bta, + String? citizenship, + String? companyName, + String? companyRegisterNumber, + String? country, + String? currency, + String? dateOfBirth, + String? firstName, + String? lastName, + String? loginid, + int? nonPepDeclaration, + String? password, + String? phone, + int? promoteEu, + int? receiveMarketingEmails, + String? socialMediaUrl, + int? tncAccepted, + int? tncAffiliateAccepted, + String? verificationCode, + String? websiteUrl, + Map? passthrough, + int? reqId, + }) => + AffiliateAddCompanyRequest( + addressCity: addressCity ?? this.addressCity, + addressPostcode: addressPostcode ?? this.addressPostcode, + addressState: addressState ?? this.addressState, + addressStreet: addressStreet ?? this.addressStreet, + affiliateAddCompany: affiliateAddCompany ?? this.affiliateAddCompany, + bta: bta ?? this.bta, + citizenship: citizenship ?? this.citizenship, + companyName: companyName ?? this.companyName, + companyRegisterNumber: + companyRegisterNumber ?? this.companyRegisterNumber, + country: country ?? this.country, + currency: currency ?? this.currency, + dateOfBirth: dateOfBirth ?? this.dateOfBirth, + firstName: firstName ?? this.firstName, + lastName: lastName ?? this.lastName, + loginid: loginid ?? this.loginid, + nonPepDeclaration: nonPepDeclaration ?? this.nonPepDeclaration, + password: password ?? this.password, + phone: phone ?? this.phone, + promoteEu: promoteEu ?? this.promoteEu, + receiveMarketingEmails: + receiveMarketingEmails ?? this.receiveMarketingEmails, + socialMediaUrl: socialMediaUrl ?? this.socialMediaUrl, + tncAccepted: tncAccepted ?? this.tncAccepted, + tncAffiliateAccepted: tncAffiliateAccepted ?? this.tncAffiliateAccepted, + verificationCode: verificationCode ?? this.verificationCode, + websiteUrl: websiteUrl ?? this.websiteUrl, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/affiliate_add_person_receive.dart b/lib/basic_api/generated/affiliate_add_person_receive.dart new file mode 100644 index 0000000000..85f0fb3925 --- /dev/null +++ b/lib/basic_api/generated/affiliate_add_person_receive.dart @@ -0,0 +1,62 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/affiliate_add_person_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Affiliate add person receive class. +class AffiliateAddPersonReceive extends Response { + /// Initialize AffiliateAddPersonReceive. + const AffiliateAddPersonReceive({ + this.affiliateAddPerson, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory AffiliateAddPersonReceive.fromJson(Map json) => + AffiliateAddPersonReceive( + affiliateAddPerson: + json['affiliate_add_person'] as Map?, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// The information of the affiliate user trying to register. + final Map? affiliateAddPerson; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'affiliate_add_person': affiliateAddPerson, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + AffiliateAddPersonReceive copyWith({ + Map? affiliateAddPerson, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + AffiliateAddPersonReceive( + affiliateAddPerson: affiliateAddPerson ?? this.affiliateAddPerson, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/affiliate_add_person_send.dart b/lib/basic_api/generated/affiliate_add_person_send.dart new file mode 100644 index 0000000000..47a599af68 --- /dev/null +++ b/lib/basic_api/generated/affiliate_add_person_send.dart @@ -0,0 +1,251 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/affiliate_add_person_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Affiliate add person request class. +class AffiliateAddPersonRequest extends Request { + /// Initialize AffiliateAddPersonRequest. + const AffiliateAddPersonRequest({ + required this.addressCity, + required this.addressLine1, + this.addressLine2, + required this.addressPostcode, + required this.addressState, + required this.addressStreet, + this.affiliateAddPerson = true, + this.bta, + required this.citizenship, + required this.country, + required this.currency, + required this.dateOfBirth, + required this.firstName, + required this.lastName, + this.loginid, + required this.nonPepDeclaration, + required this.password, + required this.phone, + required this.promoteEu, + required this.receiveMarketingEmails, + required this.socialMediaUrl, + required this.tncAccepted, + required this.tncAffiliateAccepted, + required this.verificationCode, + required this.websiteUrl, + super.msgType = 'affiliate_add_person', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory AffiliateAddPersonRequest.fromJson(Map json) => + AffiliateAddPersonRequest( + addressCity: json['address_city'] as String?, + addressLine1: json['address_line_1'] as String?, + addressLine2: json['address_line_2'] as String?, + addressPostcode: json['address_postcode'] as String?, + addressState: json['address_state'] as String?, + addressStreet: json['address_street'] as String?, + affiliateAddPerson: json['affiliate_add_person'] == null + ? null + : json['affiliate_add_person'] == 1, + bta: json['bta'] as int?, + citizenship: json['citizenship'] as String?, + country: json['country'] as String?, + currency: json['currency'] as String?, + dateOfBirth: json['date_of_birth'] as String?, + firstName: json['first_name'] as String?, + lastName: json['last_name'] as String?, + loginid: json['loginid'] as String?, + nonPepDeclaration: json['non_pep_declaration'] as int?, + password: json['password'] as String?, + phone: json['phone'] as String?, + promoteEu: json['promote_eu'] as int?, + receiveMarketingEmails: json['receive_marketing_emails'] as int?, + socialMediaUrl: json['social_media_url'] as String?, + tncAccepted: json['tnc_accepted'] as int?, + tncAffiliateAccepted: json['tnc_affiliate_accepted'] as int?, + verificationCode: json['verification_code'] as String?, + websiteUrl: json['website_url'] as String?, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// City name within 50 characters. + final String? addressCity; + + /// Within 70 characters, with no leading whitespaces and may contain letters/numbers and/or any of following characters '.,:;()@#/- + final String? addressLine1; + + /// [Optional] Within 70 characters. + final String? addressLine2; + + /// Within 20 characters and may not contain '+'. + final String? addressPostcode; + + /// Possible value receive from `states_list` call. + final String? addressState; + + /// Within 70 characters, with no leading whitespaces and may contain letters/numbers and/or any of following characters '.,:;()@#/- + final String? addressStreet; + + /// [Required] Must be `true` + final bool? affiliateAddPerson; + + /// [Optional] BTA id field for master affiliate. + final int? bta; + + /// Country of citizenship, 2-letter country code. + final String? citizenship; + + /// Name of the country that currently reside, 2-letter country code. + final String? country; + + /// Currency of affiliate that wants to work with. + final String? currency; + + /// Birth date of affiliate user trying to register + final String? dateOfBirth; + + /// The official first name of the affiliate. Within 2-50 characters, use only letters, spaces, hyphens, full-stops or apostrophes. + final String? firstName; + + /// The official last name of the affiliate. Within 2-50 characters, use only letters, spaces, hyphens, full-stops or apostrophes. + final String? lastName; + + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + + /// Indicates client's self-declaration of not being a PEP/RCA (Politically Exposed Person/Relatives and Close Associates). + final int? nonPepDeclaration; + + /// Password for the affiliate account. (Accepts any printable ASCII character. Must be between 6-50 characters, and include numbers, lowercase and uppercase letters.). + final String? password; + + /// Registered phone number of the affiliate. Starting with `+` followed by 8-35 digits, allowing hyphens or space. + final String? phone; + + /// Indicates client is going to promote its account to EU or not. + final int? promoteEu; + + /// Indicates client has agreed to receive marketing emails or not. + final int? receiveMarketingEmails; + + /// Social media URL of the affiliate trying to register. + final String? socialMediaUrl; + + /// Indicates client has agreed to the terms and conditions. + final int? tncAccepted; + + /// Indicates client has agreed to the terms and conditions for affiliates. + final int? tncAffiliateAccepted; + + /// Email verification code (received from a `verify_email` call, which must be done first). + final String? verificationCode; + + /// Social media URL of the affiliate trying to register. + final String? websiteUrl; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'address_city': addressCity, + 'address_line_1': addressLine1, + 'address_line_2': addressLine2, + 'address_postcode': addressPostcode, + 'address_state': addressState, + 'address_street': addressStreet, + 'affiliate_add_person': affiliateAddPerson == null + ? null + : affiliateAddPerson! + ? 1 + : 0, + 'bta': bta, + 'citizenship': citizenship, + 'country': country, + 'currency': currency, + 'date_of_birth': dateOfBirth, + 'first_name': firstName, + 'last_name': lastName, + 'loginid': loginid, + 'non_pep_declaration': nonPepDeclaration, + 'password': password, + 'phone': phone, + 'promote_eu': promoteEu, + 'receive_marketing_emails': receiveMarketingEmails, + 'social_media_url': socialMediaUrl, + 'tnc_accepted': tncAccepted, + 'tnc_affiliate_accepted': tncAffiliateAccepted, + 'verification_code': verificationCode, + 'website_url': websiteUrl, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + AffiliateAddPersonRequest copyWith({ + String? addressCity, + String? addressLine1, + String? addressLine2, + String? addressPostcode, + String? addressState, + String? addressStreet, + bool? affiliateAddPerson, + int? bta, + String? citizenship, + String? country, + String? currency, + String? dateOfBirth, + String? firstName, + String? lastName, + String? loginid, + int? nonPepDeclaration, + String? password, + String? phone, + int? promoteEu, + int? receiveMarketingEmails, + String? socialMediaUrl, + int? tncAccepted, + int? tncAffiliateAccepted, + String? verificationCode, + String? websiteUrl, + Map? passthrough, + int? reqId, + }) => + AffiliateAddPersonRequest( + addressCity: addressCity ?? this.addressCity, + addressLine1: addressLine1 ?? this.addressLine1, + addressLine2: addressLine2 ?? this.addressLine2, + addressPostcode: addressPostcode ?? this.addressPostcode, + addressState: addressState ?? this.addressState, + addressStreet: addressStreet ?? this.addressStreet, + affiliateAddPerson: affiliateAddPerson ?? this.affiliateAddPerson, + bta: bta ?? this.bta, + citizenship: citizenship ?? this.citizenship, + country: country ?? this.country, + currency: currency ?? this.currency, + dateOfBirth: dateOfBirth ?? this.dateOfBirth, + firstName: firstName ?? this.firstName, + lastName: lastName ?? this.lastName, + loginid: loginid ?? this.loginid, + nonPepDeclaration: nonPepDeclaration ?? this.nonPepDeclaration, + password: password ?? this.password, + phone: phone ?? this.phone, + promoteEu: promoteEu ?? this.promoteEu, + receiveMarketingEmails: + receiveMarketingEmails ?? this.receiveMarketingEmails, + socialMediaUrl: socialMediaUrl ?? this.socialMediaUrl, + tncAccepted: tncAccepted ?? this.tncAccepted, + tncAffiliateAccepted: tncAffiliateAccepted ?? this.tncAffiliateAccepted, + verificationCode: verificationCode ?? this.verificationCode, + websiteUrl: websiteUrl ?? this.websiteUrl, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/affiliate_register_person_receive.dart b/lib/basic_api/generated/affiliate_register_person_receive.dart new file mode 100644 index 0000000000..d4be8f3afb --- /dev/null +++ b/lib/basic_api/generated/affiliate_register_person_receive.dart @@ -0,0 +1,65 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/affiliate_register_person_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Affiliate register person receive class. +class AffiliateRegisterPersonReceive extends Response { + /// Initialize AffiliateRegisterPersonReceive. + const AffiliateRegisterPersonReceive({ + this.success, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory AffiliateRegisterPersonReceive.fromJson(Map json) => + AffiliateRegisterPersonReceive( + success: json['success'] == null ? null : json['success'] == 1, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// Affiliate was successfully added, `false`:unsuccessful `true`:successful + final bool? success; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'success': success == null + ? null + : success! + ? 1 + : 0, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + AffiliateRegisterPersonReceive copyWith({ + bool? success, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + AffiliateRegisterPersonReceive( + success: success ?? this.success, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/affiliate_register_person_send.dart b/lib/basic_api/generated/affiliate_register_person_send.dart new file mode 100644 index 0000000000..efcf57615c --- /dev/null +++ b/lib/basic_api/generated/affiliate_register_person_send.dart @@ -0,0 +1,309 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/affiliate_register_person_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Affiliate register person request class. +class AffiliateRegisterPersonRequest extends Request { + /// Initialize AffiliateRegisterPersonRequest. + const AffiliateRegisterPersonRequest({ + required this.addressCity, + required this.addressPostcode, + required this.addressState, + required this.addressStreet, + this.affiliateRegisterPerson = true, + required this.citizenship, + required this.commissionPlan, + required this.companyName, + required this.companyRegistrationNumber, + required this.country, + required this.currency, + required this.dateOfBirth, + required this.email, + required this.firstName, + required this.lastName, + this.loginid, + required this.nonPepDeclaration, + required this.over18Declaration, + required this.password, + required this.phone, + required this.phoneCode, + required this.promoteEu, + required this.receiveMarketingEmails, + required this.socialMediaUrl, + required this.tncAccepted, + required this.tncAffiliateAccepted, + required this.typeOfAccount, + required this.userName, + required this.websiteUrl, + required this.whatsappNumber, + required this.whatsappNumberPhoneCode, + super.msgType = 'affiliate_register_person', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory AffiliateRegisterPersonRequest.fromJson(Map json) => + AffiliateRegisterPersonRequest( + addressCity: json['address_city'] as String?, + addressPostcode: json['address_postcode'] as String?, + addressState: json['address_state'] as String?, + addressStreet: json['address_street'] as String?, + affiliateRegisterPerson: json['affiliate_register_person'] == null + ? null + : json['affiliate_register_person'] == 1, + citizenship: json['citizenship'] as String?, + commissionPlan: json['commission_plan'] as int?, + companyName: json['company_name'] as String?, + companyRegistrationNumber: + json['company_registration_number'] as String?, + country: json['country'] as String?, + currency: json['currency'] as String?, + dateOfBirth: json['date_of_birth'] as String?, + email: json['email'] as String?, + firstName: json['first_name'] as String?, + lastName: json['last_name'] as String?, + loginid: json['loginid'] as String?, + nonPepDeclaration: json['non_pep_declaration'] as int?, + over18Declaration: json['over_18_declaration'] == null + ? null + : json['over_18_declaration'] == 1, + password: json['password'] as String?, + phone: json['phone'] as String?, + phoneCode: json['phone_code'] as String?, + promoteEu: json['promote_eu'] as int?, + receiveMarketingEmails: json['receive_marketing_emails'] as int?, + socialMediaUrl: json['social_media_url'] as String?, + tncAccepted: json['tnc_accepted'] as int?, + tncAffiliateAccepted: json['tnc_affiliate_accepted'] as int?, + typeOfAccount: json['type_of_account'] as int?, + userName: json['user_name'] as String?, + websiteUrl: json['website_url'] as String?, + whatsappNumber: json['whatsapp_number'] as String?, + whatsappNumberPhoneCode: json['whatsapp_number_phoneCode'] as String?, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// City name within 50 characters. + final String? addressCity; + + /// Within 20 characters and may not contain '+'. + final String? addressPostcode; + + /// Possible value receive from `states_list` call. + final String? addressState; + + /// Within 70 characters, with no leading whitespaces and may contain letters/numbers and/or any of following characters '.,:;()@#/- + final String? addressStreet; + + /// [Required] Must be `true` + final bool? affiliateRegisterPerson; + + /// Name of the country that the user is citizen of, 2-letter country code. + final String? citizenship; + + /// Commission plan selected by affiliate 2 RevShare, 4. Turnover + final int? commissionPlan; + + /// Name of the company. + final String? companyName; + + /// Registration number of the company + final String? companyRegistrationNumber; + + /// Name of the country that currently reside, 2-letter country code. + final String? country; + + /// Currency of affiliate that wants to work with. + final String? currency; + + /// Birth date of affiliate user trying to register + final String? dateOfBirth; + + /// Email address + final String? email; + + /// The official first name of the affiliate. Within 2-50 characters, use only letters, spaces, hyphens, full-stops or apostrophes. + final String? firstName; + + /// The official last name of the affiliate. Within 2-50 characters, use only letters, spaces, hyphens, full-stops or apostrophes. + final String? lastName; + + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + + /// Indicates client's self-declaration of not being a PEP/RCA (Politically Exposed Person/Relatives and Close Associates). + final int? nonPepDeclaration; + + /// Indicates client's self-declaration of being over `true`8 in age + final bool? over18Declaration; + + /// Password for the affiliate account. (Accepts any printable ASCII character. Must be between 6-50 characters, and include numbers, lowercase and uppercase letters.). + final String? password; + + /// Registered phone number of the affiliate. Starting with `+` followed by 8-35 digits, allowing hyphens or space. + final String? phone; + + /// Phone code without the starting + sign + final String? phoneCode; + + /// Indicates client is going to promote its account to EU or not. + final int? promoteEu; + + /// Indicates client has agreed to receive marketing emails or not. + final int? receiveMarketingEmails; + + /// Social media URL of the affiliate trying to register. + final String? socialMediaUrl; + + /// Indicates client has agreed to the terms and conditions. + final int? tncAccepted; + + /// Indicates client has agreed to the terms and conditions for affiliates. + final int? tncAffiliateAccepted; + + /// Account type select 1 business, 2 individual + final int? typeOfAccount; + + /// Username of affiliate, will be unique everytime + final String? userName; + + /// Social media URL of the affiliate trying to register. + final String? websiteUrl; + + /// Whatsapp phone number of the affiliate. Starting with `+` followed by 8-35 digits, allowing hyphens or space. + final String? whatsappNumber; + + /// Whatsapp code without the starting + sign + final String? whatsappNumberPhoneCode; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'address_city': addressCity, + 'address_postcode': addressPostcode, + 'address_state': addressState, + 'address_street': addressStreet, + 'affiliate_register_person': affiliateRegisterPerson == null + ? null + : affiliateRegisterPerson! + ? 1 + : 0, + 'citizenship': citizenship, + 'commission_plan': commissionPlan, + 'company_name': companyName, + 'company_registration_number': companyRegistrationNumber, + 'country': country, + 'currency': currency, + 'date_of_birth': dateOfBirth, + 'email': email, + 'first_name': firstName, + 'last_name': lastName, + 'loginid': loginid, + 'non_pep_declaration': nonPepDeclaration, + 'over_18_declaration': over18Declaration == null + ? null + : over18Declaration! + ? 1 + : 0, + 'password': password, + 'phone': phone, + 'phone_code': phoneCode, + 'promote_eu': promoteEu, + 'receive_marketing_emails': receiveMarketingEmails, + 'social_media_url': socialMediaUrl, + 'tnc_accepted': tncAccepted, + 'tnc_affiliate_accepted': tncAffiliateAccepted, + 'type_of_account': typeOfAccount, + 'user_name': userName, + 'website_url': websiteUrl, + 'whatsapp_number': whatsappNumber, + 'whatsapp_number_phoneCode': whatsappNumberPhoneCode, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + AffiliateRegisterPersonRequest copyWith({ + String? addressCity, + String? addressPostcode, + String? addressState, + String? addressStreet, + bool? affiliateRegisterPerson, + String? citizenship, + int? commissionPlan, + String? companyName, + String? companyRegistrationNumber, + String? country, + String? currency, + String? dateOfBirth, + String? email, + String? firstName, + String? lastName, + String? loginid, + int? nonPepDeclaration, + bool? over18Declaration, + String? password, + String? phone, + String? phoneCode, + int? promoteEu, + int? receiveMarketingEmails, + String? socialMediaUrl, + int? tncAccepted, + int? tncAffiliateAccepted, + int? typeOfAccount, + String? userName, + String? websiteUrl, + String? whatsappNumber, + String? whatsappNumberPhoneCode, + Map? passthrough, + int? reqId, + }) => + AffiliateRegisterPersonRequest( + addressCity: addressCity ?? this.addressCity, + addressPostcode: addressPostcode ?? this.addressPostcode, + addressState: addressState ?? this.addressState, + addressStreet: addressStreet ?? this.addressStreet, + affiliateRegisterPerson: + affiliateRegisterPerson ?? this.affiliateRegisterPerson, + citizenship: citizenship ?? this.citizenship, + commissionPlan: commissionPlan ?? this.commissionPlan, + companyName: companyName ?? this.companyName, + companyRegistrationNumber: + companyRegistrationNumber ?? this.companyRegistrationNumber, + country: country ?? this.country, + currency: currency ?? this.currency, + dateOfBirth: dateOfBirth ?? this.dateOfBirth, + email: email ?? this.email, + firstName: firstName ?? this.firstName, + lastName: lastName ?? this.lastName, + loginid: loginid ?? this.loginid, + nonPepDeclaration: nonPepDeclaration ?? this.nonPepDeclaration, + over18Declaration: over18Declaration ?? this.over18Declaration, + password: password ?? this.password, + phone: phone ?? this.phone, + phoneCode: phoneCode ?? this.phoneCode, + promoteEu: promoteEu ?? this.promoteEu, + receiveMarketingEmails: + receiveMarketingEmails ?? this.receiveMarketingEmails, + socialMediaUrl: socialMediaUrl ?? this.socialMediaUrl, + tncAccepted: tncAccepted ?? this.tncAccepted, + tncAffiliateAccepted: tncAffiliateAccepted ?? this.tncAffiliateAccepted, + typeOfAccount: typeOfAccount ?? this.typeOfAccount, + userName: userName ?? this.userName, + websiteUrl: websiteUrl ?? this.websiteUrl, + whatsappNumber: whatsappNumber ?? this.whatsappNumber, + whatsappNumberPhoneCode: + whatsappNumberPhoneCode ?? this.whatsappNumberPhoneCode, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/api.dart b/lib/basic_api/generated/api.dart index a9c4d1911a..031f3b5c7c 100644 --- a/lib/basic_api/generated/api.dart +++ b/lib/basic_api/generated/api.dart @@ -1,5 +1,7 @@ export "account_closure_receive.dart"; export "account_closure_send.dart"; +export "account_list_receive.dart"; +export "account_list_send.dart"; export "account_security_receive.dart"; export "account_security_send.dart"; export "account_statistics_receive.dart"; @@ -8,6 +10,12 @@ export "active_symbols_receive.dart"; export "active_symbols_send.dart"; export "affiliate_account_add_receive.dart"; export "affiliate_account_add_send.dart"; +export "affiliate_add_company_receive.dart"; +export "affiliate_add_company_send.dart"; +export "affiliate_add_person_receive.dart"; +export "affiliate_add_person_send.dart"; +export "affiliate_register_person_receive.dart"; +export "affiliate_register_person_send.dart"; export "api_token_receive.dart"; export "api_token_send.dart"; export "app_delete_receive.dart"; @@ -28,6 +36,8 @@ export "asset_index_receive.dart"; export "asset_index_send.dart"; export "authorize_receive.dart"; export "authorize_send.dart"; +export "available_accounts_receive.dart"; +export "available_accounts_send.dart"; export "balance_receive.dart"; export "balance_send.dart"; export "buy_contract_for_multiple_accounts_receive.dart"; @@ -46,6 +56,8 @@ export "change_email_receive.dart"; export "change_email_send.dart"; export "change_password_receive.dart"; export "change_password_send.dart"; +export "confirm_email_receive.dart"; +export "confirm_email_send.dart"; export "contract_update_history_receive.dart"; export "contract_update_history_send.dart"; export "contract_update_receive.dart"; @@ -62,6 +74,8 @@ export "copytrading_statistics_receive.dart"; export "copytrading_statistics_send.dart"; export "crypto_config_receive.dart"; export "crypto_config_send.dart"; +export "crypto_estimations_receive.dart"; +export "crypto_estimations_send.dart"; export "document_upload_receive.dart"; export "document_upload_send.dart"; export "economic_calendar_receive.dart"; @@ -88,6 +102,10 @@ export "get_settings_receive.dart"; export "get_settings_send.dart"; export "identity_verification_document_add_receive.dart"; export "identity_verification_document_add_send.dart"; +export "jtoken_create_receive.dart"; +export "jtoken_create_send.dart"; +export "kyc_auth_status_receive.dart"; +export "kyc_auth_status_send.dart"; export "landing_company_details_receive.dart"; export "landing_company_details_send.dart"; export "landing_company_receive.dart"; @@ -168,6 +186,22 @@ export "p2p_payment_methods_receive.dart"; export "p2p_payment_methods_send.dart"; export "p2p_ping_receive.dart"; export "p2p_ping_send.dart"; +export "p2p_settings_receive.dart"; +export "p2p_settings_send.dart"; +export "passkeys_list_receive.dart"; +export "passkeys_list_send.dart"; +export "passkeys_login_receive.dart"; +export "passkeys_login_send.dart"; +export "passkeys_options_receive.dart"; +export "passkeys_options_send.dart"; +export "passkeys_register_options_receive.dart"; +export "passkeys_register_options_send.dart"; +export "passkeys_register_receive.dart"; +export "passkeys_register_send.dart"; +export "passkeys_rename_receive.dart"; +export "passkeys_rename_send.dart"; +export "passkeys_revoke_receive.dart"; +export "passkeys_revoke_send.dart"; export "payment_methods_receive.dart"; export "payment_methods_send.dart"; export "paymentagent_create_receive.dart"; @@ -178,6 +212,8 @@ export "paymentagent_list_receive.dart"; export "paymentagent_list_send.dart"; export "paymentagent_transfer_receive.dart"; export "paymentagent_transfer_send.dart"; +export "paymentagent_withdraw_justification_receive.dart"; +export "paymentagent_withdraw_justification_send.dart"; export "paymentagent_withdraw_receive.dart"; export "paymentagent_withdraw_send.dart"; export "payout_currencies_receive.dart"; @@ -236,6 +272,8 @@ export "trading_durations_receive.dart"; export "trading_durations_send.dart"; export "trading_platform_accounts_receive.dart"; export "trading_platform_accounts_send.dart"; +export "trading_platform_asset_listing_receive.dart"; +export "trading_platform_asset_listing_send.dart"; export "trading_platform_available_accounts_receive.dart"; export "trading_platform_available_accounts_send.dart"; export "trading_platform_deposit_receive.dart"; @@ -244,6 +282,8 @@ export "trading_platform_investor_password_change_receive.dart"; export "trading_platform_investor_password_change_send.dart"; export "trading_platform_investor_password_reset_receive.dart"; export "trading_platform_investor_password_reset_send.dart"; +export "trading_platform_leverage_receive.dart"; +export "trading_platform_leverage_send.dart"; export "trading_platform_new_account_receive.dart"; export "trading_platform_new_account_send.dart"; export "trading_platform_password_change_receive.dart"; @@ -268,5 +308,9 @@ export "verify_email_cellxpert_receive.dart"; export "verify_email_cellxpert_send.dart"; export "verify_email_receive.dart"; export "verify_email_send.dart"; +export "wallet_migration_receive.dart"; +export "wallet_migration_send.dart"; +export "website_config_receive.dart"; +export "website_config_send.dart"; export "website_status_receive.dart"; export "website_status_send.dart"; diff --git a/lib/basic_api/generated/api_token_receive.dart b/lib/basic_api/generated/api_token_receive.dart index 121582baee..48ca98946b 100644 --- a/lib/basic_api/generated/api_token_receive.dart +++ b/lib/basic_api/generated/api_token_receive.dart @@ -9,16 +9,11 @@ class ApiTokenReceive extends Response { /// Initialize ApiTokenReceive. const ApiTokenReceive({ this.apiToken, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory ApiTokenReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/api_token_send.dart b/lib/basic_api/generated/api_token_send.dart index 05bb67d5e7..8290d127f8 100644 --- a/lib/basic_api/generated/api_token_send.dart +++ b/lib/basic_api/generated/api_token_send.dart @@ -10,22 +10,21 @@ class ApiTokenRequest extends Request { const ApiTokenRequest({ this.apiToken = true, this.deleteToken, + this.loginid, this.newToken, this.newTokenScopes, this.validForCurrentIpOnly, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'api_token', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'api_token', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory ApiTokenRequest.fromJson(Map json) => ApiTokenRequest( apiToken: json['api_token'] == null ? null : json['api_token'] == 1, deleteToken: json['delete_token'] as String?, + loginid: json['loginid'] as String?, newToken: json['new_token'] as String?, newTokenScopes: (json['new_token_scopes'] as List?) ?.map((dynamic item) => item as String) @@ -43,6 +42,9 @@ class ApiTokenRequest extends Request { /// [Optional] The token to remove. final String? deleteToken; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] The name of the created token. final String? newToken; @@ -61,6 +63,7 @@ class ApiTokenRequest extends Request { ? 1 : 0, 'delete_token': deleteToken, + 'loginid': loginid, 'new_token': newToken, 'new_token_scopes': newTokenScopes, 'valid_for_current_ip_only': validForCurrentIpOnly == null @@ -77,6 +80,7 @@ class ApiTokenRequest extends Request { ApiTokenRequest copyWith({ bool? apiToken, String? deleteToken, + String? loginid, String? newToken, List? newTokenScopes, bool? validForCurrentIpOnly, @@ -86,6 +90,7 @@ class ApiTokenRequest extends Request { ApiTokenRequest( apiToken: apiToken ?? this.apiToken, deleteToken: deleteToken ?? this.deleteToken, + loginid: loginid ?? this.loginid, newToken: newToken ?? this.newToken, newTokenScopes: newTokenScopes ?? this.newTokenScopes, validForCurrentIpOnly: diff --git a/lib/basic_api/generated/app_delete_receive.dart b/lib/basic_api/generated/app_delete_receive.dart index 8eac6322c9..28aa2229fc 100644 --- a/lib/basic_api/generated/app_delete_receive.dart +++ b/lib/basic_api/generated/app_delete_receive.dart @@ -9,16 +9,11 @@ class AppDeleteReceive extends Response { /// Initialize AppDeleteReceive. const AppDeleteReceive({ this.appDelete, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory AppDeleteReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/app_delete_send.dart b/lib/basic_api/generated/app_delete_send.dart index 2d0b4b07c8..76dfc4f4da 100644 --- a/lib/basic_api/generated/app_delete_send.dart +++ b/lib/basic_api/generated/app_delete_send.dart @@ -9,18 +9,17 @@ class AppDeleteRequest extends Request { /// Initialize AppDeleteRequest. const AppDeleteRequest({ required this.appDelete, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'app_delete', - passthrough: passthrough, - reqId: reqId, - ); + this.loginid, + super.msgType = 'app_delete', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory AppDeleteRequest.fromJson(Map json) => AppDeleteRequest( appDelete: json['app_delete'] as int?, + loginid: json['loginid'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -28,10 +27,14 @@ class AppDeleteRequest extends Request { /// Application app_id final int? appDelete; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Converts this instance to JSON @override Map toJson() => { 'app_delete': appDelete, + 'loginid': loginid, 'passthrough': passthrough, 'req_id': reqId, }; @@ -40,11 +43,13 @@ class AppDeleteRequest extends Request { @override AppDeleteRequest copyWith({ int? appDelete, + String? loginid, Map? passthrough, int? reqId, }) => AppDeleteRequest( appDelete: appDelete ?? this.appDelete, + loginid: loginid ?? this.loginid, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/app_get_receive.dart b/lib/basic_api/generated/app_get_receive.dart index bd7a887ce0..833a6ac9a2 100644 --- a/lib/basic_api/generated/app_get_receive.dart +++ b/lib/basic_api/generated/app_get_receive.dart @@ -9,16 +9,11 @@ class AppGetReceive extends Response { /// Initialize AppGetReceive. const AppGetReceive({ this.appGet, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory AppGetReceive.fromJson(Map json) => AppGetReceive( diff --git a/lib/basic_api/generated/app_get_send.dart b/lib/basic_api/generated/app_get_send.dart index 7e3837e055..f028984e75 100644 --- a/lib/basic_api/generated/app_get_send.dart +++ b/lib/basic_api/generated/app_get_send.dart @@ -9,17 +9,16 @@ class AppGetRequest extends Request { /// Initialize AppGetRequest. const AppGetRequest({ required this.appGet, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'app_get', - passthrough: passthrough, - reqId: reqId, - ); + this.loginid, + super.msgType = 'app_get', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory AppGetRequest.fromJson(Map json) => AppGetRequest( appGet: json['app_get'] as int?, + loginid: json['loginid'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -27,10 +26,14 @@ class AppGetRequest extends Request { /// Application app_id final int? appGet; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Converts this instance to JSON @override Map toJson() => { 'app_get': appGet, + 'loginid': loginid, 'passthrough': passthrough, 'req_id': reqId, }; @@ -39,11 +42,13 @@ class AppGetRequest extends Request { @override AppGetRequest copyWith({ int? appGet, + String? loginid, Map? passthrough, int? reqId, }) => AppGetRequest( appGet: appGet ?? this.appGet, + loginid: loginid ?? this.loginid, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/app_list_receive.dart b/lib/basic_api/generated/app_list_receive.dart index fbb5a41e36..11b0597314 100644 --- a/lib/basic_api/generated/app_list_receive.dart +++ b/lib/basic_api/generated/app_list_receive.dart @@ -9,16 +9,11 @@ class AppListReceive extends Response { /// Initialize AppListReceive. const AppListReceive({ this.appList, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory AppListReceive.fromJson(Map json) => AppListReceive( diff --git a/lib/basic_api/generated/app_list_send.dart b/lib/basic_api/generated/app_list_send.dart index f100632ad8..2453685d53 100644 --- a/lib/basic_api/generated/app_list_send.dart +++ b/lib/basic_api/generated/app_list_send.dart @@ -9,17 +9,16 @@ class AppListRequest extends Request { /// Initialize AppListRequest. const AppListRequest({ this.appList = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'app_list', - passthrough: passthrough, - reqId: reqId, - ); + this.loginid, + super.msgType = 'app_list', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory AppListRequest.fromJson(Map json) => AppListRequest( appList: json['app_list'] == null ? null : json['app_list'] == 1, + loginid: json['loginid'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -27,6 +26,9 @@ class AppListRequest extends Request { /// Must be `true` final bool? appList; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Converts this instance to JSON @override Map toJson() => { @@ -35,6 +37,7 @@ class AppListRequest extends Request { : appList! ? 1 : 0, + 'loginid': loginid, 'passthrough': passthrough, 'req_id': reqId, }; @@ -43,11 +46,13 @@ class AppListRequest extends Request { @override AppListRequest copyWith({ bool? appList, + String? loginid, Map? passthrough, int? reqId, }) => AppListRequest( appList: appList ?? this.appList, + loginid: loginid ?? this.loginid, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/app_markup_details_receive.dart b/lib/basic_api/generated/app_markup_details_receive.dart index 02327f4e3d..6bba960935 100644 --- a/lib/basic_api/generated/app_markup_details_receive.dart +++ b/lib/basic_api/generated/app_markup_details_receive.dart @@ -9,16 +9,11 @@ class AppMarkupDetailsReceive extends Response { /// Initialize AppMarkupDetailsReceive. const AppMarkupDetailsReceive({ this.appMarkupDetails, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory AppMarkupDetailsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/app_markup_details_send.dart b/lib/basic_api/generated/app_markup_details_send.dart index 9cb1209928..90f72c7859 100644 --- a/lib/basic_api/generated/app_markup_details_send.dart +++ b/lib/basic_api/generated/app_markup_details_send.dart @@ -15,16 +15,14 @@ class AppMarkupDetailsRequest extends Request { required this.dateTo, this.description, this.limit, + this.loginid, this.offset, this.sort, this.sortFields, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'app_markup_details', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'app_markup_details', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory AppMarkupDetailsRequest.fromJson(Map json) => @@ -39,7 +37,8 @@ class AppMarkupDetailsRequest extends Request { description: json['description'] == null ? null : json['description'] == 1, limit: json['limit'] as num?, - offset: json['offset'] as num?, + loginid: json['loginid'] as String?, + offset: json['offset'] as int?, sort: json['sort'] as String?, sortFields: (json['sort_fields'] as List?) ?.map((dynamic item) => item as String) @@ -69,8 +68,11 @@ class AppMarkupDetailsRequest extends Request { /// [Optional] Apply upper limit to count of transactions received. final num? limit; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] Number of transactions to skip. - final num? offset; + final int? offset; /// [Optional] Sort direction on `transaction_time`. Other fields sort order is ASC. final String? sort; @@ -96,6 +98,7 @@ class AppMarkupDetailsRequest extends Request { ? 1 : 0, 'limit': limit, + 'loginid': loginid, 'offset': offset, 'sort': sort, 'sort_fields': sortFields, @@ -113,7 +116,8 @@ class AppMarkupDetailsRequest extends Request { String? dateTo, bool? description, num? limit, - num? offset, + String? loginid, + int? offset, String? sort, List? sortFields, Map? passthrough, @@ -127,6 +131,7 @@ class AppMarkupDetailsRequest extends Request { dateTo: dateTo ?? this.dateTo, description: description ?? this.description, limit: limit ?? this.limit, + loginid: loginid ?? this.loginid, offset: offset ?? this.offset, sort: sort ?? this.sort, sortFields: sortFields ?? this.sortFields, diff --git a/lib/basic_api/generated/app_markup_statistics_receive.dart b/lib/basic_api/generated/app_markup_statistics_receive.dart index 8f3bc2f31d..e11da29ef4 100644 --- a/lib/basic_api/generated/app_markup_statistics_receive.dart +++ b/lib/basic_api/generated/app_markup_statistics_receive.dart @@ -9,16 +9,11 @@ class AppMarkupStatisticsReceive extends Response { /// Initialize AppMarkupStatisticsReceive. const AppMarkupStatisticsReceive({ this.appMarkupStatistics, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory AppMarkupStatisticsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/app_markup_statistics_send.dart b/lib/basic_api/generated/app_markup_statistics_send.dart index 97e82bfd2a..21604d40ed 100644 --- a/lib/basic_api/generated/app_markup_statistics_send.dart +++ b/lib/basic_api/generated/app_markup_statistics_send.dart @@ -11,13 +11,11 @@ class AppMarkupStatisticsRequest extends Request { this.appMarkupStatistics = true, required this.dateFrom, required this.dateTo, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'app_markup_statistics', - passthrough: passthrough, - reqId: reqId, - ); + this.loginid, + super.msgType = 'app_markup_statistics', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory AppMarkupStatisticsRequest.fromJson(Map json) => @@ -27,6 +25,7 @@ class AppMarkupStatisticsRequest extends Request { : json['app_markup_statistics'] == 1, dateFrom: json['date_from'] as String?, dateTo: json['date_to'] as String?, + loginid: json['loginid'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -40,6 +39,9 @@ class AppMarkupStatisticsRequest extends Request { /// End date (epoch or YYYY-MM-DD HH::MM::SS). Results are inclusive of this time. final String? dateTo; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Converts this instance to JSON @override Map toJson() => { @@ -50,6 +52,7 @@ class AppMarkupStatisticsRequest extends Request { : 0, 'date_from': dateFrom, 'date_to': dateTo, + 'loginid': loginid, 'passthrough': passthrough, 'req_id': reqId, }; @@ -60,6 +63,7 @@ class AppMarkupStatisticsRequest extends Request { bool? appMarkupStatistics, String? dateFrom, String? dateTo, + String? loginid, Map? passthrough, int? reqId, }) => @@ -67,6 +71,7 @@ class AppMarkupStatisticsRequest extends Request { appMarkupStatistics: appMarkupStatistics ?? this.appMarkupStatistics, dateFrom: dateFrom ?? this.dateFrom, dateTo: dateTo ?? this.dateTo, + loginid: loginid ?? this.loginid, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/app_register_receive.dart b/lib/basic_api/generated/app_register_receive.dart index b82aa35276..38ac77d75c 100644 --- a/lib/basic_api/generated/app_register_receive.dart +++ b/lib/basic_api/generated/app_register_receive.dart @@ -9,16 +9,11 @@ class AppRegisterReceive extends Response { /// Initialize AppRegisterReceive. const AppRegisterReceive({ this.appRegister, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory AppRegisterReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/app_register_send.dart b/lib/basic_api/generated/app_register_send.dart index 4177833989..0f8b635428 100644 --- a/lib/basic_api/generated/app_register_send.dart +++ b/lib/basic_api/generated/app_register_send.dart @@ -14,17 +14,15 @@ class AppRegisterRequest extends Request { this.github, this.googleplay, this.homepage, + this.loginid, required this.name, this.redirectUri, required this.scopes, this.verificationUri, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'app_register', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'app_register', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory AppRegisterRequest.fromJson(Map json) => @@ -36,6 +34,7 @@ class AppRegisterRequest extends Request { github: json['github'] as String?, googleplay: json['googleplay'] as String?, homepage: json['homepage'] as String?, + loginid: json['loginid'] as String?, name: json['name'] as String?, redirectUri: json['redirect_uri'] as String?, scopes: (json['scopes'] as List?) @@ -46,7 +45,7 @@ class AppRegisterRequest extends Request { reqId: json['req_id'] as int?, ); - /// [Optional] Markup to be added to contract prices (as a percentage of contract payout). + /// [Optional] Markup to be added to contract prices (as a percentage of contract payout). Max markup: 3%. final num? appMarkupPercentage; /// Must be `true` @@ -64,6 +63,9 @@ class AppRegisterRequest extends Request { /// [Optional] Application's homepage URL. final String? homepage; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Application name. final String? name; @@ -89,6 +91,7 @@ class AppRegisterRequest extends Request { 'github': github, 'googleplay': googleplay, 'homepage': homepage, + 'loginid': loginid, 'name': name, 'redirect_uri': redirectUri, 'scopes': scopes, @@ -106,6 +109,7 @@ class AppRegisterRequest extends Request { String? github, String? googleplay, String? homepage, + String? loginid, String? name, String? redirectUri, List? scopes, @@ -120,6 +124,7 @@ class AppRegisterRequest extends Request { github: github ?? this.github, googleplay: googleplay ?? this.googleplay, homepage: homepage ?? this.homepage, + loginid: loginid ?? this.loginid, name: name ?? this.name, redirectUri: redirectUri ?? this.redirectUri, scopes: scopes ?? this.scopes, diff --git a/lib/basic_api/generated/app_update_receive.dart b/lib/basic_api/generated/app_update_receive.dart index 1b2490f529..d1520a1318 100644 --- a/lib/basic_api/generated/app_update_receive.dart +++ b/lib/basic_api/generated/app_update_receive.dart @@ -9,16 +9,11 @@ class AppUpdateReceive extends Response { /// Initialize AppUpdateReceive. const AppUpdateReceive({ this.appUpdate, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory AppUpdateReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/app_update_send.dart b/lib/basic_api/generated/app_update_send.dart index 813e4f4cdb..a027acaa46 100644 --- a/lib/basic_api/generated/app_update_send.dart +++ b/lib/basic_api/generated/app_update_send.dart @@ -14,17 +14,15 @@ class AppUpdateRequest extends Request { this.github, this.googleplay, this.homepage, + this.loginid, required this.name, this.redirectUri, required this.scopes, this.verificationUri, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'app_update', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'app_update', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory AppUpdateRequest.fromJson(Map json) => @@ -35,6 +33,7 @@ class AppUpdateRequest extends Request { github: json['github'] as String?, googleplay: json['googleplay'] as String?, homepage: json['homepage'] as String?, + loginid: json['loginid'] as String?, name: json['name'] as String?, redirectUri: json['redirect_uri'] as String?, scopes: (json['scopes'] as List?) @@ -45,7 +44,7 @@ class AppUpdateRequest extends Request { reqId: json['req_id'] as int?, ); - /// [Optional] Markup to be added to contract prices (as a percentage of contract payout). + /// [Optional] Markup to be added to contract prices (as a percentage of contract payout). Max markup: 3%. final num? appMarkupPercentage; /// Application app_id. @@ -63,6 +62,9 @@ class AppUpdateRequest extends Request { /// [Optional] Application's homepage URL. final String? homepage; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Application name. final String? name; @@ -84,6 +86,7 @@ class AppUpdateRequest extends Request { 'github': github, 'googleplay': googleplay, 'homepage': homepage, + 'loginid': loginid, 'name': name, 'redirect_uri': redirectUri, 'scopes': scopes, @@ -101,6 +104,7 @@ class AppUpdateRequest extends Request { String? github, String? googleplay, String? homepage, + String? loginid, String? name, String? redirectUri, List? scopes, @@ -115,6 +119,7 @@ class AppUpdateRequest extends Request { github: github ?? this.github, googleplay: googleplay ?? this.googleplay, homepage: homepage ?? this.homepage, + loginid: loginid ?? this.loginid, name: name ?? this.name, redirectUri: redirectUri ?? this.redirectUri, scopes: scopes ?? this.scopes, diff --git a/lib/basic_api/generated/asset_index_receive.dart b/lib/basic_api/generated/asset_index_receive.dart index 3e07187427..3ccdbf54d8 100644 --- a/lib/basic_api/generated/asset_index_receive.dart +++ b/lib/basic_api/generated/asset_index_receive.dart @@ -9,16 +9,11 @@ class AssetIndexReceive extends Response { /// Initialize AssetIndexReceive. const AssetIndexReceive({ this.assetIndex, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory AssetIndexReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/asset_index_send.dart b/lib/basic_api/generated/asset_index_send.dart index 6a8bdddd20..e38dd0856f 100644 --- a/lib/basic_api/generated/asset_index_send.dart +++ b/lib/basic_api/generated/asset_index_send.dart @@ -9,14 +9,13 @@ class AssetIndexRequest extends Request { /// Initialize AssetIndexRequest. const AssetIndexRequest({ this.assetIndex = true, - this.landingCompany, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'asset_index', - passthrough: passthrough, - reqId: reqId, - ); + required this.landingCompany, + this.landingCompanyShort, + this.loginid, + super.msgType = 'asset_index', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory AssetIndexRequest.fromJson(Map json) => @@ -24,6 +23,8 @@ class AssetIndexRequest extends Request { assetIndex: json['asset_index'] == null ? null : json['asset_index'] == 1, landingCompany: json['landing_company'] as String?, + landingCompanyShort: json['landing_company_short'] as String?, + loginid: json['loginid'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -31,9 +32,15 @@ class AssetIndexRequest extends Request { /// Must be `true` final bool? assetIndex; - /// [Optional] If specified, will return only the underlyings for the specified landing company. + /// Deprecated - replaced by landing_company_short. final String? landingCompany; + /// [Optional] If specified, will return only the underlyings for the specified landing company. + final String? landingCompanyShort; + + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Converts this instance to JSON @override Map toJson() => { @@ -43,6 +50,8 @@ class AssetIndexRequest extends Request { ? 1 : 0, 'landing_company': landingCompany, + 'landing_company_short': landingCompanyShort, + 'loginid': loginid, 'passthrough': passthrough, 'req_id': reqId, }; @@ -52,12 +61,16 @@ class AssetIndexRequest extends Request { AssetIndexRequest copyWith({ bool? assetIndex, String? landingCompany, + String? landingCompanyShort, + String? loginid, Map? passthrough, int? reqId, }) => AssetIndexRequest( assetIndex: assetIndex ?? this.assetIndex, landingCompany: landingCompany ?? this.landingCompany, + landingCompanyShort: landingCompanyShort ?? this.landingCompanyShort, + loginid: loginid ?? this.loginid, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/authorize_send.dart b/lib/basic_api/generated/authorize_send.dart index 15c237dbd3..106cf261ca 100644 --- a/lib/basic_api/generated/authorize_send.dart +++ b/lib/basic_api/generated/authorize_send.dart @@ -10,6 +10,7 @@ class AuthorizeRequest extends Request { const AuthorizeRequest({ this.addToLoginHistory, required this.authorize, + required this.tokens, super.msgType = 'authorize', super.passthrough, super.reqId, @@ -22,6 +23,9 @@ class AuthorizeRequest extends Request { ? null : json['add_to_login_history'] == 1, authorize: json['authorize'] as String?, + tokens: (json['tokens'] as List?) + ?.map((dynamic item) => item as String) + .toList(), passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -32,6 +36,9 @@ class AuthorizeRequest extends Request { /// Authentication token. May be retrieved from https://www.binary.com/en/user/security/api_tokenws.html final String? authorize; + /// Additional Authentication tokens of authorized user that may be used in this session. Upto 10 tokens. + final List? tokens; + /// Converts this instance to JSON @override Map toJson() => { @@ -41,6 +48,7 @@ class AuthorizeRequest extends Request { ? 1 : 0, 'authorize': authorize, + 'tokens': tokens, 'passthrough': passthrough, 'req_id': reqId, }; @@ -50,12 +58,14 @@ class AuthorizeRequest extends Request { AuthorizeRequest copyWith({ bool? addToLoginHistory, String? authorize, + List? tokens, Map? passthrough, int? reqId, }) => AuthorizeRequest( addToLoginHistory: addToLoginHistory ?? this.addToLoginHistory, authorize: authorize ?? this.authorize, + tokens: tokens ?? this.tokens, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/balance_receive.dart b/lib/basic_api/generated/balance_receive.dart index 1d4090f212..7c781b6d10 100644 --- a/lib/basic_api/generated/balance_receive.dart +++ b/lib/basic_api/generated/balance_receive.dart @@ -10,16 +10,11 @@ class BalanceReceive extends Response { const BalanceReceive({ this.balance, this.subscription, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory BalanceReceive.fromJson(Map json) => BalanceReceive( diff --git a/lib/basic_api/generated/balance_send.dart b/lib/basic_api/generated/balance_send.dart index 11e688fbbd..8bcc4ea52a 100644 --- a/lib/basic_api/generated/balance_send.dart +++ b/lib/basic_api/generated/balance_send.dart @@ -10,19 +10,18 @@ class BalanceRequest extends Request { const BalanceRequest({ this.account, this.balance = true, + this.loginid, this.subscribe, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'balance', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'balance', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory BalanceRequest.fromJson(Map json) => BalanceRequest( account: json['account'] as String?, balance: json['balance'] == null ? null : json['balance'] == 1, + loginid: json['loginid'] as String?, subscribe: json['subscribe'] == null ? null : json['subscribe'] == 1, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, @@ -34,6 +33,9 @@ class BalanceRequest extends Request { /// Must be `true` final bool? balance; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] If set to `true`, will send updates whenever the balance changes. final bool? subscribe; @@ -46,6 +48,7 @@ class BalanceRequest extends Request { : balance! ? 1 : 0, + 'loginid': loginid, 'subscribe': subscribe == null ? null : subscribe! @@ -60,6 +63,7 @@ class BalanceRequest extends Request { BalanceRequest copyWith({ String? account, bool? balance, + String? loginid, bool? subscribe, Map? passthrough, int? reqId, @@ -67,6 +71,7 @@ class BalanceRequest extends Request { BalanceRequest( account: account ?? this.account, balance: balance ?? this.balance, + loginid: loginid ?? this.loginid, subscribe: subscribe ?? this.subscribe, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/buy_contract_for_multiple_accounts_receive.dart b/lib/basic_api/generated/buy_contract_for_multiple_accounts_receive.dart index cfccda250a..80f9059be4 100644 --- a/lib/basic_api/generated/buy_contract_for_multiple_accounts_receive.dart +++ b/lib/basic_api/generated/buy_contract_for_multiple_accounts_receive.dart @@ -9,16 +9,11 @@ class BuyContractForMultipleAccountsReceive extends Response { /// Initialize BuyContractForMultipleAccountsReceive. const BuyContractForMultipleAccountsReceive({ this.buyContractForMultipleAccounts, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory BuyContractForMultipleAccountsReceive.fromJson( diff --git a/lib/basic_api/generated/buy_contract_for_multiple_accounts_send.dart b/lib/basic_api/generated/buy_contract_for_multiple_accounts_send.dart index 35d5b36b69..5dabf1e0a7 100644 --- a/lib/basic_api/generated/buy_contract_for_multiple_accounts_send.dart +++ b/lib/basic_api/generated/buy_contract_for_multiple_accounts_send.dart @@ -9,16 +9,14 @@ class BuyContractForMultipleAccountsRequest extends Request { /// Initialize BuyContractForMultipleAccountsRequest. const BuyContractForMultipleAccountsRequest({ required this.buyContractForMultipleAccounts, + this.loginid, this.parameters, required this.price, required this.tokens, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'buy_contract_for_multiple_accounts', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'buy_contract_for_multiple_accounts', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory BuyContractForMultipleAccountsRequest.fromJson( @@ -26,6 +24,7 @@ class BuyContractForMultipleAccountsRequest extends Request { BuyContractForMultipleAccountsRequest( buyContractForMultipleAccounts: json['buy_contract_for_multiple_accounts'] as String?, + loginid: json['loginid'] as String?, parameters: json['parameters'] as Map?, price: json['price'] as num?, tokens: (json['tokens'] as List?) @@ -38,6 +37,9 @@ class BuyContractForMultipleAccountsRequest extends Request { /// Either the ID received from a Price Proposal (`proposal` call), or `1` if contract buy parameters are passed in the `parameters` field. final String? buyContractForMultipleAccounts; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] Used to pass the parameters for contract buy. final Map? parameters; @@ -51,6 +53,7 @@ class BuyContractForMultipleAccountsRequest extends Request { @override Map toJson() => { 'buy_contract_for_multiple_accounts': buyContractForMultipleAccounts, + 'loginid': loginid, 'parameters': parameters, 'price': price, 'tokens': tokens, @@ -62,6 +65,7 @@ class BuyContractForMultipleAccountsRequest extends Request { @override BuyContractForMultipleAccountsRequest copyWith({ String? buyContractForMultipleAccounts, + String? loginid, Map? parameters, num? price, List? tokens, @@ -71,6 +75,7 @@ class BuyContractForMultipleAccountsRequest extends Request { BuyContractForMultipleAccountsRequest( buyContractForMultipleAccounts: buyContractForMultipleAccounts ?? this.buyContractForMultipleAccounts, + loginid: loginid ?? this.loginid, parameters: parameters ?? this.parameters, price: price ?? this.price, tokens: tokens ?? this.tokens, diff --git a/lib/basic_api/generated/buy_receive.dart b/lib/basic_api/generated/buy_receive.dart index 438e3511e4..2cd4c59826 100644 --- a/lib/basic_api/generated/buy_receive.dart +++ b/lib/basic_api/generated/buy_receive.dart @@ -10,16 +10,11 @@ class BuyReceive extends Response { const BuyReceive({ this.buy, this.subscription, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory BuyReceive.fromJson(Map json) => BuyReceive( diff --git a/lib/basic_api/generated/buy_send.dart b/lib/basic_api/generated/buy_send.dart index 22916d93b3..c30e39d163 100644 --- a/lib/basic_api/generated/buy_send.dart +++ b/lib/basic_api/generated/buy_send.dart @@ -9,20 +9,19 @@ class BuyRequest extends Request { /// Initialize BuyRequest. const BuyRequest({ required this.buy, + this.loginid, this.parameters, required this.price, this.subscribe, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'buy', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'buy', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory BuyRequest.fromJson(Map json) => BuyRequest( buy: json['buy'] as String?, + loginid: json['loginid'] as String?, parameters: json['parameters'] as Map?, price: json['price'] as num?, subscribe: json['subscribe'] == null ? null : json['subscribe'] == 1, @@ -33,6 +32,9 @@ class BuyRequest extends Request { /// Either the ID received from a Price Proposal (`proposal` call), or `1` if contract buy parameters are passed in the `parameters` field. final String? buy; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] Used to pass the parameters for contract buy. final Map? parameters; @@ -46,6 +48,7 @@ class BuyRequest extends Request { @override Map toJson() => { 'buy': buy, + 'loginid': loginid, 'parameters': parameters, 'price': price, 'subscribe': subscribe == null @@ -61,6 +64,7 @@ class BuyRequest extends Request { @override BuyRequest copyWith({ String? buy, + String? loginid, Map? parameters, num? price, bool? subscribe, @@ -69,6 +73,7 @@ class BuyRequest extends Request { }) => BuyRequest( buy: buy ?? this.buy, + loginid: loginid ?? this.loginid, parameters: parameters ?? this.parameters, price: price ?? this.price, subscribe: subscribe ?? this.subscribe, diff --git a/lib/basic_api/generated/cancel_receive.dart b/lib/basic_api/generated/cancel_receive.dart index 73df97809d..43611f465a 100644 --- a/lib/basic_api/generated/cancel_receive.dart +++ b/lib/basic_api/generated/cancel_receive.dart @@ -9,16 +9,11 @@ class CancelReceive extends Response { /// Initialize CancelReceive. const CancelReceive({ this.cancel, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory CancelReceive.fromJson(Map json) => CancelReceive( diff --git a/lib/basic_api/generated/cancel_send.dart b/lib/basic_api/generated/cancel_send.dart index 6bc3aa9c78..51828ca2c9 100644 --- a/lib/basic_api/generated/cancel_send.dart +++ b/lib/basic_api/generated/cancel_send.dart @@ -9,17 +9,16 @@ class CancelRequest extends Request { /// Initialize CancelRequest. const CancelRequest({ required this.cancel, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'cancel', - passthrough: passthrough, - reqId: reqId, - ); + this.loginid, + super.msgType = 'cancel', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory CancelRequest.fromJson(Map json) => CancelRequest( cancel: json['cancel'] as int?, + loginid: json['loginid'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -27,10 +26,14 @@ class CancelRequest extends Request { /// Value should be the `contract_id` which received from the `portfolio` call. final int? cancel; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Converts this instance to JSON @override Map toJson() => { 'cancel': cancel, + 'loginid': loginid, 'passthrough': passthrough, 'req_id': reqId, }; @@ -39,11 +42,13 @@ class CancelRequest extends Request { @override CancelRequest copyWith({ int? cancel, + String? loginid, Map? passthrough, int? reqId, }) => CancelRequest( cancel: cancel ?? this.cancel, + loginid: loginid ?? this.loginid, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/cashier_payments_receive.dart b/lib/basic_api/generated/cashier_payments_receive.dart index aae7875c24..2cbd3065a3 100644 --- a/lib/basic_api/generated/cashier_payments_receive.dart +++ b/lib/basic_api/generated/cashier_payments_receive.dart @@ -10,16 +10,11 @@ class CashierPaymentsReceive extends Response { const CashierPaymentsReceive({ this.cashierPayments, this.subscription, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory CashierPaymentsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/cashier_payments_send.dart b/lib/basic_api/generated/cashier_payments_send.dart index 74e6f14391..2c642a0742 100644 --- a/lib/basic_api/generated/cashier_payments_send.dart +++ b/lib/basic_api/generated/cashier_payments_send.dart @@ -9,16 +9,14 @@ class CashierPaymentsRequest extends Request { /// Initialize CashierPaymentsRequest. const CashierPaymentsRequest({ this.cashierPayments = true, + this.loginid, this.provider, this.subscribe, this.transactionType, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'cashier_payments', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'cashier_payments', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory CashierPaymentsRequest.fromJson(Map json) => @@ -26,6 +24,7 @@ class CashierPaymentsRequest extends Request { cashierPayments: json['cashier_payments'] == null ? null : json['cashier_payments'] == 1, + loginid: json['loginid'] as String?, provider: json['provider'] as String?, subscribe: json['subscribe'] == null ? null : json['subscribe'] == 1, transactionType: json['transaction_type'] as String?, @@ -36,6 +35,9 @@ class CashierPaymentsRequest extends Request { /// Must be `true` final bool? cashierPayments; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] Cashier provider. `crypto` will be default option for crypto currency accounts. final String? provider; @@ -53,6 +55,7 @@ class CashierPaymentsRequest extends Request { : cashierPayments! ? 1 : 0, + 'loginid': loginid, 'provider': provider, 'subscribe': subscribe == null ? null @@ -68,6 +71,7 @@ class CashierPaymentsRequest extends Request { @override CashierPaymentsRequest copyWith({ bool? cashierPayments, + String? loginid, String? provider, bool? subscribe, String? transactionType, @@ -76,6 +80,7 @@ class CashierPaymentsRequest extends Request { }) => CashierPaymentsRequest( cashierPayments: cashierPayments ?? this.cashierPayments, + loginid: loginid ?? this.loginid, provider: provider ?? this.provider, subscribe: subscribe ?? this.subscribe, transactionType: transactionType ?? this.transactionType, diff --git a/lib/basic_api/generated/cashier_receive.dart b/lib/basic_api/generated/cashier_receive.dart index 960d4ad449..7b099fd489 100644 --- a/lib/basic_api/generated/cashier_receive.dart +++ b/lib/basic_api/generated/cashier_receive.dart @@ -9,16 +9,11 @@ class CashierReceive extends Response { /// Initialize CashierReceive. const CashierReceive({ this.cashier, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory CashierReceive.fromJson(Map json) => CashierReceive( diff --git a/lib/basic_api/generated/cashier_send.dart b/lib/basic_api/generated/cashier_send.dart index ae9d383eb1..bee3d2284d 100644 --- a/lib/basic_api/generated/cashier_send.dart +++ b/lib/basic_api/generated/cashier_send.dart @@ -12,16 +12,15 @@ class CashierRequest extends Request { this.amount, required this.cashier, this.dryRun, + this.estimatedFeeUniqueId, + this.loginid, this.provider, this.type, this.verificationCode, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'cashier', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'cashier', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory CashierRequest.fromJson(Map json) => CashierRequest( @@ -29,6 +28,8 @@ class CashierRequest extends Request { amount: json['amount'] as num?, cashier: json['cashier'] as String?, dryRun: json['dry_run'] == null ? null : json['dry_run'] == 1, + estimatedFeeUniqueId: json['estimated_fee_unique_id'] as String?, + loginid: json['loginid'] as String?, provider: json['provider'] as String?, type: json['type'] as String?, verificationCode: json['verification_code'] as String?, @@ -48,10 +49,16 @@ class CashierRequest extends Request { /// [Optional] If set to `true`, only validation is performed. Only applicable for `withdraw` using `crypto` provider and `api` type. final bool? dryRun; + /// [Optional] The `unique_id` of the estimated fee received from `crypto_estimations` call in case the client is willing to pay the returned fee in order to prioritise their withdrawal request. + final String? estimatedFeeUniqueId; + + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] Cashier provider. `crypto` will be default option for crypto currency accounts. final String? provider; - /// [Optional] Data need to be returned from cashier. `api` is supported only for `crypto` provider. + /// [Optional] Data is returned from the cashier. The `crypto` provider only supports `api` (not `url`) for crypto accounts. final String? type; /// [Optional] Email verification code (received from a `verify_email` call, which must be done first) @@ -68,6 +75,8 @@ class CashierRequest extends Request { : dryRun! ? 1 : 0, + 'estimated_fee_unique_id': estimatedFeeUniqueId, + 'loginid': loginid, 'provider': provider, 'type': type, 'verification_code': verificationCode, @@ -82,6 +91,8 @@ class CashierRequest extends Request { num? amount, String? cashier, bool? dryRun, + String? estimatedFeeUniqueId, + String? loginid, String? provider, String? type, String? verificationCode, @@ -93,6 +104,8 @@ class CashierRequest extends Request { amount: amount ?? this.amount, cashier: cashier ?? this.cashier, dryRun: dryRun ?? this.dryRun, + estimatedFeeUniqueId: estimatedFeeUniqueId ?? this.estimatedFeeUniqueId, + loginid: loginid ?? this.loginid, provider: provider ?? this.provider, type: type ?? this.type, verificationCode: verificationCode ?? this.verificationCode, diff --git a/lib/basic_api/generated/cashier_withdrawal_cancel_receive.dart b/lib/basic_api/generated/cashier_withdrawal_cancel_receive.dart index eaefa66587..6a03aa3c7b 100644 --- a/lib/basic_api/generated/cashier_withdrawal_cancel_receive.dart +++ b/lib/basic_api/generated/cashier_withdrawal_cancel_receive.dart @@ -9,16 +9,11 @@ class CashierWithdrawalCancelReceive extends Response { /// Initialize CashierWithdrawalCancelReceive. const CashierWithdrawalCancelReceive({ this.cashierWithdrawalCancel, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory CashierWithdrawalCancelReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/cashier_withdrawal_cancel_send.dart b/lib/basic_api/generated/cashier_withdrawal_cancel_send.dart index a6ec81bd89..454a639cd5 100644 --- a/lib/basic_api/generated/cashier_withdrawal_cancel_send.dart +++ b/lib/basic_api/generated/cashier_withdrawal_cancel_send.dart @@ -10,13 +10,11 @@ class CashierWithdrawalCancelRequest extends Request { const CashierWithdrawalCancelRequest({ this.cashierWithdrawalCancel = true, required this.id, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'cashier_withdrawal_cancel', - passthrough: passthrough, - reqId: reqId, - ); + this.loginid, + super.msgType = 'cashier_withdrawal_cancel', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory CashierWithdrawalCancelRequest.fromJson(Map json) => @@ -25,6 +23,7 @@ class CashierWithdrawalCancelRequest extends Request { ? null : json['cashier_withdrawal_cancel'] == 1, id: json['id'] as String?, + loginid: json['loginid'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -35,6 +34,9 @@ class CashierWithdrawalCancelRequest extends Request { /// The unique identifier for the transaction. final String? id; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Converts this instance to JSON @override Map toJson() => { @@ -44,6 +46,7 @@ class CashierWithdrawalCancelRequest extends Request { ? 1 : 0, 'id': id, + 'loginid': loginid, 'passthrough': passthrough, 'req_id': reqId, }; @@ -53,6 +56,7 @@ class CashierWithdrawalCancelRequest extends Request { CashierWithdrawalCancelRequest copyWith({ bool? cashierWithdrawalCancel, String? id, + String? loginid, Map? passthrough, int? reqId, }) => @@ -60,6 +64,7 @@ class CashierWithdrawalCancelRequest extends Request { cashierWithdrawalCancel: cashierWithdrawalCancel ?? this.cashierWithdrawalCancel, id: id ?? this.id, + loginid: loginid ?? this.loginid, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/change_email_receive.dart b/lib/basic_api/generated/change_email_receive.dart index b34e275a9a..b98b887f8d 100644 --- a/lib/basic_api/generated/change_email_receive.dart +++ b/lib/basic_api/generated/change_email_receive.dart @@ -9,16 +9,11 @@ class ChangeEmailReceive extends Response { /// Initialize ChangeEmailReceive. const ChangeEmailReceive({ this.changeEmail, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory ChangeEmailReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/change_email_send.dart b/lib/basic_api/generated/change_email_send.dart index ca72fefd72..4a8c65ea1d 100644 --- a/lib/basic_api/generated/change_email_send.dart +++ b/lib/basic_api/generated/change_email_send.dart @@ -9,21 +9,20 @@ class ChangeEmailRequest extends Request { /// Initialize ChangeEmailRequest. const ChangeEmailRequest({ required this.changeEmail, + this.loginid, required this.newEmail, this.newPassword, required this.verificationCode, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'change_email', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'change_email', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory ChangeEmailRequest.fromJson(Map json) => ChangeEmailRequest( changeEmail: json['change_email'] as String?, + loginid: json['loginid'] as String?, newEmail: json['new_email'] as String?, newPassword: json['new_password'] as String?, verificationCode: json['verification_code'] as String?, @@ -34,6 +33,9 @@ class ChangeEmailRequest extends Request { /// Must be `verify` or `update`. final String? changeEmail; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Email address to be verified. final String? newEmail; @@ -47,6 +49,7 @@ class ChangeEmailRequest extends Request { @override Map toJson() => { 'change_email': changeEmail, + 'loginid': loginid, 'new_email': newEmail, 'new_password': newPassword, 'verification_code': verificationCode, @@ -58,6 +61,7 @@ class ChangeEmailRequest extends Request { @override ChangeEmailRequest copyWith({ String? changeEmail, + String? loginid, String? newEmail, String? newPassword, String? verificationCode, @@ -66,6 +70,7 @@ class ChangeEmailRequest extends Request { }) => ChangeEmailRequest( changeEmail: changeEmail ?? this.changeEmail, + loginid: loginid ?? this.loginid, newEmail: newEmail ?? this.newEmail, newPassword: newPassword ?? this.newPassword, verificationCode: verificationCode ?? this.verificationCode, diff --git a/lib/basic_api/generated/change_password_receive.dart b/lib/basic_api/generated/change_password_receive.dart index a57d450910..5d8d34d3d6 100644 --- a/lib/basic_api/generated/change_password_receive.dart +++ b/lib/basic_api/generated/change_password_receive.dart @@ -9,16 +9,11 @@ class ChangePasswordReceive extends Response { /// Initialize ChangePasswordReceive. const ChangePasswordReceive({ this.changePassword, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory ChangePasswordReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/change_password_send.dart b/lib/basic_api/generated/change_password_send.dart index 3543d99d9e..865e8512bd 100644 --- a/lib/basic_api/generated/change_password_send.dart +++ b/lib/basic_api/generated/change_password_send.dart @@ -9,15 +9,13 @@ class ChangePasswordRequest extends Request { /// Initialize ChangePasswordRequest. const ChangePasswordRequest({ this.changePassword = true, + this.loginid, required this.newPassword, required this.oldPassword, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'change_password', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'change_password', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory ChangePasswordRequest.fromJson(Map json) => @@ -25,6 +23,7 @@ class ChangePasswordRequest extends Request { changePassword: json['change_password'] == null ? null : json['change_password'] == 1, + loginid: json['loginid'] as String?, newPassword: json['new_password'] as String?, oldPassword: json['old_password'] as String?, passthrough: json['passthrough'] as Map?, @@ -34,6 +33,9 @@ class ChangePasswordRequest extends Request { /// Must be `true` final bool? changePassword; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// New password (Accepts any printable ASCII character. Must be within 8-25 characters, and include numbers, lowercase and uppercase letters. Must not be the same as the user's email address) final String? newPassword; @@ -48,6 +50,7 @@ class ChangePasswordRequest extends Request { : changePassword! ? 1 : 0, + 'loginid': loginid, 'new_password': newPassword, 'old_password': oldPassword, 'passthrough': passthrough, @@ -58,6 +61,7 @@ class ChangePasswordRequest extends Request { @override ChangePasswordRequest copyWith({ bool? changePassword, + String? loginid, String? newPassword, String? oldPassword, Map? passthrough, @@ -65,6 +69,7 @@ class ChangePasswordRequest extends Request { }) => ChangePasswordRequest( changePassword: changePassword ?? this.changePassword, + loginid: loginid ?? this.loginid, newPassword: newPassword ?? this.newPassword, oldPassword: oldPassword ?? this.oldPassword, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/confirm_email_receive.dart b/lib/basic_api/generated/confirm_email_receive.dart new file mode 100644 index 0000000000..252e9d7c92 --- /dev/null +++ b/lib/basic_api/generated/confirm_email_receive.dart @@ -0,0 +1,66 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/confirm_email_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Confirm email receive class. +class ConfirmEmailReceive extends Response { + /// Initialize ConfirmEmailReceive. + const ConfirmEmailReceive({ + this.confirmEmail, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory ConfirmEmailReceive.fromJson(Map json) => + ConfirmEmailReceive( + confirmEmail: + json['confirm_email'] == null ? null : json['confirm_email'] == 1, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// 1 for success (The verification code has been successfully verified) + final bool? confirmEmail; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'confirm_email': confirmEmail == null + ? null + : confirmEmail! + ? 1 + : 0, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + ConfirmEmailReceive copyWith({ + bool? confirmEmail, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + ConfirmEmailReceive( + confirmEmail: confirmEmail ?? this.confirmEmail, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/confirm_email_send.dart b/lib/basic_api/generated/confirm_email_send.dart new file mode 100644 index 0000000000..994958f7d6 --- /dev/null +++ b/lib/basic_api/generated/confirm_email_send.dart @@ -0,0 +1,78 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/confirm_email_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Confirm email request class. +class ConfirmEmailRequest extends Request { + /// Initialize ConfirmEmailRequest. + const ConfirmEmailRequest({ + this.confirmEmail = true, + required this.emailConsent, + required this.verificationCode, + super.msgType = 'confirm_email', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory ConfirmEmailRequest.fromJson(Map json) => + ConfirmEmailRequest( + confirmEmail: + json['confirm_email'] == null ? null : json['confirm_email'] == 1, + emailConsent: + json['email_consent'] == null ? null : json['email_consent'] == 1, + verificationCode: json['verification_code'] as String?, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// Must be `true` + final bool? confirmEmail; + + /// Boolean value: `true` or `false`, indicating whether the client has given consent for marketing emails. + final bool? emailConsent; + + /// Email verification code (received from a `verify_email` call, which must be done first). + final String? verificationCode; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'confirm_email': confirmEmail == null + ? null + : confirmEmail! + ? 1 + : 0, + 'email_consent': emailConsent == null + ? null + : emailConsent! + ? 1 + : 0, + 'verification_code': verificationCode, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + ConfirmEmailRequest copyWith({ + bool? confirmEmail, + bool? emailConsent, + String? verificationCode, + Map? passthrough, + int? reqId, + }) => + ConfirmEmailRequest( + confirmEmail: confirmEmail ?? this.confirmEmail, + emailConsent: emailConsent ?? this.emailConsent, + verificationCode: verificationCode ?? this.verificationCode, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/contract_update_history_receive.dart b/lib/basic_api/generated/contract_update_history_receive.dart index c4966ab0b6..969c413496 100644 --- a/lib/basic_api/generated/contract_update_history_receive.dart +++ b/lib/basic_api/generated/contract_update_history_receive.dart @@ -9,16 +9,11 @@ class ContractUpdateHistoryReceive extends Response { /// Initialize ContractUpdateHistoryReceive. const ContractUpdateHistoryReceive({ this.contractUpdateHistory, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory ContractUpdateHistoryReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/contract_update_history_send.dart b/lib/basic_api/generated/contract_update_history_send.dart index 804a6b89ee..dceb675006 100644 --- a/lib/basic_api/generated/contract_update_history_send.dart +++ b/lib/basic_api/generated/contract_update_history_send.dart @@ -11,13 +11,11 @@ class ContractUpdateHistoryRequest extends Request { required this.contractId, this.contractUpdateHistory = true, this.limit, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'contract_update_history', - passthrough: passthrough, - reqId: reqId, - ); + this.loginid, + super.msgType = 'contract_update_history', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory ContractUpdateHistoryRequest.fromJson(Map json) => @@ -27,6 +25,7 @@ class ContractUpdateHistoryRequest extends Request { ? null : json['contract_update_history'] == 1, limit: json['limit'] as num?, + loginid: json['loginid'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -40,6 +39,9 @@ class ContractUpdateHistoryRequest extends Request { /// [Optional] Maximum number of historical updates to receive. final num? limit; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Converts this instance to JSON @override Map toJson() => { @@ -50,6 +52,7 @@ class ContractUpdateHistoryRequest extends Request { ? 1 : 0, 'limit': limit, + 'loginid': loginid, 'passthrough': passthrough, 'req_id': reqId, }; @@ -60,6 +63,7 @@ class ContractUpdateHistoryRequest extends Request { int? contractId, bool? contractUpdateHistory, num? limit, + String? loginid, Map? passthrough, int? reqId, }) => @@ -68,6 +72,7 @@ class ContractUpdateHistoryRequest extends Request { contractUpdateHistory: contractUpdateHistory ?? this.contractUpdateHistory, limit: limit ?? this.limit, + loginid: loginid ?? this.loginid, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/contract_update_receive.dart b/lib/basic_api/generated/contract_update_receive.dart index b6409d69a5..2e27ff88d5 100644 --- a/lib/basic_api/generated/contract_update_receive.dart +++ b/lib/basic_api/generated/contract_update_receive.dart @@ -9,16 +9,11 @@ class ContractUpdateReceive extends Response { /// Initialize ContractUpdateReceive. const ContractUpdateReceive({ this.contractUpdate, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory ContractUpdateReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/contract_update_send.dart b/lib/basic_api/generated/contract_update_send.dart index 5c05c54eed..aa723f2224 100644 --- a/lib/basic_api/generated/contract_update_send.dart +++ b/lib/basic_api/generated/contract_update_send.dart @@ -11,13 +11,11 @@ class ContractUpdateRequest extends Request { required this.contractId, this.contractUpdate = true, required this.limitOrder, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'contract_update', - passthrough: passthrough, - reqId: reqId, - ); + this.loginid, + super.msgType = 'contract_update', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory ContractUpdateRequest.fromJson(Map json) => @@ -27,6 +25,7 @@ class ContractUpdateRequest extends Request { ? null : json['contract_update'] == 1, limitOrder: json['limit_order'] as Map?, + loginid: json['loginid'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -40,6 +39,9 @@ class ContractUpdateRequest extends Request { /// Specify limit order to update. final Map? limitOrder; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Converts this instance to JSON @override Map toJson() => { @@ -50,6 +52,7 @@ class ContractUpdateRequest extends Request { ? 1 : 0, 'limit_order': limitOrder, + 'loginid': loginid, 'passthrough': passthrough, 'req_id': reqId, }; @@ -60,6 +63,7 @@ class ContractUpdateRequest extends Request { int? contractId, bool? contractUpdate, Map? limitOrder, + String? loginid, Map? passthrough, int? reqId, }) => @@ -67,6 +71,7 @@ class ContractUpdateRequest extends Request { contractId: contractId ?? this.contractId, contractUpdate: contractUpdate ?? this.contractUpdate, limitOrder: limitOrder ?? this.limitOrder, + loginid: loginid ?? this.loginid, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/contracts_for_receive.dart b/lib/basic_api/generated/contracts_for_receive.dart index 6849f360e0..87a2b6b283 100644 --- a/lib/basic_api/generated/contracts_for_receive.dart +++ b/lib/basic_api/generated/contracts_for_receive.dart @@ -9,16 +9,11 @@ class ContractsForReceive extends Response { /// Initialize ContractsForReceive. const ContractsForReceive({ this.contractsFor, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory ContractsForReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/contracts_for_send.dart b/lib/basic_api/generated/contracts_for_send.dart index 0df6a2b578..cb83e44b4a 100644 --- a/lib/basic_api/generated/contracts_for_send.dart +++ b/lib/basic_api/generated/contracts_for_send.dart @@ -10,15 +10,14 @@ class ContractsForRequest extends Request { const ContractsForRequest({ required this.contractsFor, this.currency, - this.landingCompany, + required this.landingCompany, + this.landingCompanyShort, + this.loginid, this.productType, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'contracts_for', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'contracts_for', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory ContractsForRequest.fromJson(Map json) => @@ -26,6 +25,8 @@ class ContractsForRequest extends Request { contractsFor: json['contracts_for'] as String?, currency: json['currency'] as String?, landingCompany: json['landing_company'] as String?, + landingCompanyShort: json['landing_company_short'] as String?, + loginid: json['loginid'] as String?, productType: json['product_type'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, @@ -37,9 +38,15 @@ class ContractsForRequest extends Request { /// [Optional] Currency of the contract's stake and payout (obtained from `payout_currencies` call). final String? currency; - /// [Optional] Indicates which landing company to get a list of contracts for. If you are logged in, your account's landing company will override this field. + /// Deprecated - Replaced by landing_company_short. final String? landingCompany; + /// [Optional] Indicates which landing company to get a list of contracts for. If you are logged in, your account's landing company will override this field. Note that when landing_company_short is set to 'virtual', landing_company will take precendce until the deprecated field is removed from the api. + final String? landingCompanyShort; + + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] If you specify this field, only contracts tradable through that contract type will be returned. final String? productType; @@ -49,6 +56,8 @@ class ContractsForRequest extends Request { 'contracts_for': contractsFor, 'currency': currency, 'landing_company': landingCompany, + 'landing_company_short': landingCompanyShort, + 'loginid': loginid, 'product_type': productType, 'passthrough': passthrough, 'req_id': reqId, @@ -60,6 +69,8 @@ class ContractsForRequest extends Request { String? contractsFor, String? currency, String? landingCompany, + String? landingCompanyShort, + String? loginid, String? productType, Map? passthrough, int? reqId, @@ -68,6 +79,8 @@ class ContractsForRequest extends Request { contractsFor: contractsFor ?? this.contractsFor, currency: currency ?? this.currency, landingCompany: landingCompany ?? this.landingCompany, + landingCompanyShort: landingCompanyShort ?? this.landingCompanyShort, + loginid: loginid ?? this.loginid, productType: productType ?? this.productType, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/copy_start_receive.dart b/lib/basic_api/generated/copy_start_receive.dart index 03d771786d..d1a02d4ba4 100644 --- a/lib/basic_api/generated/copy_start_receive.dart +++ b/lib/basic_api/generated/copy_start_receive.dart @@ -9,16 +9,11 @@ class CopyStartReceive extends Response { /// Initialize CopyStartReceive. const CopyStartReceive({ this.copyStart, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory CopyStartReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/copy_start_send.dart b/lib/basic_api/generated/copy_start_send.dart index 7634f4a116..901abf5033 100644 --- a/lib/basic_api/generated/copy_start_send.dart +++ b/lib/basic_api/generated/copy_start_send.dart @@ -10,22 +10,21 @@ class CopyStartRequest extends Request { const CopyStartRequest({ this.assets, required this.copyStart, + this.loginid, this.maxTradeStake, this.minTradeStake, this.tradeTypes, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'copy_start', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'copy_start', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory CopyStartRequest.fromJson(Map json) => CopyStartRequest( assets: json['assets'] as dynamic, copyStart: json['copy_start'] as String?, + loginid: json['loginid'] as String?, maxTradeStake: json['max_trade_stake'] as num?, minTradeStake: json['min_trade_stake'] as num?, tradeTypes: json['trade_types'] as dynamic, @@ -39,6 +38,9 @@ class CopyStartRequest extends Request { /// API tokens identifying the accounts of trader which will be used to copy trades final String? copyStart; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] Used to set maximum trade stake to be copied. final num? maxTradeStake; @@ -53,6 +55,7 @@ class CopyStartRequest extends Request { Map toJson() => { 'assets': assets, 'copy_start': copyStart, + 'loginid': loginid, 'max_trade_stake': maxTradeStake, 'min_trade_stake': minTradeStake, 'trade_types': tradeTypes, @@ -65,6 +68,7 @@ class CopyStartRequest extends Request { CopyStartRequest copyWith({ dynamic assets, String? copyStart, + String? loginid, num? maxTradeStake, num? minTradeStake, dynamic tradeTypes, @@ -74,6 +78,7 @@ class CopyStartRequest extends Request { CopyStartRequest( assets: assets ?? this.assets, copyStart: copyStart ?? this.copyStart, + loginid: loginid ?? this.loginid, maxTradeStake: maxTradeStake ?? this.maxTradeStake, minTradeStake: minTradeStake ?? this.minTradeStake, tradeTypes: tradeTypes ?? this.tradeTypes, diff --git a/lib/basic_api/generated/copy_stop_receive.dart b/lib/basic_api/generated/copy_stop_receive.dart index 0532915f41..69ffc22337 100644 --- a/lib/basic_api/generated/copy_stop_receive.dart +++ b/lib/basic_api/generated/copy_stop_receive.dart @@ -9,16 +9,11 @@ class CopyStopReceive extends Response { /// Initialize CopyStopReceive. const CopyStopReceive({ this.copyStop, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory CopyStopReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/copy_stop_send.dart b/lib/basic_api/generated/copy_stop_send.dart index 85cf41cb5d..a9c5b88fc8 100644 --- a/lib/basic_api/generated/copy_stop_send.dart +++ b/lib/basic_api/generated/copy_stop_send.dart @@ -9,18 +9,17 @@ class CopyStopRequest extends Request { /// Initialize CopyStopRequest. const CopyStopRequest({ required this.copyStop, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'copy_stop', - passthrough: passthrough, - reqId: reqId, - ); + this.loginid, + super.msgType = 'copy_stop', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory CopyStopRequest.fromJson(Map json) => CopyStopRequest( copyStop: json['copy_stop'] as String?, + loginid: json['loginid'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -28,10 +27,14 @@ class CopyStopRequest extends Request { /// API tokens identifying the accounts which needs not to be copied final String? copyStop; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Converts this instance to JSON @override Map toJson() => { 'copy_stop': copyStop, + 'loginid': loginid, 'passthrough': passthrough, 'req_id': reqId, }; @@ -40,11 +43,13 @@ class CopyStopRequest extends Request { @override CopyStopRequest copyWith({ String? copyStop, + String? loginid, Map? passthrough, int? reqId, }) => CopyStopRequest( copyStop: copyStop ?? this.copyStop, + loginid: loginid ?? this.loginid, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/copytrading_list_receive.dart b/lib/basic_api/generated/copytrading_list_receive.dart index 14c224b48a..7cebc28c97 100644 --- a/lib/basic_api/generated/copytrading_list_receive.dart +++ b/lib/basic_api/generated/copytrading_list_receive.dart @@ -9,16 +9,11 @@ class CopytradingListReceive extends Response { /// Initialize CopytradingListReceive. const CopytradingListReceive({ this.copytradingList, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory CopytradingListReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/copytrading_list_send.dart b/lib/basic_api/generated/copytrading_list_send.dart index af799de8c6..86d1d8bb8e 100644 --- a/lib/basic_api/generated/copytrading_list_send.dart +++ b/lib/basic_api/generated/copytrading_list_send.dart @@ -9,13 +9,11 @@ class CopytradingListRequest extends Request { /// Initialize CopytradingListRequest. const CopytradingListRequest({ this.copytradingList = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'copytrading_list', - passthrough: passthrough, - reqId: reqId, - ); + this.loginid, + super.msgType = 'copytrading_list', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory CopytradingListRequest.fromJson(Map json) => @@ -23,6 +21,7 @@ class CopytradingListRequest extends Request { copytradingList: json['copytrading_list'] == null ? null : json['copytrading_list'] == 1, + loginid: json['loginid'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -30,6 +29,9 @@ class CopytradingListRequest extends Request { /// Must be `true` final bool? copytradingList; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Converts this instance to JSON @override Map toJson() => { @@ -38,6 +40,7 @@ class CopytradingListRequest extends Request { : copytradingList! ? 1 : 0, + 'loginid': loginid, 'passthrough': passthrough, 'req_id': reqId, }; @@ -46,11 +49,13 @@ class CopytradingListRequest extends Request { @override CopytradingListRequest copyWith({ bool? copytradingList, + String? loginid, Map? passthrough, int? reqId, }) => CopytradingListRequest( copytradingList: copytradingList ?? this.copytradingList, + loginid: loginid ?? this.loginid, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/copytrading_statistics_receive.dart b/lib/basic_api/generated/copytrading_statistics_receive.dart index 017869dde4..8fd1963226 100644 --- a/lib/basic_api/generated/copytrading_statistics_receive.dart +++ b/lib/basic_api/generated/copytrading_statistics_receive.dart @@ -9,16 +9,11 @@ class CopytradingStatisticsReceive extends Response { /// Initialize CopytradingStatisticsReceive. const CopytradingStatisticsReceive({ this.copytradingStatistics, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory CopytradingStatisticsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/copytrading_statistics_send.dart b/lib/basic_api/generated/copytrading_statistics_send.dart index 5ad5975a7c..9a0fe4ea59 100644 --- a/lib/basic_api/generated/copytrading_statistics_send.dart +++ b/lib/basic_api/generated/copytrading_statistics_send.dart @@ -10,13 +10,10 @@ class CopytradingStatisticsRequest extends Request { const CopytradingStatisticsRequest({ this.copytradingStatistics = true, required this.traderId, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'copytrading_statistics', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'copytrading_statistics', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory CopytradingStatisticsRequest.fromJson(Map json) => diff --git a/lib/basic_api/generated/crypto_config_receive.dart b/lib/basic_api/generated/crypto_config_receive.dart index 54388ba705..b6a7294953 100644 --- a/lib/basic_api/generated/crypto_config_receive.dart +++ b/lib/basic_api/generated/crypto_config_receive.dart @@ -9,16 +9,11 @@ class CryptoConfigReceive extends Response { /// Initialize CryptoConfigReceive. const CryptoConfigReceive({ this.cryptoConfig, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory CryptoConfigReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/crypto_config_send.dart b/lib/basic_api/generated/crypto_config_send.dart index 0cad832750..9f7286b74c 100644 --- a/lib/basic_api/generated/crypto_config_send.dart +++ b/lib/basic_api/generated/crypto_config_send.dart @@ -10,13 +10,11 @@ class CryptoConfigRequest extends Request { const CryptoConfigRequest({ this.cryptoConfig = true, this.currencyCode, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'crypto_config', - passthrough: passthrough, - reqId: reqId, - ); + this.loginid, + super.msgType = 'crypto_config', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory CryptoConfigRequest.fromJson(Map json) => @@ -24,6 +22,7 @@ class CryptoConfigRequest extends Request { cryptoConfig: json['crypto_config'] == null ? null : json['crypto_config'] == 1, currencyCode: json['currency_code'] as String?, + loginid: json['loginid'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -34,6 +33,9 @@ class CryptoConfigRequest extends Request { /// [Optional] Cryptocurrency code. Sending request with currency_code provides crypto config for the sent cryptocurrency code only. final String? currencyCode; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Converts this instance to JSON @override Map toJson() => { @@ -43,6 +45,7 @@ class CryptoConfigRequest extends Request { ? 1 : 0, 'currency_code': currencyCode, + 'loginid': loginid, 'passthrough': passthrough, 'req_id': reqId, }; @@ -52,12 +55,14 @@ class CryptoConfigRequest extends Request { CryptoConfigRequest copyWith({ bool? cryptoConfig, String? currencyCode, + String? loginid, Map? passthrough, int? reqId, }) => CryptoConfigRequest( cryptoConfig: cryptoConfig ?? this.cryptoConfig, currencyCode: currencyCode ?? this.currencyCode, + loginid: loginid ?? this.loginid, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/crypto_estimations_receive.dart b/lib/basic_api/generated/crypto_estimations_receive.dart new file mode 100644 index 0000000000..7307cc6c36 --- /dev/null +++ b/lib/basic_api/generated/crypto_estimations_receive.dart @@ -0,0 +1,69 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/crypto_estimations_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Crypto estimations receive class. +class CryptoEstimationsReceive extends Response { + /// Initialize CryptoEstimationsReceive. + const CryptoEstimationsReceive({ + this.cryptoEstimations, + this.subscription, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory CryptoEstimationsReceive.fromJson(Map json) => + CryptoEstimationsReceive( + cryptoEstimations: json['crypto_estimations'] as Map?, + subscription: json['subscription'] as Map?, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// Cryptocurrency estimations. E.g. Withdrawal fee estimations. + final Map? cryptoEstimations; + + /// For subscription requests only. + final Map? subscription; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'crypto_estimations': cryptoEstimations, + 'subscription': subscription, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + CryptoEstimationsReceive copyWith({ + Map? cryptoEstimations, + Map? subscription, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + CryptoEstimationsReceive( + cryptoEstimations: cryptoEstimations ?? this.cryptoEstimations, + subscription: subscription ?? this.subscription, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/crypto_estimations_send.dart b/lib/basic_api/generated/crypto_estimations_send.dart new file mode 100644 index 0000000000..0c3024160e --- /dev/null +++ b/lib/basic_api/generated/crypto_estimations_send.dart @@ -0,0 +1,86 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/crypto_estimations_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Crypto estimations request class. +class CryptoEstimationsRequest extends Request { + /// Initialize CryptoEstimationsRequest. + const CryptoEstimationsRequest({ + this.cryptoEstimations = true, + required this.currencyCode, + this.loginid, + this.subscribe, + super.msgType = 'crypto_estimations', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory CryptoEstimationsRequest.fromJson(Map json) => + CryptoEstimationsRequest( + cryptoEstimations: json['crypto_estimations'] == null + ? null + : json['crypto_estimations'] == 1, + currencyCode: json['currency_code'] as String?, + loginid: json['loginid'] as String?, + subscribe: json['subscribe'] == null ? null : json['subscribe'] == 1, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// Must be `true` + final bool? cryptoEstimations; + + /// Cryptocurrency code for which fee estimation is provided. + final String? currencyCode; + + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + + /// [Optional] If set to `true`, will send updates whenever there is an update to crypto estimations. + final bool? subscribe; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'crypto_estimations': cryptoEstimations == null + ? null + : cryptoEstimations! + ? 1 + : 0, + 'currency_code': currencyCode, + 'loginid': loginid, + 'subscribe': subscribe == null + ? null + : subscribe! + ? 1 + : 0, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + CryptoEstimationsRequest copyWith({ + bool? cryptoEstimations, + String? currencyCode, + String? loginid, + bool? subscribe, + Map? passthrough, + int? reqId, + }) => + CryptoEstimationsRequest( + cryptoEstimations: cryptoEstimations ?? this.cryptoEstimations, + currencyCode: currencyCode ?? this.currencyCode, + loginid: loginid ?? this.loginid, + subscribe: subscribe ?? this.subscribe, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/document_upload_receive.dart b/lib/basic_api/generated/document_upload_receive.dart index 1018890180..8f66e1dcce 100644 --- a/lib/basic_api/generated/document_upload_receive.dart +++ b/lib/basic_api/generated/document_upload_receive.dart @@ -9,16 +9,11 @@ class DocumentUploadReceive extends Response { /// Initialize DocumentUploadReceive. const DocumentUploadReceive({ this.documentUpload, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory DocumentUploadReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/document_upload_send.dart b/lib/basic_api/generated/document_upload_send.dart index 87926e1379..729a1c754f 100644 --- a/lib/basic_api/generated/document_upload_send.dart +++ b/lib/basic_api/generated/document_upload_send.dart @@ -10,22 +10,20 @@ class DocumentUploadRequest extends Request { const DocumentUploadRequest({ required this.documentFormat, this.documentId, - this.documentIssuingCountry, + required this.documentIssuingCountry, required this.documentType, this.documentUpload = true, required this.expectedChecksum, this.expirationDate, required this.fileSize, this.lifetimeValid, + this.loginid, this.pageType, this.proofOfOwnership, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'document_upload', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'document_upload', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory DocumentUploadRequest.fromJson(Map json) => @@ -42,6 +40,7 @@ class DocumentUploadRequest extends Request { fileSize: json['file_size'] as int?, lifetimeValid: json['lifetime_valid'] == null ? null : json['lifetime_valid'] == 1, + loginid: json['loginid'] as String?, pageType: json['page_type'] as String?, proofOfOwnership: json['proof_of_ownership'] as Map?, passthrough: json['passthrough'] as Map?, @@ -54,7 +53,7 @@ class DocumentUploadRequest extends Request { /// [Optional] Document ID (required for Passport, Proof of ID and Driver's License) final String? documentId; - /// [Optional] 2-letter country code + /// 2-letter country code, mandatory for POI only final String? documentIssuingCountry; /// Document type @@ -75,6 +74,9 @@ class DocumentUploadRequest extends Request { /// [Optional] Boolean value that indicates whether this document is lifetime valid (only applies to POI document types, cancels out the expiration_date given if any) final bool? lifetimeValid; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] To determine document side final String? pageType; @@ -101,6 +103,7 @@ class DocumentUploadRequest extends Request { : lifetimeValid! ? 1 : 0, + 'loginid': loginid, 'page_type': pageType, 'proof_of_ownership': proofOfOwnership, 'passthrough': passthrough, @@ -119,6 +122,7 @@ class DocumentUploadRequest extends Request { String? expirationDate, int? fileSize, bool? lifetimeValid, + String? loginid, String? pageType, Map? proofOfOwnership, Map? passthrough, @@ -135,6 +139,7 @@ class DocumentUploadRequest extends Request { expirationDate: expirationDate ?? this.expirationDate, fileSize: fileSize ?? this.fileSize, lifetimeValid: lifetimeValid ?? this.lifetimeValid, + loginid: loginid ?? this.loginid, pageType: pageType ?? this.pageType, proofOfOwnership: proofOfOwnership ?? this.proofOfOwnership, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/economic_calendar_receive.dart b/lib/basic_api/generated/economic_calendar_receive.dart index 642f672ca0..0793e8109b 100644 --- a/lib/basic_api/generated/economic_calendar_receive.dart +++ b/lib/basic_api/generated/economic_calendar_receive.dart @@ -9,16 +9,11 @@ class EconomicCalendarReceive extends Response { /// Initialize EconomicCalendarReceive. const EconomicCalendarReceive({ this.economicCalendar, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory EconomicCalendarReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/economic_calendar_send.dart b/lib/basic_api/generated/economic_calendar_send.dart index 10a139c6c4..2f169d8989 100644 --- a/lib/basic_api/generated/economic_calendar_send.dart +++ b/lib/basic_api/generated/economic_calendar_send.dart @@ -12,13 +12,10 @@ class EconomicCalendarRequest extends Request { this.economicCalendar = true, this.endDate, this.startDate, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'economic_calendar', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'economic_calendar', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory EconomicCalendarRequest.fromJson(Map json) => diff --git a/lib/basic_api/generated/exchange_rates_receive.dart b/lib/basic_api/generated/exchange_rates_receive.dart index 7641414ddc..8feaaddb97 100644 --- a/lib/basic_api/generated/exchange_rates_receive.dart +++ b/lib/basic_api/generated/exchange_rates_receive.dart @@ -10,16 +10,11 @@ class ExchangeRatesReceive extends Response { const ExchangeRatesReceive({ this.exchangeRates, this.subscription, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory ExchangeRatesReceive.fromJson(Map json) => @@ -32,7 +27,7 @@ class ExchangeRatesReceive extends Response { reqId: json['req_id'] as int?, ); - /// Exchange rate values from base to all other currencies + /// Exchange rate values from base to target currency final Map? exchangeRates; /// For subscription requests only. diff --git a/lib/basic_api/generated/exchange_rates_send.dart b/lib/basic_api/generated/exchange_rates_send.dart index 15c6f12418..6c08531283 100644 --- a/lib/basic_api/generated/exchange_rates_send.dart +++ b/lib/basic_api/generated/exchange_rates_send.dart @@ -10,15 +10,13 @@ class ExchangeRatesRequest extends Request { const ExchangeRatesRequest({ required this.baseCurrency, this.exchangeRates = true, + this.loginid, this.subscribe, this.targetCurrency, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'exchange_rates', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'exchange_rates', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory ExchangeRatesRequest.fromJson(Map json) => @@ -26,6 +24,7 @@ class ExchangeRatesRequest extends Request { baseCurrency: json['base_currency'] as String?, exchangeRates: json['exchange_rates'] == null ? null : json['exchange_rates'] == 1, + loginid: json['loginid'] as String?, subscribe: json['subscribe'] == null ? null : json['subscribe'] == 1, targetCurrency: json['target_currency'] as String?, passthrough: json['passthrough'] as Map?, @@ -38,10 +37,13 @@ class ExchangeRatesRequest extends Request { /// Must be `true` final bool? exchangeRates; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] `true` - to initiate a realtime stream of exchange rates relative to base currency. final bool? subscribe; - /// [Optional] Local currency + /// [Optional] Target currency for the exchange rate. If subscribe is set, target_currency must be specified as well. final String? targetCurrency; /// Converts this instance to JSON @@ -53,6 +55,7 @@ class ExchangeRatesRequest extends Request { : exchangeRates! ? 1 : 0, + 'loginid': loginid, 'subscribe': subscribe == null ? null : subscribe! @@ -68,6 +71,7 @@ class ExchangeRatesRequest extends Request { ExchangeRatesRequest copyWith({ String? baseCurrency, bool? exchangeRates, + String? loginid, bool? subscribe, String? targetCurrency, Map? passthrough, @@ -76,6 +80,7 @@ class ExchangeRatesRequest extends Request { ExchangeRatesRequest( baseCurrency: baseCurrency ?? this.baseCurrency, exchangeRates: exchangeRates ?? this.exchangeRates, + loginid: loginid ?? this.loginid, subscribe: subscribe ?? this.subscribe, targetCurrency: targetCurrency ?? this.targetCurrency, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/forget_all_receive.dart b/lib/basic_api/generated/forget_all_receive.dart index d1c6cdba71..ce27aacde5 100644 --- a/lib/basic_api/generated/forget_all_receive.dart +++ b/lib/basic_api/generated/forget_all_receive.dart @@ -9,16 +9,11 @@ class ForgetAllReceive extends Response { /// Initialize ForgetAllReceive. const ForgetAllReceive({ this.forgetAll, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory ForgetAllReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/forget_all_send.dart b/lib/basic_api/generated/forget_all_send.dart index 200544b702..50aceeee06 100644 --- a/lib/basic_api/generated/forget_all_send.dart +++ b/lib/basic_api/generated/forget_all_send.dart @@ -9,13 +9,10 @@ class ForgetAllRequest extends Request { /// Initialize ForgetAllRequest. const ForgetAllRequest({ this.forgetAll, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'forget_all', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'forget_all', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory ForgetAllRequest.fromJson(Map json) => diff --git a/lib/basic_api/generated/forget_receive.dart b/lib/basic_api/generated/forget_receive.dart index e81d5cff2d..d92f6c2533 100644 --- a/lib/basic_api/generated/forget_receive.dart +++ b/lib/basic_api/generated/forget_receive.dart @@ -9,16 +9,11 @@ class ForgetReceive extends Response { /// Initialize ForgetReceive. const ForgetReceive({ this.forget, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory ForgetReceive.fromJson(Map json) => ForgetReceive( diff --git a/lib/basic_api/generated/forget_send.dart b/lib/basic_api/generated/forget_send.dart index b0573eae69..49ab1c445b 100644 --- a/lib/basic_api/generated/forget_send.dart +++ b/lib/basic_api/generated/forget_send.dart @@ -9,13 +9,10 @@ class ForgetRequest extends Request { /// Initialize ForgetRequest. const ForgetRequest({ required this.forget, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'forget', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'forget', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory ForgetRequest.fromJson(Map json) => ForgetRequest( diff --git a/lib/basic_api/generated/get_account_status_receive.dart b/lib/basic_api/generated/get_account_status_receive.dart index c0079484dd..1309c67235 100644 --- a/lib/basic_api/generated/get_account_status_receive.dart +++ b/lib/basic_api/generated/get_account_status_receive.dart @@ -9,16 +9,11 @@ class GetAccountStatusReceive extends Response { /// Initialize GetAccountStatusReceive. const GetAccountStatusReceive({ this.getAccountStatus, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory GetAccountStatusReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/get_account_status_send.dart b/lib/basic_api/generated/get_account_status_send.dart index 769f44df7e..a3cb6623a6 100644 --- a/lib/basic_api/generated/get_account_status_send.dart +++ b/lib/basic_api/generated/get_account_status_send.dart @@ -9,13 +9,11 @@ class GetAccountStatusRequest extends Request { /// Initialize GetAccountStatusRequest. const GetAccountStatusRequest({ this.getAccountStatus = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'get_account_status', - passthrough: passthrough, - reqId: reqId, - ); + this.loginid, + super.msgType = 'get_account_status', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory GetAccountStatusRequest.fromJson(Map json) => @@ -23,6 +21,7 @@ class GetAccountStatusRequest extends Request { getAccountStatus: json['get_account_status'] == null ? null : json['get_account_status'] == 1, + loginid: json['loginid'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -30,6 +29,9 @@ class GetAccountStatusRequest extends Request { /// Must be `true` final bool? getAccountStatus; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Converts this instance to JSON @override Map toJson() => { @@ -38,6 +40,7 @@ class GetAccountStatusRequest extends Request { : getAccountStatus! ? 1 : 0, + 'loginid': loginid, 'passthrough': passthrough, 'req_id': reqId, }; @@ -46,11 +49,13 @@ class GetAccountStatusRequest extends Request { @override GetAccountStatusRequest copyWith({ bool? getAccountStatus, + String? loginid, Map? passthrough, int? reqId, }) => GetAccountStatusRequest( getAccountStatus: getAccountStatus ?? this.getAccountStatus, + loginid: loginid ?? this.loginid, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/get_account_types_send.dart b/lib/basic_api/generated/get_account_types_send.dart index 3697fec157..a65e686b82 100644 --- a/lib/basic_api/generated/get_account_types_send.dart +++ b/lib/basic_api/generated/get_account_types_send.dart @@ -10,6 +10,7 @@ class GetAccountTypesRequest extends Request { const GetAccountTypesRequest({ this.company, this.getAccountTypes = true, + this.loginid, super.msgType = 'get_account_types', super.passthrough, super.reqId, @@ -22,6 +23,7 @@ class GetAccountTypesRequest extends Request { getAccountTypes: json['get_account_types'] == null ? null : json['get_account_types'] == 1, + loginid: json['loginid'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -32,6 +34,9 @@ class GetAccountTypesRequest extends Request { /// Must be `true` final bool? getAccountTypes; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Converts this instance to JSON @override Map toJson() => { @@ -41,6 +46,7 @@ class GetAccountTypesRequest extends Request { : getAccountTypes! ? 1 : 0, + 'loginid': loginid, 'passthrough': passthrough, 'req_id': reqId, }; @@ -50,12 +56,14 @@ class GetAccountTypesRequest extends Request { GetAccountTypesRequest copyWith({ String? company, bool? getAccountTypes, + String? loginid, Map? passthrough, int? reqId, }) => GetAccountTypesRequest( company: company ?? this.company, getAccountTypes: getAccountTypes ?? this.getAccountTypes, + loginid: loginid ?? this.loginid, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/get_available_accounts_to_transfer_receive.dart b/lib/basic_api/generated/get_available_accounts_to_transfer_receive.dart deleted file mode 100644 index a1e316c94a..0000000000 --- a/lib/basic_api/generated/get_available_accounts_to_transfer_receive.dart +++ /dev/null @@ -1,69 +0,0 @@ -/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/get_available_accounts_to_transfer_receive.json. - -// ignore_for_file: always_put_required_named_parameters_first - -import '../response.dart'; - -/// Get available accounts to transfer receive class. -class GetAvailableAccountsToTransferReceive extends Response { - /// Initialize GetAvailableAccountsToTransferReceive. - const GetAvailableAccountsToTransferReceive({ - this.getAvailableAccountsToTransfer, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); - - /// Creates an instance from JSON. - factory GetAvailableAccountsToTransferReceive.fromJson( - Map json) => - GetAvailableAccountsToTransferReceive( - getAvailableAccountsToTransfer: - json['get_available_accounts_to_transfer'] as Map?, - echoReq: json['echo_req'] as Map?, - error: json['error'] as Map?, - msgType: json['msg_type'] as String?, - reqId: json['req_id'] as int?, - ); - - /// Returns a list of accounts available to transfer - final Map? getAvailableAccountsToTransfer; - - /// Converts this instance to JSON - @override - Map toJson() => { - 'get_available_accounts_to_transfer': getAvailableAccountsToTransfer, - 'echo_req': echoReq, - 'error': error, - 'msg_type': msgType, - 'req_id': reqId, - }; - - /// Creates a copy of instance with given parameters - @override - GetAvailableAccountsToTransferReceive copyWith({ - Map? getAvailableAccountsToTransfer, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) => - GetAvailableAccountsToTransferReceive( - getAvailableAccountsToTransfer: getAvailableAccountsToTransfer ?? - this.getAvailableAccountsToTransfer, - echoReq: echoReq ?? this.echoReq, - error: error ?? this.error, - msgType: msgType ?? this.msgType, - reqId: reqId ?? this.reqId, - ); - - /// Override equatable class. - @override - List get props => []; -} diff --git a/lib/basic_api/generated/get_available_accounts_to_transfer_send.dart b/lib/basic_api/generated/get_available_accounts_to_transfer_send.dart deleted file mode 100644 index f4fe1a15e1..0000000000 --- a/lib/basic_api/generated/get_available_accounts_to_transfer_send.dart +++ /dev/null @@ -1,73 +0,0 @@ -/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/get_available_accounts_to_transfer_send.json. - -// ignore_for_file: always_put_required_named_parameters_first - -import '../request.dart'; - -/// Get available accounts to transfer request class. -class GetAvailableAccountsToTransferRequest extends Request { - /// Initialize GetAvailableAccountsToTransferRequest. - const GetAvailableAccountsToTransferRequest({ - this.getAvailableAccountsToTransfer = true, - required this.loginid, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'get_available_accounts_to_transfer', - passthrough: passthrough, - reqId: reqId, - ); - - /// Creates an instance from JSON. - factory GetAvailableAccountsToTransferRequest.fromJson( - Map json) => - GetAvailableAccountsToTransferRequest( - getAvailableAccountsToTransfer: - json['get_available_accounts_to_transfer'] == null - ? null - : json['get_available_accounts_to_transfer'] == 1, - loginid: json['loginid'] as String?, - passthrough: json['passthrough'] as Map?, - reqId: json['req_id'] as int?, - ); - - /// Must be `true` - final bool? getAvailableAccountsToTransfer; - - /// The unique identifier for this trading/wallet account. - final String? loginid; - - /// Converts this instance to JSON - @override - Map toJson() => { - 'get_available_accounts_to_transfer': - getAvailableAccountsToTransfer == null - ? null - : getAvailableAccountsToTransfer! - ? 1 - : 0, - 'loginid': loginid, - 'passthrough': passthrough, - 'req_id': reqId, - }; - - /// Creates a copy of instance with given parameters - @override - GetAvailableAccountsToTransferRequest copyWith({ - bool? getAvailableAccountsToTransfer, - String? loginid, - Map? passthrough, - int? reqId, - }) => - GetAvailableAccountsToTransferRequest( - getAvailableAccountsToTransfer: getAvailableAccountsToTransfer ?? - this.getAvailableAccountsToTransfer, - loginid: loginid ?? this.loginid, - passthrough: passthrough ?? this.passthrough, - reqId: reqId ?? this.reqId, - ); - - /// Override equatable class. - @override - List get props => []; -} diff --git a/lib/basic_api/generated/get_financial_assessment_receive.dart b/lib/basic_api/generated/get_financial_assessment_receive.dart index 994f7a53f6..9db6b6ec0c 100644 --- a/lib/basic_api/generated/get_financial_assessment_receive.dart +++ b/lib/basic_api/generated/get_financial_assessment_receive.dart @@ -9,16 +9,11 @@ class GetFinancialAssessmentReceive extends Response { /// Initialize GetFinancialAssessmentReceive. const GetFinancialAssessmentReceive({ this.getFinancialAssessment, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory GetFinancialAssessmentReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/get_financial_assessment_send.dart b/lib/basic_api/generated/get_financial_assessment_send.dart index e70e3d3e97..83cdd4d8ea 100644 --- a/lib/basic_api/generated/get_financial_assessment_send.dart +++ b/lib/basic_api/generated/get_financial_assessment_send.dart @@ -9,13 +9,11 @@ class GetFinancialAssessmentRequest extends Request { /// Initialize GetFinancialAssessmentRequest. const GetFinancialAssessmentRequest({ this.getFinancialAssessment = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'get_financial_assessment', - passthrough: passthrough, - reqId: reqId, - ); + this.loginid, + super.msgType = 'get_financial_assessment', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory GetFinancialAssessmentRequest.fromJson(Map json) => @@ -23,6 +21,7 @@ class GetFinancialAssessmentRequest extends Request { getFinancialAssessment: json['get_financial_assessment'] == null ? null : json['get_financial_assessment'] == 1, + loginid: json['loginid'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -30,6 +29,9 @@ class GetFinancialAssessmentRequest extends Request { /// Must be `true` final bool? getFinancialAssessment; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Converts this instance to JSON @override Map toJson() => { @@ -38,6 +40,7 @@ class GetFinancialAssessmentRequest extends Request { : getFinancialAssessment! ? 1 : 0, + 'loginid': loginid, 'passthrough': passthrough, 'req_id': reqId, }; @@ -46,12 +49,14 @@ class GetFinancialAssessmentRequest extends Request { @override GetFinancialAssessmentRequest copyWith({ bool? getFinancialAssessment, + String? loginid, Map? passthrough, int? reqId, }) => GetFinancialAssessmentRequest( getFinancialAssessment: getFinancialAssessment ?? this.getFinancialAssessment, + loginid: loginid ?? this.loginid, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/get_self_exclusion_receive.dart b/lib/basic_api/generated/get_self_exclusion_receive.dart index d1781e836a..ca57f382da 100644 --- a/lib/basic_api/generated/get_self_exclusion_receive.dart +++ b/lib/basic_api/generated/get_self_exclusion_receive.dart @@ -9,16 +9,11 @@ class GetSelfExclusionReceive extends Response { /// Initialize GetSelfExclusionReceive. const GetSelfExclusionReceive({ this.getSelfExclusion, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory GetSelfExclusionReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/get_self_exclusion_send.dart b/lib/basic_api/generated/get_self_exclusion_send.dart index 6f8aa75381..b400b871aa 100644 --- a/lib/basic_api/generated/get_self_exclusion_send.dart +++ b/lib/basic_api/generated/get_self_exclusion_send.dart @@ -9,13 +9,11 @@ class GetSelfExclusionRequest extends Request { /// Initialize GetSelfExclusionRequest. const GetSelfExclusionRequest({ this.getSelfExclusion = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'get_self_exclusion', - passthrough: passthrough, - reqId: reqId, - ); + this.loginid, + super.msgType = 'get_self_exclusion', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory GetSelfExclusionRequest.fromJson(Map json) => @@ -23,6 +21,7 @@ class GetSelfExclusionRequest extends Request { getSelfExclusion: json['get_self_exclusion'] == null ? null : json['get_self_exclusion'] == 1, + loginid: json['loginid'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -30,6 +29,9 @@ class GetSelfExclusionRequest extends Request { /// Must be `true` final bool? getSelfExclusion; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Converts this instance to JSON @override Map toJson() => { @@ -38,6 +40,7 @@ class GetSelfExclusionRequest extends Request { : getSelfExclusion! ? 1 : 0, + 'loginid': loginid, 'passthrough': passthrough, 'req_id': reqId, }; @@ -46,11 +49,13 @@ class GetSelfExclusionRequest extends Request { @override GetSelfExclusionRequest copyWith({ bool? getSelfExclusion, + String? loginid, Map? passthrough, int? reqId, }) => GetSelfExclusionRequest( getSelfExclusion: getSelfExclusion ?? this.getSelfExclusion, + loginid: loginid ?? this.loginid, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/get_settings_send.dart b/lib/basic_api/generated/get_settings_send.dart index 2f8605934c..3f666ef92f 100644 --- a/lib/basic_api/generated/get_settings_send.dart +++ b/lib/basic_api/generated/get_settings_send.dart @@ -9,6 +9,7 @@ class GetSettingsRequest extends Request { /// Initialize GetSettingsRequest. const GetSettingsRequest({ this.getSettings = true, + this.loginid, super.msgType = 'get_settings', super.passthrough, super.reqId, @@ -19,6 +20,7 @@ class GetSettingsRequest extends Request { GetSettingsRequest( getSettings: json['get_settings'] == null ? null : json['get_settings'] == 1, + loginid: json['loginid'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -26,6 +28,9 @@ class GetSettingsRequest extends Request { /// Must be `true` final bool? getSettings; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Converts this instance to JSON @override Map toJson() => { @@ -34,6 +39,7 @@ class GetSettingsRequest extends Request { : getSettings! ? 1 : 0, + 'loginid': loginid, 'passthrough': passthrough, 'req_id': reqId, }; @@ -42,11 +48,13 @@ class GetSettingsRequest extends Request { @override GetSettingsRequest copyWith({ bool? getSettings, + String? loginid, Map? passthrough, int? reqId, }) => GetSettingsRequest( getSettings: getSettings ?? this.getSettings, + loginid: loginid ?? this.loginid, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/identity_verification_document_add_receive.dart b/lib/basic_api/generated/identity_verification_document_add_receive.dart index 56be3ce8de..280856d024 100644 --- a/lib/basic_api/generated/identity_verification_document_add_receive.dart +++ b/lib/basic_api/generated/identity_verification_document_add_receive.dart @@ -9,16 +9,11 @@ class IdentityVerificationDocumentAddReceive extends Response { /// Initialize IdentityVerificationDocumentAddReceive. const IdentityVerificationDocumentAddReceive({ this.identityVerificationDocumentAdd, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory IdentityVerificationDocumentAddReceive.fromJson( diff --git a/lib/basic_api/generated/identity_verification_document_add_send.dart b/lib/basic_api/generated/identity_verification_document_add_send.dart index 474338cd96..4ccd6279f4 100644 --- a/lib/basic_api/generated/identity_verification_document_add_send.dart +++ b/lib/basic_api/generated/identity_verification_document_add_send.dart @@ -8,22 +8,22 @@ import '../request.dart'; class IdentityVerificationDocumentAddRequest extends Request { /// Initialize IdentityVerificationDocumentAddRequest. const IdentityVerificationDocumentAddRequest({ + this.documentAdditional, required this.documentNumber, required this.documentType, this.identityVerificationDocumentAdd = true, required this.issuingCountry, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'identity_verification_document_add', - passthrough: passthrough, - reqId: reqId, - ); + this.loginid, + super.msgType = 'identity_verification_document_add', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory IdentityVerificationDocumentAddRequest.fromJson( Map json) => IdentityVerificationDocumentAddRequest( + documentAdditional: json['document_additional'] as String?, documentNumber: json['document_number'] as String?, documentType: json['document_type'] as String?, identityVerificationDocumentAdd: @@ -31,10 +31,14 @@ class IdentityVerificationDocumentAddRequest extends Request { ? null : json['identity_verification_document_add'] == 1, issuingCountry: json['issuing_country'] as String?, + loginid: json['loginid'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); + /// [Optional] Additional info required by some document types. + final String? documentAdditional; + /// The identification number of the document. final String? documentNumber; @@ -47,9 +51,13 @@ class IdentityVerificationDocumentAddRequest extends Request { /// 2-letter country code (can obtained from `residence_list` call). final String? issuingCountry; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Converts this instance to JSON @override Map toJson() => { + 'document_additional': documentAdditional, 'document_number': documentNumber, 'document_type': documentType, 'identity_verification_document_add': @@ -59,6 +67,7 @@ class IdentityVerificationDocumentAddRequest extends Request { ? 1 : 0, 'issuing_country': issuingCountry, + 'loginid': loginid, 'passthrough': passthrough, 'req_id': reqId, }; @@ -66,19 +75,23 @@ class IdentityVerificationDocumentAddRequest extends Request { /// Creates a copy of instance with given parameters @override IdentityVerificationDocumentAddRequest copyWith({ + String? documentAdditional, String? documentNumber, String? documentType, bool? identityVerificationDocumentAdd, String? issuingCountry, + String? loginid, Map? passthrough, int? reqId, }) => IdentityVerificationDocumentAddRequest( + documentAdditional: documentAdditional ?? this.documentAdditional, documentNumber: documentNumber ?? this.documentNumber, documentType: documentType ?? this.documentType, identityVerificationDocumentAdd: identityVerificationDocumentAdd ?? this.identityVerificationDocumentAdd, issuingCountry: issuingCountry ?? this.issuingCountry, + loginid: loginid ?? this.loginid, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/jtoken_create_receive.dart b/lib/basic_api/generated/jtoken_create_receive.dart new file mode 100644 index 0000000000..536c7d6538 --- /dev/null +++ b/lib/basic_api/generated/jtoken_create_receive.dart @@ -0,0 +1,61 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/jtoken_create_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Jtoken create receive class. +class JtokenCreateReceive extends Response { + /// Initialize JtokenCreateReceive. + const JtokenCreateReceive({ + this.jtokenCreate, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory JtokenCreateReceive.fromJson(Map json) => + JtokenCreateReceive( + jtokenCreate: json['jtoken_create'] as String?, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// The JToken created. + final String? jtokenCreate; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'jtoken_create': jtokenCreate, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + JtokenCreateReceive copyWith({ + String? jtokenCreate, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + JtokenCreateReceive( + jtokenCreate: jtokenCreate ?? this.jtokenCreate, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/jtoken_create_send.dart b/lib/basic_api/generated/jtoken_create_send.dart new file mode 100644 index 0000000000..5c54206d13 --- /dev/null +++ b/lib/basic_api/generated/jtoken_create_send.dart @@ -0,0 +1,65 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/jtoken_create_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Jtoken create request class. +class JtokenCreateRequest extends Request { + /// Initialize JtokenCreateRequest. + const JtokenCreateRequest({ + this.jtokenCreate = true, + this.loginid, + super.msgType = 'jtoken_create', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory JtokenCreateRequest.fromJson(Map json) => + JtokenCreateRequest( + jtokenCreate: + json['jtoken_create'] == null ? null : json['jtoken_create'] == 1, + loginid: json['loginid'] as String?, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// Must be `true` + final bool? jtokenCreate; + + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'jtoken_create': jtokenCreate == null + ? null + : jtokenCreate! + ? 1 + : 0, + 'loginid': loginid, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + JtokenCreateRequest copyWith({ + bool? jtokenCreate, + String? loginid, + Map? passthrough, + int? reqId, + }) => + JtokenCreateRequest( + jtokenCreate: jtokenCreate ?? this.jtokenCreate, + loginid: loginid ?? this.loginid, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/kyc_auth_status_receive.dart b/lib/basic_api/generated/kyc_auth_status_receive.dart new file mode 100644 index 0000000000..434f7d374b --- /dev/null +++ b/lib/basic_api/generated/kyc_auth_status_receive.dart @@ -0,0 +1,61 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/kyc_auth_status_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Kyc auth status receive class. +class KycAuthStatusReceive extends Response { + /// Initialize KycAuthStatusReceive. + const KycAuthStatusReceive({ + this.kycAuthStatus, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory KycAuthStatusReceive.fromJson(Map json) => + KycAuthStatusReceive( + kycAuthStatus: json['kyc_auth_status'] as dynamic, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// Proof of Identity (POI) and Proof of Address (POA) authentication status details. + final dynamic kycAuthStatus; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'kyc_auth_status': kycAuthStatus, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + KycAuthStatusReceive copyWith({ + dynamic kycAuthStatus, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + KycAuthStatusReceive( + kycAuthStatus: kycAuthStatus ?? this.kycAuthStatus, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/kyc_auth_status_send.dart b/lib/basic_api/generated/kyc_auth_status_send.dart new file mode 100644 index 0000000000..f83df89b98 --- /dev/null +++ b/lib/basic_api/generated/kyc_auth_status_send.dart @@ -0,0 +1,84 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/kyc_auth_status_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Kyc auth status request class. +class KycAuthStatusRequest extends Request { + /// Initialize KycAuthStatusRequest. + const KycAuthStatusRequest({ + required this.country, + this.kycAuthStatus = true, + required this.landingCompanies, + this.loginid, + super.msgType = 'kyc_auth_status', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory KycAuthStatusRequest.fromJson(Map json) => + KycAuthStatusRequest( + country: json['country'] as String?, + kycAuthStatus: json['kyc_auth_status'] == null + ? null + : json['kyc_auth_status'] == 1, + landingCompanies: (json['landing_companies'] as List?) + ?.map((dynamic item) => item as String) + .toList(), + loginid: json['loginid'] as String?, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// The country for which service availability is being verified, 2-letter country code + final String? country; + + /// Must be `true` + final bool? kycAuthStatus; + + /// Indicates which landing companies to get the KYC authentication status for. + final List? landingCompanies; + + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'country': country, + 'kyc_auth_status': kycAuthStatus == null + ? null + : kycAuthStatus! + ? 1 + : 0, + 'landing_companies': landingCompanies, + 'loginid': loginid, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + KycAuthStatusRequest copyWith({ + String? country, + bool? kycAuthStatus, + List? landingCompanies, + String? loginid, + Map? passthrough, + int? reqId, + }) => + KycAuthStatusRequest( + country: country ?? this.country, + kycAuthStatus: kycAuthStatus ?? this.kycAuthStatus, + landingCompanies: landingCompanies ?? this.landingCompanies, + loginid: loginid ?? this.loginid, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/landing_company_details_receive.dart b/lib/basic_api/generated/landing_company_details_receive.dart index 4d19e37a5c..185000ce89 100644 --- a/lib/basic_api/generated/landing_company_details_receive.dart +++ b/lib/basic_api/generated/landing_company_details_receive.dart @@ -9,16 +9,11 @@ class LandingCompanyDetailsReceive extends Response { /// Initialize LandingCompanyDetailsReceive. const LandingCompanyDetailsReceive({ this.landingCompanyDetails, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory LandingCompanyDetailsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/landing_company_receive.dart b/lib/basic_api/generated/landing_company_receive.dart index 732078cd11..b5e9f3b94a 100644 --- a/lib/basic_api/generated/landing_company_receive.dart +++ b/lib/basic_api/generated/landing_company_receive.dart @@ -9,16 +9,11 @@ class LandingCompanyReceive extends Response { /// Initialize LandingCompanyReceive. const LandingCompanyReceive({ this.landingCompany, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory LandingCompanyReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/link_wallet_send.dart b/lib/basic_api/generated/link_wallet_send.dart index 295ac456e9..ba3d6b2a38 100644 --- a/lib/basic_api/generated/link_wallet_send.dart +++ b/lib/basic_api/generated/link_wallet_send.dart @@ -10,6 +10,7 @@ class LinkWalletRequest extends Request { const LinkWalletRequest({ required this.clientId, this.linkWallet = true, + this.loginid, required this.walletId, super.msgType = 'link_wallet', super.passthrough, @@ -22,6 +23,7 @@ class LinkWalletRequest extends Request { clientId: json['client_id'] as String?, linkWallet: json['link_wallet'] == null ? null : json['link_wallet'] == 1, + loginid: json['loginid'] as String?, walletId: json['wallet_id'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, @@ -33,6 +35,9 @@ class LinkWalletRequest extends Request { /// Must be `true` final bool? linkWallet; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// The unique identifier for this wallet. final String? walletId; @@ -45,6 +50,7 @@ class LinkWalletRequest extends Request { : linkWallet! ? 1 : 0, + 'loginid': loginid, 'wallet_id': walletId, 'passthrough': passthrough, 'req_id': reqId, @@ -55,6 +61,7 @@ class LinkWalletRequest extends Request { LinkWalletRequest copyWith({ String? clientId, bool? linkWallet, + String? loginid, String? walletId, Map? passthrough, int? reqId, @@ -62,6 +69,7 @@ class LinkWalletRequest extends Request { LinkWalletRequest( clientId: clientId ?? this.clientId, linkWallet: linkWallet ?? this.linkWallet, + loginid: loginid ?? this.loginid, walletId: walletId ?? this.walletId, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/login_history_receive.dart b/lib/basic_api/generated/login_history_receive.dart index 9a389f077e..246c523a8a 100644 --- a/lib/basic_api/generated/login_history_receive.dart +++ b/lib/basic_api/generated/login_history_receive.dart @@ -9,16 +9,11 @@ class LoginHistoryReceive extends Response { /// Initialize LoginHistoryReceive. const LoginHistoryReceive({ this.loginHistory, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory LoginHistoryReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/login_history_send.dart b/lib/basic_api/generated/login_history_send.dart index 4df87cca98..084035004e 100644 --- a/lib/basic_api/generated/login_history_send.dart +++ b/lib/basic_api/generated/login_history_send.dart @@ -10,13 +10,11 @@ class LoginHistoryRequest extends Request { const LoginHistoryRequest({ this.limit, this.loginHistory = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'login_history', - passthrough: passthrough, - reqId: reqId, - ); + this.loginid, + super.msgType = 'login_history', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory LoginHistoryRequest.fromJson(Map json) => @@ -24,6 +22,7 @@ class LoginHistoryRequest extends Request { limit: json['limit'] as int?, loginHistory: json['login_history'] == null ? null : json['login_history'] == 1, + loginid: json['loginid'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -34,6 +33,9 @@ class LoginHistoryRequest extends Request { /// Must be `true` final bool? loginHistory; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Converts this instance to JSON @override Map toJson() => { @@ -43,6 +45,7 @@ class LoginHistoryRequest extends Request { : loginHistory! ? 1 : 0, + 'loginid': loginid, 'passthrough': passthrough, 'req_id': reqId, }; @@ -52,12 +55,14 @@ class LoginHistoryRequest extends Request { LoginHistoryRequest copyWith({ int? limit, bool? loginHistory, + String? loginid, Map? passthrough, int? reqId, }) => LoginHistoryRequest( limit: limit ?? this.limit, loginHistory: loginHistory ?? this.loginHistory, + loginid: loginid ?? this.loginid, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/logout_receive.dart b/lib/basic_api/generated/logout_receive.dart index 319ff8693c..853ef0f2a5 100644 --- a/lib/basic_api/generated/logout_receive.dart +++ b/lib/basic_api/generated/logout_receive.dart @@ -9,16 +9,11 @@ class LogoutReceive extends Response { /// Initialize LogoutReceive. const LogoutReceive({ this.logout, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory LogoutReceive.fromJson(Map json) => LogoutReceive( diff --git a/lib/basic_api/generated/logout_send.dart b/lib/basic_api/generated/logout_send.dart index 4d1f1e6ead..e3779d17b3 100644 --- a/lib/basic_api/generated/logout_send.dart +++ b/lib/basic_api/generated/logout_send.dart @@ -8,28 +8,31 @@ import '../request.dart'; class LogoutRequest extends Request { /// Initialize LogoutRequest. const LogoutRequest({ + this.loginid, this.logout = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'logout', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'logout', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory LogoutRequest.fromJson(Map json) => LogoutRequest( + loginid: json['loginid'] as String?, logout: json['logout'] == null ? null : json['logout'] == 1, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? logout; /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'logout': logout == null ? null : logout! @@ -42,11 +45,13 @@ class LogoutRequest extends Request { /// Creates a copy of instance with given parameters @override LogoutRequest copyWith({ + String? loginid, bool? logout, Map? passthrough, int? reqId, }) => LogoutRequest( + loginid: loginid ?? this.loginid, logout: logout ?? this.logout, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/methods/account_list_receive_methods.json b/lib/basic_api/generated/methods/account_list_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/account_list_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/methods/affiliate_add_company_receive_methods.json b/lib/basic_api/generated/methods/affiliate_add_company_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/affiliate_add_company_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/methods/affiliate_add_person_receive_methods.json b/lib/basic_api/generated/methods/affiliate_add_person_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/affiliate_add_person_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/methods/affiliate_register_person_receive_methods.json b/lib/basic_api/generated/methods/affiliate_register_person_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/affiliate_register_person_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/methods/confirm_email_receive_methods.json b/lib/basic_api/generated/methods/confirm_email_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/confirm_email_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/methods/crypto_estimations_receive_methods.json b/lib/basic_api/generated/methods/crypto_estimations_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/crypto_estimations_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/methods/jtoken_create_receive_methods.json b/lib/basic_api/generated/methods/jtoken_create_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/jtoken_create_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/methods/kyc_auth_status_receive_methods.json b/lib/basic_api/generated/methods/kyc_auth_status_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/kyc_auth_status_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/methods/passkeys_list_receive_methods.json b/lib/basic_api/generated/methods/passkeys_list_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/passkeys_list_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/methods/passkeys_login_receive_methods.json b/lib/basic_api/generated/methods/passkeys_login_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/passkeys_login_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/methods/passkeys_options_receive_methods.json b/lib/basic_api/generated/methods/passkeys_options_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/passkeys_options_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/methods/passkeys_register_options_receive_methods.json b/lib/basic_api/generated/methods/passkeys_register_options_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/passkeys_register_options_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/methods/passkeys_register_receive_methods.json b/lib/basic_api/generated/methods/passkeys_register_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/passkeys_register_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/methods/passkeys_rename_receive_methods.json b/lib/basic_api/generated/methods/passkeys_rename_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/passkeys_rename_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/methods/passkeys_revoke_receive_methods.json b/lib/basic_api/generated/methods/passkeys_revoke_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/passkeys_revoke_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/methods/paymentagent_withdraw_justification_receive_methods.json b/lib/basic_api/generated/methods/paymentagent_withdraw_justification_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/paymentagent_withdraw_justification_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/methods/trading_platform_leverage_receive_methods.json b/lib/basic_api/generated/methods/trading_platform_leverage_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/trading_platform_leverage_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/methods/website_config_receive_methods.json b/lib/basic_api/generated/methods/website_config_receive_methods.json new file mode 100644 index 0000000000..76f788430c --- /dev/null +++ b/lib/basic_api/generated/methods/website_config_receive_methods.json @@ -0,0 +1,4 @@ +{ +"methods": "", +"imports": "import 'package:flutter_deriv_api/helpers/helpers.dart';\n" +} \ No newline at end of file diff --git a/lib/basic_api/generated/mt5_deposit_receive.dart b/lib/basic_api/generated/mt5_deposit_receive.dart index 8a177524bb..a53ba4c04c 100644 --- a/lib/basic_api/generated/mt5_deposit_receive.dart +++ b/lib/basic_api/generated/mt5_deposit_receive.dart @@ -10,16 +10,11 @@ class Mt5DepositReceive extends Response { const Mt5DepositReceive({ this.binaryTransactionId, this.mt5Deposit, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory Mt5DepositReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/mt5_deposit_send.dart b/lib/basic_api/generated/mt5_deposit_send.dart index 3747bf1062..db7777adbb 100644 --- a/lib/basic_api/generated/mt5_deposit_send.dart +++ b/lib/basic_api/generated/mt5_deposit_send.dart @@ -10,21 +10,20 @@ class Mt5DepositRequest extends Request { const Mt5DepositRequest({ required this.amount, required this.fromBinary, + this.loginid, this.mt5Deposit = true, required this.toMt5, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'mt5_deposit', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'mt5_deposit', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory Mt5DepositRequest.fromJson(Map json) => Mt5DepositRequest( amount: json['amount'] as num?, fromBinary: json['from_binary'] as String?, + loginid: json['loginid'] as String?, mt5Deposit: json['mt5_deposit'] == null ? null : json['mt5_deposit'] == 1, toMt5: json['to_mt5'] as String?, @@ -38,6 +37,9 @@ class Mt5DepositRequest extends Request { /// Binary account loginid to transfer money from final String? fromBinary; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? mt5Deposit; @@ -49,6 +51,7 @@ class Mt5DepositRequest extends Request { Map toJson() => { 'amount': amount, 'from_binary': fromBinary, + 'loginid': loginid, 'mt5_deposit': mt5Deposit == null ? null : mt5Deposit! @@ -64,6 +67,7 @@ class Mt5DepositRequest extends Request { Mt5DepositRequest copyWith({ num? amount, String? fromBinary, + String? loginid, bool? mt5Deposit, String? toMt5, Map? passthrough, @@ -72,6 +76,7 @@ class Mt5DepositRequest extends Request { Mt5DepositRequest( amount: amount ?? this.amount, fromBinary: fromBinary ?? this.fromBinary, + loginid: loginid ?? this.loginid, mt5Deposit: mt5Deposit ?? this.mt5Deposit, toMt5: toMt5 ?? this.toMt5, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/mt5_get_settings_receive.dart b/lib/basic_api/generated/mt5_get_settings_receive.dart index ca65b215bf..24f01a63b3 100644 --- a/lib/basic_api/generated/mt5_get_settings_receive.dart +++ b/lib/basic_api/generated/mt5_get_settings_receive.dart @@ -9,16 +9,11 @@ class Mt5GetSettingsReceive extends Response { /// Initialize Mt5GetSettingsReceive. const Mt5GetSettingsReceive({ this.mt5GetSettings, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory Mt5GetSettingsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/mt5_get_settings_send.dart b/lib/basic_api/generated/mt5_get_settings_send.dart index d89639b332..30791d39be 100644 --- a/lib/basic_api/generated/mt5_get_settings_send.dart +++ b/lib/basic_api/generated/mt5_get_settings_send.dart @@ -9,19 +9,18 @@ class Mt5GetSettingsRequest extends Request { /// Initialize Mt5GetSettingsRequest. const Mt5GetSettingsRequest({ required this.login, + this.loginid, this.mt5GetSettings = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'mt5_get_settings', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'mt5_get_settings', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory Mt5GetSettingsRequest.fromJson(Map json) => Mt5GetSettingsRequest( login: json['login'] as String?, + loginid: json['loginid'] as String?, mt5GetSettings: json['mt5_get_settings'] == null ? null : json['mt5_get_settings'] == 1, @@ -32,6 +31,9 @@ class Mt5GetSettingsRequest extends Request { /// MT5 user login final String? login; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? mt5GetSettings; @@ -39,6 +41,7 @@ class Mt5GetSettingsRequest extends Request { @override Map toJson() => { 'login': login, + 'loginid': loginid, 'mt5_get_settings': mt5GetSettings == null ? null : mt5GetSettings! @@ -52,12 +55,14 @@ class Mt5GetSettingsRequest extends Request { @override Mt5GetSettingsRequest copyWith({ String? login, + String? loginid, bool? mt5GetSettings, Map? passthrough, int? reqId, }) => Mt5GetSettingsRequest( login: login ?? this.login, + loginid: loginid ?? this.loginid, mt5GetSettings: mt5GetSettings ?? this.mt5GetSettings, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/mt5_login_list_receive.dart b/lib/basic_api/generated/mt5_login_list_receive.dart index 731d50a84b..5caa195735 100644 --- a/lib/basic_api/generated/mt5_login_list_receive.dart +++ b/lib/basic_api/generated/mt5_login_list_receive.dart @@ -9,16 +9,11 @@ class Mt5LoginListReceive extends Response { /// Initialize Mt5LoginListReceive. const Mt5LoginListReceive({ this.mt5LoginList, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory Mt5LoginListReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/mt5_login_list_send.dart b/lib/basic_api/generated/mt5_login_list_send.dart index d78e597262..53eba62d6c 100644 --- a/lib/basic_api/generated/mt5_login_list_send.dart +++ b/lib/basic_api/generated/mt5_login_list_send.dart @@ -8,30 +8,33 @@ import '../request.dart'; class Mt5LoginListRequest extends Request { /// Initialize Mt5LoginListRequest. const Mt5LoginListRequest({ + this.loginid, this.mt5LoginList = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'mt5_login_list', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'mt5_login_list', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory Mt5LoginListRequest.fromJson(Map json) => Mt5LoginListRequest( + loginid: json['loginid'] as String?, mt5LoginList: json['mt5_login_list'] == null ? null : json['mt5_login_list'] == 1, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? mt5LoginList; /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'mt5_login_list': mt5LoginList == null ? null : mt5LoginList! @@ -44,11 +47,13 @@ class Mt5LoginListRequest extends Request { /// Creates a copy of instance with given parameters @override Mt5LoginListRequest copyWith({ + String? loginid, bool? mt5LoginList, Map? passthrough, int? reqId, }) => Mt5LoginListRequest( + loginid: loginid ?? this.loginid, mt5LoginList: mt5LoginList ?? this.mt5LoginList, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/mt5_new_account_send.dart b/lib/basic_api/generated/mt5_new_account_send.dart index cf50ed0c55..ebd4bbb2ab 100644 --- a/lib/basic_api/generated/mt5_new_account_send.dart +++ b/lib/basic_api/generated/mt5_new_account_send.dart @@ -18,7 +18,9 @@ class Mt5NewAccountRequest extends Request { required this.email, this.investPassword, required this.leverage, + this.loginid, required this.mainPassword, + this.migrate, this.mt5AccountCategory, this.mt5AccountType, this.mt5NewAccount = true, @@ -47,7 +49,9 @@ class Mt5NewAccountRequest extends Request { email: json['email'] as String?, investPassword: json['investPassword'] as String?, leverage: json['leverage'] as num?, + loginid: json['loginid'] as String?, mainPassword: json['mainPassword'] as String?, + migrate: json['migrate'] as dynamic, mt5AccountCategory: json['mt5_account_category'] as String?, mt5AccountType: json['mt5_account_type'] as String?, mt5NewAccount: json['mt5_new_account'] == null @@ -94,9 +98,15 @@ class Mt5NewAccountRequest extends Request { /// Client leverage (from 1 to 1000). final num? leverage; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// The master password of the account. For validation (Accepts any printable ASCII character. Must be within 8-25 characters, and include numbers, lowercase and uppercase letters. Must not be the same as the user's email address). This field is required. final String? mainPassword; + /// [Optional] Indicates whether the user would like to migrate his account to other jurisdiction. + final dynamic migrate; + /// [Optional] To choose whether account is conventional or swap_free. Unavailable for financial_stp MT5_account_type final String? mt5AccountCategory; @@ -144,7 +154,9 @@ class Mt5NewAccountRequest extends Request { 'email': email, 'investPassword': investPassword, 'leverage': leverage, + 'loginid': loginid, 'mainPassword': mainPassword, + 'migrate': migrate, 'mt5_account_category': mt5AccountCategory, 'mt5_account_type': mt5AccountType, 'mt5_new_account': mt5NewAccount == null @@ -176,7 +188,9 @@ class Mt5NewAccountRequest extends Request { String? email, String? investPassword, num? leverage, + String? loginid, String? mainPassword, + dynamic migrate, String? mt5AccountCategory, String? mt5AccountType, bool? mt5NewAccount, @@ -201,7 +215,9 @@ class Mt5NewAccountRequest extends Request { email: email ?? this.email, investPassword: investPassword ?? this.investPassword, leverage: leverage ?? this.leverage, + loginid: loginid ?? this.loginid, mainPassword: mainPassword ?? this.mainPassword, + migrate: migrate ?? this.migrate, mt5AccountCategory: mt5AccountCategory ?? this.mt5AccountCategory, mt5AccountType: mt5AccountType ?? this.mt5AccountType, mt5NewAccount: mt5NewAccount ?? this.mt5NewAccount, diff --git a/lib/basic_api/generated/mt5_password_change_send.dart b/lib/basic_api/generated/mt5_password_change_send.dart index d7021506db..3759b8f952 100644 --- a/lib/basic_api/generated/mt5_password_change_send.dart +++ b/lib/basic_api/generated/mt5_password_change_send.dart @@ -9,22 +9,21 @@ class Mt5PasswordChangeRequest extends Request { /// Initialize Mt5PasswordChangeRequest. const Mt5PasswordChangeRequest({ required this.login, + this.loginid, this.mt5PasswordChange = true, required this.newPassword, required this.oldPassword, this.passwordType, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'mt5_password_change', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'mt5_password_change', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory Mt5PasswordChangeRequest.fromJson(Map json) => Mt5PasswordChangeRequest( login: json['login'] as String?, + loginid: json['loginid'] as String?, mt5PasswordChange: json['mt5_password_change'] == null ? null : json['mt5_password_change'] == 1, @@ -38,6 +37,9 @@ class Mt5PasswordChangeRequest extends Request { /// MT5 user login final String? login; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? mt5PasswordChange; @@ -54,6 +56,7 @@ class Mt5PasswordChangeRequest extends Request { @override Map toJson() => { 'login': login, + 'loginid': loginid, 'mt5_password_change': mt5PasswordChange == null ? null : mt5PasswordChange! @@ -70,6 +73,7 @@ class Mt5PasswordChangeRequest extends Request { @override Mt5PasswordChangeRequest copyWith({ String? login, + String? loginid, bool? mt5PasswordChange, String? newPassword, String? oldPassword, @@ -79,6 +83,7 @@ class Mt5PasswordChangeRequest extends Request { }) => Mt5PasswordChangeRequest( login: login ?? this.login, + loginid: loginid ?? this.loginid, mt5PasswordChange: mt5PasswordChange ?? this.mt5PasswordChange, newPassword: newPassword ?? this.newPassword, oldPassword: oldPassword ?? this.oldPassword, diff --git a/lib/basic_api/generated/mt5_password_check_receive.dart b/lib/basic_api/generated/mt5_password_check_receive.dart index 1897a47bcb..5b3ca36aea 100644 --- a/lib/basic_api/generated/mt5_password_check_receive.dart +++ b/lib/basic_api/generated/mt5_password_check_receive.dart @@ -9,16 +9,11 @@ class Mt5PasswordCheckReceive extends Response { /// Initialize Mt5PasswordCheckReceive. const Mt5PasswordCheckReceive({ this.mt5PasswordCheck, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory Mt5PasswordCheckReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/mt5_password_check_send.dart b/lib/basic_api/generated/mt5_password_check_send.dart index 732512520c..17a17d61bc 100644 --- a/lib/basic_api/generated/mt5_password_check_send.dart +++ b/lib/basic_api/generated/mt5_password_check_send.dart @@ -9,21 +9,20 @@ class Mt5PasswordCheckRequest extends Request { /// Initialize Mt5PasswordCheckRequest. const Mt5PasswordCheckRequest({ required this.login, + this.loginid, this.mt5PasswordCheck = true, required this.password, this.passwordType, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'mt5_password_check', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'mt5_password_check', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory Mt5PasswordCheckRequest.fromJson(Map json) => Mt5PasswordCheckRequest( login: json['login'] as String?, + loginid: json['loginid'] as String?, mt5PasswordCheck: json['mt5_password_check'] == null ? null : json['mt5_password_check'] == 1, @@ -36,6 +35,9 @@ class Mt5PasswordCheckRequest extends Request { /// MT5 user login final String? login; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? mt5PasswordCheck; @@ -49,6 +51,7 @@ class Mt5PasswordCheckRequest extends Request { @override Map toJson() => { 'login': login, + 'loginid': loginid, 'mt5_password_check': mt5PasswordCheck == null ? null : mt5PasswordCheck! @@ -64,6 +67,7 @@ class Mt5PasswordCheckRequest extends Request { @override Mt5PasswordCheckRequest copyWith({ String? login, + String? loginid, bool? mt5PasswordCheck, String? password, String? passwordType, @@ -72,6 +76,7 @@ class Mt5PasswordCheckRequest extends Request { }) => Mt5PasswordCheckRequest( login: login ?? this.login, + loginid: loginid ?? this.loginid, mt5PasswordCheck: mt5PasswordCheck ?? this.mt5PasswordCheck, password: password ?? this.password, passwordType: passwordType ?? this.passwordType, diff --git a/lib/basic_api/generated/mt5_password_reset_receive.dart b/lib/basic_api/generated/mt5_password_reset_receive.dart index 215d64f667..ebcc5f2069 100644 --- a/lib/basic_api/generated/mt5_password_reset_receive.dart +++ b/lib/basic_api/generated/mt5_password_reset_receive.dart @@ -9,16 +9,11 @@ class Mt5PasswordResetReceive extends Response { /// Initialize Mt5PasswordResetReceive. const Mt5PasswordResetReceive({ this.mt5PasswordReset, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory Mt5PasswordResetReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/mt5_password_reset_send.dart b/lib/basic_api/generated/mt5_password_reset_send.dart index bfbbe1b0dc..6de8b3bed0 100644 --- a/lib/basic_api/generated/mt5_password_reset_send.dart +++ b/lib/basic_api/generated/mt5_password_reset_send.dart @@ -9,22 +9,21 @@ class Mt5PasswordResetRequest extends Request { /// Initialize Mt5PasswordResetRequest. const Mt5PasswordResetRequest({ required this.login, + this.loginid, this.mt5PasswordReset = true, required this.newPassword, this.passwordType, required this.verificationCode, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'mt5_password_reset', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'mt5_password_reset', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory Mt5PasswordResetRequest.fromJson(Map json) => Mt5PasswordResetRequest( login: json['login'] as String?, + loginid: json['loginid'] as String?, mt5PasswordReset: json['mt5_password_reset'] == null ? null : json['mt5_password_reset'] == 1, @@ -38,6 +37,9 @@ class Mt5PasswordResetRequest extends Request { /// MT5 user login final String? login; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? mt5PasswordReset; @@ -54,6 +56,7 @@ class Mt5PasswordResetRequest extends Request { @override Map toJson() => { 'login': login, + 'loginid': loginid, 'mt5_password_reset': mt5PasswordReset == null ? null : mt5PasswordReset! @@ -70,6 +73,7 @@ class Mt5PasswordResetRequest extends Request { @override Mt5PasswordResetRequest copyWith({ String? login, + String? loginid, bool? mt5PasswordReset, String? newPassword, String? passwordType, @@ -79,6 +83,7 @@ class Mt5PasswordResetRequest extends Request { }) => Mt5PasswordResetRequest( login: login ?? this.login, + loginid: loginid ?? this.loginid, mt5PasswordReset: mt5PasswordReset ?? this.mt5PasswordReset, newPassword: newPassword ?? this.newPassword, passwordType: passwordType ?? this.passwordType, diff --git a/lib/basic_api/generated/mt5_withdrawal_receive.dart b/lib/basic_api/generated/mt5_withdrawal_receive.dart index b9cea78875..7c9cb946cc 100644 --- a/lib/basic_api/generated/mt5_withdrawal_receive.dart +++ b/lib/basic_api/generated/mt5_withdrawal_receive.dart @@ -10,16 +10,11 @@ class Mt5WithdrawalReceive extends Response { const Mt5WithdrawalReceive({ this.binaryTransactionId, this.mt5Withdrawal, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory Mt5WithdrawalReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/mt5_withdrawal_send.dart b/lib/basic_api/generated/mt5_withdrawal_send.dart index 33cfe8c5d8..8ddc10663d 100644 --- a/lib/basic_api/generated/mt5_withdrawal_send.dart +++ b/lib/basic_api/generated/mt5_withdrawal_send.dart @@ -10,21 +10,20 @@ class Mt5WithdrawalRequest extends Request { const Mt5WithdrawalRequest({ required this.amount, required this.fromMt5, + this.loginid, this.mt5Withdrawal = true, required this.toBinary, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'mt5_withdrawal', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'mt5_withdrawal', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory Mt5WithdrawalRequest.fromJson(Map json) => Mt5WithdrawalRequest( amount: json['amount'] as num?, fromMt5: json['from_mt5'] as String?, + loginid: json['loginid'] as String?, mt5Withdrawal: json['mt5_withdrawal'] == null ? null : json['mt5_withdrawal'] == 1, toBinary: json['to_binary'] as String?, @@ -38,6 +37,9 @@ class Mt5WithdrawalRequest extends Request { /// MT5 account login to withdraw money from final String? fromMt5; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? mt5Withdrawal; @@ -49,6 +51,7 @@ class Mt5WithdrawalRequest extends Request { Map toJson() => { 'amount': amount, 'from_mt5': fromMt5, + 'loginid': loginid, 'mt5_withdrawal': mt5Withdrawal == null ? null : mt5Withdrawal! @@ -64,6 +67,7 @@ class Mt5WithdrawalRequest extends Request { Mt5WithdrawalRequest copyWith({ num? amount, String? fromMt5, + String? loginid, bool? mt5Withdrawal, String? toBinary, Map? passthrough, @@ -72,6 +76,7 @@ class Mt5WithdrawalRequest extends Request { Mt5WithdrawalRequest( amount: amount ?? this.amount, fromMt5: fromMt5 ?? this.fromMt5, + loginid: loginid ?? this.loginid, mt5Withdrawal: mt5Withdrawal ?? this.mt5Withdrawal, toBinary: toBinary ?? this.toBinary, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/new_account_maltainvest_receive.dart b/lib/basic_api/generated/new_account_maltainvest_receive.dart index a83e3546b9..4fbe1f8298 100644 --- a/lib/basic_api/generated/new_account_maltainvest_receive.dart +++ b/lib/basic_api/generated/new_account_maltainvest_receive.dart @@ -9,16 +9,11 @@ class NewAccountMaltainvestReceive extends Response { /// Initialize NewAccountMaltainvestReceive. const NewAccountMaltainvestReceive({ this.newAccountMaltainvest, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory NewAccountMaltainvestReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/new_account_maltainvest_send.dart b/lib/basic_api/generated/new_account_maltainvest_send.dart index 5a3d3b65da..08ac269729 100644 --- a/lib/basic_api/generated/new_account_maltainvest_send.dart +++ b/lib/basic_api/generated/new_account_maltainvest_send.dart @@ -33,6 +33,7 @@ class NewAccountMaltainvestRequest extends Request { required this.lastName, required this.leverageImpactTrading, required this.leverageTradingHighRiskStopLoss, + this.loginid, required this.netIncome, this.newAccountMaltainvest = true, this.nonPepDeclaration, @@ -86,6 +87,7 @@ class NewAccountMaltainvestRequest extends Request { leverageImpactTrading: json['leverage_impact_trading'] as String?, leverageTradingHighRiskStopLoss: json['leverage_trading_high_risk_stop_loss'] as String?, + loginid: json['loginid'] as String?, netIncome: json['net_income'] as String?, newAccountMaltainvest: json['new_account_maltainvest'] == null ? null @@ -187,6 +189,9 @@ class NewAccountMaltainvestRequest extends Request { /// Leverage trading is high-risk, so it's a good idea to use risk management features such as stop loss. Stop loss allows you to final String? leverageTradingHighRiskStopLoss; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Net Annual Income. final String? netIncome; @@ -273,6 +278,7 @@ class NewAccountMaltainvestRequest extends Request { 'last_name': lastName, 'leverage_impact_trading': leverageImpactTrading, 'leverage_trading_high_risk_stop_loss': leverageTradingHighRiskStopLoss, + 'loginid': loginid, 'net_income': netIncome, 'new_account_maltainvest': newAccountMaltainvest == null ? null @@ -329,6 +335,7 @@ class NewAccountMaltainvestRequest extends Request { String? lastName, String? leverageImpactTrading, String? leverageTradingHighRiskStopLoss, + String? loginid, String? netIncome, bool? newAccountMaltainvest, int? nonPepDeclaration, @@ -378,6 +385,7 @@ class NewAccountMaltainvestRequest extends Request { leverageImpactTrading ?? this.leverageImpactTrading, leverageTradingHighRiskStopLoss: leverageTradingHighRiskStopLoss ?? this.leverageTradingHighRiskStopLoss, + loginid: loginid ?? this.loginid, netIncome: netIncome ?? this.netIncome, newAccountMaltainvest: newAccountMaltainvest ?? this.newAccountMaltainvest, diff --git a/lib/basic_api/generated/new_account_real_send.dart b/lib/basic_api/generated/new_account_real_send.dart index 80dd7ac8f6..a88a2759b1 100644 --- a/lib/basic_api/generated/new_account_real_send.dart +++ b/lib/basic_api/generated/new_account_real_send.dart @@ -11,7 +11,7 @@ class NewAccountRealRequest extends Request { this.accountOpeningReason, this.accountTurnover, this.addressCity, - this.addressLine1, + required this.addressLine1, this.addressLine2, this.addressPostcode, this.addressState, @@ -19,14 +19,15 @@ class NewAccountRealRequest extends Request { this.citizen, this.clientType, this.currency, - this.dateOfBirth, - this.firstName, - this.lastName, + required this.dateOfBirth, + required this.firstName, + required this.lastName, + this.loginid, this.newAccountReal = true, this.nonPepDeclaration, this.phone, this.placeOfBirth, - this.residence, + required this.residence, this.salutation, this.secretAnswer, this.secretQuestion, @@ -54,6 +55,7 @@ class NewAccountRealRequest extends Request { dateOfBirth: json['date_of_birth'] as String?, firstName: json['first_name'] as String?, lastName: json['last_name'] as String?, + loginid: json['loginid'] as String?, newAccountReal: json['new_account_real'] == null ? null : json['new_account_real'] == 1, @@ -112,6 +114,9 @@ class NewAccountRealRequest extends Request { /// Within 2-50 characters, use only letters, spaces, hyphens, full-stops or apostrophes. final String? lastName; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? newAccountReal; @@ -159,6 +164,7 @@ class NewAccountRealRequest extends Request { 'date_of_birth': dateOfBirth, 'first_name': firstName, 'last_name': lastName, + 'loginid': loginid, 'new_account_real': newAccountReal == null ? null : newAccountReal! @@ -194,6 +200,7 @@ class NewAccountRealRequest extends Request { String? dateOfBirth, String? firstName, String? lastName, + String? loginid, bool? newAccountReal, int? nonPepDeclaration, String? phone, @@ -222,6 +229,7 @@ class NewAccountRealRequest extends Request { dateOfBirth: dateOfBirth ?? this.dateOfBirth, firstName: firstName ?? this.firstName, lastName: lastName ?? this.lastName, + loginid: loginid ?? this.loginid, newAccountReal: newAccountReal ?? this.newAccountReal, nonPepDeclaration: nonPepDeclaration ?? this.nonPepDeclaration, phone: phone ?? this.phone, diff --git a/lib/basic_api/generated/new_account_virtual_send.dart b/lib/basic_api/generated/new_account_virtual_send.dart index 3a54d5c1bb..90a4e33e28 100644 --- a/lib/basic_api/generated/new_account_virtual_send.dart +++ b/lib/basic_api/generated/new_account_virtual_send.dart @@ -11,8 +11,10 @@ class NewAccountVirtualRequest extends Request { this.affiliateToken, required this.clientPassword, this.dateFirstContact, + this.email, this.emailConsent, this.gclidUrl, + this.loginid, this.newAccountVirtual = true, required this.residence, this.signupDevice, @@ -41,9 +43,11 @@ class NewAccountVirtualRequest extends Request { affiliateToken: json['affiliate_token'] as String?, clientPassword: json['client_password'] as String?, dateFirstContact: json['date_first_contact'] as String?, + email: json['email'] as String?, emailConsent: json['email_consent'] == null ? null : json['email_consent'] == 1, gclidUrl: json['gclid_url'] as String?, + loginid: json['loginid'] as String?, newAccountVirtual: json['new_account_virtual'] == null ? null : json['new_account_virtual'] == 1, @@ -76,12 +80,18 @@ class NewAccountVirtualRequest extends Request { /// [Optional] Date of first contact, format: `yyyy-mm-dd` in GMT timezone. final String? dateFirstContact; + /// [Optional] Email address for signup. + final String? email; + /// [Optional] Boolean value: `true` or `false`, indicating whether the client has given consent for marketing emails. final bool? emailConsent; /// [Optional] Google Click Identifier to track source. final String? gclidUrl; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? newAccountVirtual; @@ -139,12 +149,14 @@ class NewAccountVirtualRequest extends Request { 'affiliate_token': affiliateToken, 'client_password': clientPassword, 'date_first_contact': dateFirstContact, + 'email': email, 'email_consent': emailConsent == null ? null : emailConsent! ? 1 : 0, 'gclid_url': gclidUrl, + 'loginid': loginid, 'new_account_virtual': newAccountVirtual == null ? null : newAccountVirtual! @@ -176,8 +188,10 @@ class NewAccountVirtualRequest extends Request { String? affiliateToken, String? clientPassword, String? dateFirstContact, + String? email, bool? emailConsent, String? gclidUrl, + String? loginid, bool? newAccountVirtual, String? residence, String? signupDevice, @@ -202,8 +216,10 @@ class NewAccountVirtualRequest extends Request { affiliateToken: affiliateToken ?? this.affiliateToken, clientPassword: clientPassword ?? this.clientPassword, dateFirstContact: dateFirstContact ?? this.dateFirstContact, + email: email ?? this.email, emailConsent: emailConsent ?? this.emailConsent, gclidUrl: gclidUrl ?? this.gclidUrl, + loginid: loginid ?? this.loginid, newAccountVirtual: newAccountVirtual ?? this.newAccountVirtual, residence: residence ?? this.residence, signupDevice: signupDevice ?? this.signupDevice, diff --git a/lib/basic_api/generated/new_account_wallet_send.dart b/lib/basic_api/generated/new_account_wallet_send.dart index d252ab36cb..bcb411aa17 100644 --- a/lib/basic_api/generated/new_account_wallet_send.dart +++ b/lib/basic_api/generated/new_account_wallet_send.dart @@ -8,7 +8,7 @@ import '../request.dart'; class NewAccountWalletRequest extends Request { /// Initialize NewAccountWalletRequest. const NewAccountWalletRequest({ - this.acceptRisk, + required this.acceptRisk, this.accountOpeningReason, required this.accountType, this.addressCity, @@ -20,16 +20,17 @@ class NewAccountWalletRequest extends Request { this.clientType, required this.currency, this.dateOfBirth, - this.financialAssessment, + required this.financialAssessment, this.firstName, this.landingCompanyShort, this.lastName, + this.loginid, this.newAccountWallet = true, this.nonPepDeclaration, this.phone, - this.salutation, - this.taxIdentificationNumber, - this.taxResidence, + required this.salutation, + required this.taxIdentificationNumber, + required this.taxResidence, super.msgType = 'new_account_wallet', super.passthrough, super.reqId, @@ -56,6 +57,7 @@ class NewAccountWalletRequest extends Request { firstName: json['first_name'] as String?, landingCompanyShort: json['landing_company_short'] as String?, lastName: json['last_name'] as String?, + loginid: json['loginid'] as String?, newAccountWallet: json['new_account_wallet'] == null ? null : json['new_account_wallet'] == 1, @@ -116,6 +118,9 @@ class NewAccountWalletRequest extends Request { /// [Optional] Within 2-50 characters, use only letters, spaces, hyphens, full-stops or apostrophes. final String? lastName; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? newAccountWallet; @@ -157,6 +162,7 @@ class NewAccountWalletRequest extends Request { 'first_name': firstName, 'landing_company_short': landingCompanyShort, 'last_name': lastName, + 'loginid': loginid, 'new_account_wallet': newAccountWallet == null ? null : newAccountWallet! @@ -190,6 +196,7 @@ class NewAccountWalletRequest extends Request { String? firstName, String? landingCompanyShort, String? lastName, + String? loginid, bool? newAccountWallet, int? nonPepDeclaration, String? phone, @@ -216,6 +223,7 @@ class NewAccountWalletRequest extends Request { firstName: firstName ?? this.firstName, landingCompanyShort: landingCompanyShort ?? this.landingCompanyShort, lastName: lastName ?? this.lastName, + loginid: loginid ?? this.loginid, newAccountWallet: newAccountWallet ?? this.newAccountWallet, nonPepDeclaration: nonPepDeclaration ?? this.nonPepDeclaration, phone: phone ?? this.phone, diff --git a/lib/basic_api/generated/notification_event_receive.dart b/lib/basic_api/generated/notification_event_receive.dart index 2116b23262..7d23034a0c 100644 --- a/lib/basic_api/generated/notification_event_receive.dart +++ b/lib/basic_api/generated/notification_event_receive.dart @@ -9,16 +9,11 @@ class NotificationEventReceive extends Response { /// Initialize NotificationEventReceive. const NotificationEventReceive({ this.notificationEvent, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory NotificationEventReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/notification_event_send.dart b/lib/basic_api/generated/notification_event_send.dart index 34c0b3f1bf..c5b8acd4a3 100644 --- a/lib/basic_api/generated/notification_event_send.dart +++ b/lib/basic_api/generated/notification_event_send.dart @@ -11,14 +11,12 @@ class NotificationEventRequest extends Request { required this.args, required this.category, required this.event, + this.loginid, this.notificationEvent = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'notification_event', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'notification_event', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory NotificationEventRequest.fromJson(Map json) => @@ -26,6 +24,7 @@ class NotificationEventRequest extends Request { args: json['args'] as Map?, category: json['category'] as String?, event: json['event'] as String?, + loginid: json['loginid'] as String?, notificationEvent: json['notification_event'] == null ? null : json['notification_event'] == 1, @@ -42,6 +41,9 @@ class NotificationEventRequest extends Request { /// The name of the event. final String? event; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? notificationEvent; @@ -51,6 +53,7 @@ class NotificationEventRequest extends Request { 'args': args, 'category': category, 'event': event, + 'loginid': loginid, 'notification_event': notificationEvent == null ? null : notificationEvent! @@ -66,6 +69,7 @@ class NotificationEventRequest extends Request { Map? args, String? category, String? event, + String? loginid, bool? notificationEvent, Map? passthrough, int? reqId, @@ -74,6 +78,7 @@ class NotificationEventRequest extends Request { args: args ?? this.args, category: category ?? this.category, event: event ?? this.event, + loginid: loginid ?? this.loginid, notificationEvent: notificationEvent ?? this.notificationEvent, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/oauth_apps_receive.dart b/lib/basic_api/generated/oauth_apps_receive.dart index b67a1caa0e..7afd710f34 100644 --- a/lib/basic_api/generated/oauth_apps_receive.dart +++ b/lib/basic_api/generated/oauth_apps_receive.dart @@ -9,16 +9,11 @@ class OauthAppsReceive extends Response { /// Initialize OauthAppsReceive. const OauthAppsReceive({ this.oauthApps, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory OauthAppsReceive.fromJson(Map json) => @@ -33,7 +28,7 @@ class OauthAppsReceive extends Response { reqId: json['req_id'] as int?, ); - /// List of OAuth applications that used for the authorized account. + /// List of 3rd party OAuth applications that used for the authorized account. final List>? oauthApps; /// Converts this instance to JSON diff --git a/lib/basic_api/generated/oauth_apps_send.dart b/lib/basic_api/generated/oauth_apps_send.dart index 29b629a420..71fb3bc7c7 100644 --- a/lib/basic_api/generated/oauth_apps_send.dart +++ b/lib/basic_api/generated/oauth_apps_send.dart @@ -8,29 +8,32 @@ import '../request.dart'; class OauthAppsRequest extends Request { /// Initialize OauthAppsRequest. const OauthAppsRequest({ + this.loginid, this.oauthApps = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'oauth_apps', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'oauth_apps', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory OauthAppsRequest.fromJson(Map json) => OauthAppsRequest( + loginid: json['loginid'] as String?, oauthApps: json['oauth_apps'] == null ? null : json['oauth_apps'] == 1, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? oauthApps; /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'oauth_apps': oauthApps == null ? null : oauthApps! @@ -43,11 +46,13 @@ class OauthAppsRequest extends Request { /// Creates a copy of instance with given parameters @override OauthAppsRequest copyWith({ + String? loginid, bool? oauthApps, Map? passthrough, int? reqId, }) => OauthAppsRequest( + loginid: loginid ?? this.loginid, oauthApps: oauthApps ?? this.oauthApps, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/p2p_advert_create_receive.dart b/lib/basic_api/generated/p2p_advert_create_receive.dart index 74911dd041..4e4a48fb63 100644 --- a/lib/basic_api/generated/p2p_advert_create_receive.dart +++ b/lib/basic_api/generated/p2p_advert_create_receive.dart @@ -9,16 +9,11 @@ class P2pAdvertCreateReceive extends Response { /// Initialize P2pAdvertCreateReceive. const P2pAdvertCreateReceive({ this.p2pAdvertCreate, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertCreateReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/p2p_advert_create_send.dart b/lib/basic_api/generated/p2p_advert_create_send.dart index e3a405655c..b9d07117c4 100644 --- a/lib/basic_api/generated/p2p_advert_create_send.dart +++ b/lib/basic_api/generated/p2p_advert_create_send.dart @@ -12,9 +12,14 @@ class P2pAdvertCreateRequest extends Request { this.blockTrade, this.contactInfo, this.description, + this.eligibleCountries, this.localCurrency, + this.loginid, required this.maxOrderAmount, + this.minCompletionRate, + this.minJoinDays, required this.minOrderAmount, + this.minRating, this.orderExpiryPeriod, this.p2pAdvertCreate = true, this.paymentInfo, @@ -37,9 +42,16 @@ class P2pAdvertCreateRequest extends Request { json['block_trade'] == null ? null : json['block_trade'] == 1, contactInfo: json['contact_info'] as String?, description: json['description'] as String?, + eligibleCountries: (json['eligible_countries'] as List?) + ?.map((dynamic item) => item as String) + .toList(), localCurrency: json['local_currency'] as String?, + loginid: json['loginid'] as String?, maxOrderAmount: json['max_order_amount'] as num?, + minCompletionRate: json['min_completion_rate'] as num?, + minJoinDays: json['min_join_days'] as int?, minOrderAmount: json['min_order_amount'] as num?, + minRating: json['min_rating'] as num?, orderExpiryPeriod: json['order_expiry_period'] as int?, p2pAdvertCreate: json['p2p_advert_create'] == null ? null @@ -71,15 +83,30 @@ class P2pAdvertCreateRequest extends Request { /// [Optional] General information about the advert. final String? description; + /// [Optional] 2 letter country codes. Counterparties who do not live in these countries will not be allowed to place orders against the advert. + final List? eligibleCountries; + /// [Optional] Local currency for this advert. If not provided, will use the currency of client's residence by default. final String? localCurrency; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Maximum allowed amount for the orders of this advert, in advertiser's `account_currency`. Should be more than or equal to `min_order_amount` final num? maxOrderAmount; + /// [Optional] Counterparties who have a 30 day completion rate less than this value will not be allowed to place orders against the advert. + final num? minCompletionRate; + + /// [Optional] Counterparties who joined less than this number of days ago will not be allowed to place orders against the advert. + final int? minJoinDays; + /// Minimum allowed amount for the orders of this advert, in advertiser's `account_currency`. Should be less than or equal to `max_order_amount`. final num? minOrderAmount; + /// [Optional] Counterparties who have an average rating less than this value will not be allowed to place orders against the advert. + final num? minRating; + /// [Optional] Expiry period (seconds) for order created against this ad. final int? orderExpiryPeriod; @@ -118,9 +145,14 @@ class P2pAdvertCreateRequest extends Request { : 0, 'contact_info': contactInfo, 'description': description, + 'eligible_countries': eligibleCountries, 'local_currency': localCurrency, + 'loginid': loginid, 'max_order_amount': maxOrderAmount, + 'min_completion_rate': minCompletionRate, + 'min_join_days': minJoinDays, 'min_order_amount': minOrderAmount, + 'min_rating': minRating, 'order_expiry_period': orderExpiryPeriod, 'p2p_advert_create': p2pAdvertCreate == null ? null @@ -145,9 +177,14 @@ class P2pAdvertCreateRequest extends Request { bool? blockTrade, String? contactInfo, String? description, + List? eligibleCountries, String? localCurrency, + String? loginid, num? maxOrderAmount, + num? minCompletionRate, + int? minJoinDays, num? minOrderAmount, + num? minRating, int? orderExpiryPeriod, bool? p2pAdvertCreate, String? paymentInfo, @@ -165,9 +202,14 @@ class P2pAdvertCreateRequest extends Request { blockTrade: blockTrade ?? this.blockTrade, contactInfo: contactInfo ?? this.contactInfo, description: description ?? this.description, + eligibleCountries: eligibleCountries ?? this.eligibleCountries, localCurrency: localCurrency ?? this.localCurrency, + loginid: loginid ?? this.loginid, maxOrderAmount: maxOrderAmount ?? this.maxOrderAmount, + minCompletionRate: minCompletionRate ?? this.minCompletionRate, + minJoinDays: minJoinDays ?? this.minJoinDays, minOrderAmount: minOrderAmount ?? this.minOrderAmount, + minRating: minRating ?? this.minRating, orderExpiryPeriod: orderExpiryPeriod ?? this.orderExpiryPeriod, p2pAdvertCreate: p2pAdvertCreate ?? this.p2pAdvertCreate, paymentInfo: paymentInfo ?? this.paymentInfo, diff --git a/lib/basic_api/generated/p2p_advert_info_receive.dart b/lib/basic_api/generated/p2p_advert_info_receive.dart index 6ed8cd821c..b761000440 100644 --- a/lib/basic_api/generated/p2p_advert_info_receive.dart +++ b/lib/basic_api/generated/p2p_advert_info_receive.dart @@ -10,16 +10,11 @@ class P2pAdvertInfoReceive extends Response { const P2pAdvertInfoReceive({ this.p2pAdvertInfo, this.subscription, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertInfoReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/p2p_advert_info_send.dart b/lib/basic_api/generated/p2p_advert_info_send.dart index c588219e6b..5d57364740 100644 --- a/lib/basic_api/generated/p2p_advert_info_send.dart +++ b/lib/basic_api/generated/p2p_advert_info_send.dart @@ -9,21 +9,20 @@ class P2pAdvertInfoRequest extends Request { /// Initialize P2pAdvertInfoRequest. const P2pAdvertInfoRequest({ this.id, + this.loginid, this.p2pAdvertInfo = true, this.subscribe, this.useClientLimits, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_advert_info', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_advert_info', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertInfoRequest.fromJson(Map json) => P2pAdvertInfoRequest( id: json['id'] as String?, + loginid: json['loginid'] as String?, p2pAdvertInfo: json['p2p_advert_info'] == null ? null : json['p2p_advert_info'] == 1, @@ -38,6 +37,9 @@ class P2pAdvertInfoRequest extends Request { /// [Optional] The unique identifier for this advert. Optional when subscribe is 1. If not provided, all advertiser adverts will be subscribed. final String? id; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? p2pAdvertInfo; @@ -51,6 +53,7 @@ class P2pAdvertInfoRequest extends Request { @override Map toJson() => { 'id': id, + 'loginid': loginid, 'p2p_advert_info': p2pAdvertInfo == null ? null : p2pAdvertInfo! @@ -74,6 +77,7 @@ class P2pAdvertInfoRequest extends Request { @override P2pAdvertInfoRequest copyWith({ String? id, + String? loginid, bool? p2pAdvertInfo, bool? subscribe, bool? useClientLimits, @@ -82,6 +86,7 @@ class P2pAdvertInfoRequest extends Request { }) => P2pAdvertInfoRequest( id: id ?? this.id, + loginid: loginid ?? this.loginid, p2pAdvertInfo: p2pAdvertInfo ?? this.p2pAdvertInfo, subscribe: subscribe ?? this.subscribe, useClientLimits: useClientLimits ?? this.useClientLimits, diff --git a/lib/basic_api/generated/p2p_advert_list_receive.dart b/lib/basic_api/generated/p2p_advert_list_receive.dart index 89107cb62a..64983095df 100644 --- a/lib/basic_api/generated/p2p_advert_list_receive.dart +++ b/lib/basic_api/generated/p2p_advert_list_receive.dart @@ -9,16 +9,11 @@ class P2pAdvertListReceive extends Response { /// Initialize P2pAdvertListReceive. const P2pAdvertListReceive({ this.p2pAdvertList, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertListReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/p2p_advert_list_send.dart b/lib/basic_api/generated/p2p_advert_list_send.dart index cf32a84084..816164a119 100644 --- a/lib/basic_api/generated/p2p_advert_list_send.dart +++ b/lib/basic_api/generated/p2p_advert_list_send.dart @@ -11,22 +11,22 @@ class P2pAdvertListRequest extends Request { this.advertiserId, this.advertiserName, this.amount, + this.blockTrade, this.counterpartyType, this.favouritesOnly, + this.hideIneligible, this.limit, this.localCurrency, + this.loginid, this.offset, this.p2pAdvertList = true, this.paymentMethod, this.sortBy, this.useClientLimits, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_advert_list', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_advert_list', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertListRequest.fromJson(Map json) => @@ -34,12 +34,18 @@ class P2pAdvertListRequest extends Request { advertiserId: json['advertiser_id'] as String?, advertiserName: json['advertiser_name'] as String?, amount: json['amount'] as num?, + blockTrade: + json['block_trade'] == null ? null : json['block_trade'] == 1, counterpartyType: json['counterparty_type'] as String?, favouritesOnly: json['favourites_only'] == null ? null : json['favourites_only'] == 1, + hideIneligible: json['hide_ineligible'] == null + ? null + : json['hide_ineligible'] == 1, limit: json['limit'] as int?, localCurrency: json['local_currency'] as String?, + loginid: json['loginid'] as String?, offset: json['offset'] as int?, p2pAdvertList: json['p2p_advert_list'] == null ? null @@ -64,18 +70,27 @@ class P2pAdvertListRequest extends Request { /// [Optional] How much to buy or sell, used to calculate prices. final num? amount; + /// [Optional] Return block trade adverts when `true`, non-block trade adverts when `false` (default). + final bool? blockTrade; + /// [Optional] Filter the adverts by `counterparty_type`. final String? counterpartyType; /// [Optional] Only show adverts from favourite advertisers. Default is `false`. final bool? favouritesOnly; + /// [Optional] If set to `true`, adverts for which the current user does not meet counteryparty terms are not returned. + final bool? hideIneligible; + /// [Optional] Used for paging. final int? limit; /// [Optional] Currency to conduct payment transaction in. If not provided, only ads from country of residence will be returned. final String? localCurrency; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] Used for paging. final int? offset; @@ -97,14 +112,25 @@ class P2pAdvertListRequest extends Request { 'advertiser_id': advertiserId, 'advertiser_name': advertiserName, 'amount': amount, + 'block_trade': blockTrade == null + ? null + : blockTrade! + ? 1 + : 0, 'counterparty_type': counterpartyType, 'favourites_only': favouritesOnly == null ? null : favouritesOnly! ? 1 : 0, + 'hide_ineligible': hideIneligible == null + ? null + : hideIneligible! + ? 1 + : 0, 'limit': limit, 'local_currency': localCurrency, + 'loginid': loginid, 'offset': offset, 'p2p_advert_list': p2pAdvertList == null ? null @@ -128,10 +154,13 @@ class P2pAdvertListRequest extends Request { String? advertiserId, String? advertiserName, num? amount, + bool? blockTrade, String? counterpartyType, bool? favouritesOnly, + bool? hideIneligible, int? limit, String? localCurrency, + String? loginid, int? offset, bool? p2pAdvertList, List? paymentMethod, @@ -144,10 +173,13 @@ class P2pAdvertListRequest extends Request { advertiserId: advertiserId ?? this.advertiserId, advertiserName: advertiserName ?? this.advertiserName, amount: amount ?? this.amount, + blockTrade: blockTrade ?? this.blockTrade, counterpartyType: counterpartyType ?? this.counterpartyType, favouritesOnly: favouritesOnly ?? this.favouritesOnly, + hideIneligible: hideIneligible ?? this.hideIneligible, limit: limit ?? this.limit, localCurrency: localCurrency ?? this.localCurrency, + loginid: loginid ?? this.loginid, offset: offset ?? this.offset, p2pAdvertList: p2pAdvertList ?? this.p2pAdvertList, paymentMethod: paymentMethod ?? this.paymentMethod, diff --git a/lib/basic_api/generated/p2p_advert_update_receive.dart b/lib/basic_api/generated/p2p_advert_update_receive.dart index d6ea0a5836..d5911dbc38 100644 --- a/lib/basic_api/generated/p2p_advert_update_receive.dart +++ b/lib/basic_api/generated/p2p_advert_update_receive.dart @@ -9,16 +9,11 @@ class P2pAdvertUpdateReceive extends Response { /// Initialize P2pAdvertUpdateReceive. const P2pAdvertUpdateReceive({ this.p2pAdvertUpdate, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertUpdateReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/p2p_advert_update_send.dart b/lib/basic_api/generated/p2p_advert_update_send.dart index 586a0f2c91..ba61f0bd7f 100644 --- a/lib/basic_api/generated/p2p_advert_update_send.dart +++ b/lib/basic_api/generated/p2p_advert_update_send.dart @@ -11,11 +11,16 @@ class P2pAdvertUpdateRequest extends Request { this.contactInfo, this.delete, this.description, + this.eligibleCountries, required this.id, this.isActive, this.localCurrency, + this.loginid, this.maxOrderAmount, + this.minCompletionRate, + this.minJoinDays, this.minOrderAmount, + this.minRating, this.orderExpiryPeriod, this.p2pAdvertUpdate = true, this.paymentInfo, @@ -35,11 +40,18 @@ class P2pAdvertUpdateRequest extends Request { contactInfo: json['contact_info'] as String?, delete: json['delete'] == null ? null : json['delete'] == 1, description: json['description'] as String?, + eligibleCountries: (json['eligible_countries'] as List?) + ?.map((dynamic item) => item as String) + .toList(), id: json['id'] as String?, isActive: json['is_active'] == null ? null : json['is_active'] == 1, localCurrency: json['local_currency'] as String?, + loginid: json['loginid'] as String?, maxOrderAmount: json['max_order_amount'] as num?, + minCompletionRate: json['min_completion_rate'] as num?, + minJoinDays: json['min_join_days'] as int?, minOrderAmount: json['min_order_amount'] as num?, + minRating: json['min_rating'] as num?, orderExpiryPeriod: json['order_expiry_period'] as int?, p2pAdvertUpdate: json['p2p_advert_update'] == null ? null @@ -67,6 +79,9 @@ class P2pAdvertUpdateRequest extends Request { /// [Optional] General information about the advert. final String? description; + /// [Optional] 2 letter country codes. Counterparties who do not live in these countries will not be allowed to place orders against this advert. An empty array or null value will clear the condition. + final List? eligibleCountries; + /// The unique identifier for this advert. final String? id; @@ -76,12 +91,24 @@ class P2pAdvertUpdateRequest extends Request { /// [Optional] Local currency for this advert. final String? localCurrency; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] Maximum allowed amount for the orders of this advert, in advertiser's `account_currency`. Should be more than or equal to `min_order_amount`. final num? maxOrderAmount; + /// [Optional] Counterparties who have a 30 day completion rate less than this value will not be allowed to place orders against this advert. A an empty array or null value will clear the condition. + final num? minCompletionRate; + + /// [Optional] Counterparties who joined less than this number of days ago will not be allowed to place orders against this advert. A null value will clear the condition. + final int? minJoinDays; + /// [Optional] Minimum allowed amount for the orders of this advert, in advertiser's `account_currency`. Should be less than or equal to `max_order_amount`. final num? minOrderAmount; + /// [Optional] Counterparties who have an average rating less than this value will not be allowed to place orders against this advert. A null value will clear the condition. + final num? minRating; + /// [Optional] Expiry period (seconds) for order created against this ad. final int? orderExpiryPeriod; @@ -116,6 +143,7 @@ class P2pAdvertUpdateRequest extends Request { ? 1 : 0, 'description': description, + 'eligible_countries': eligibleCountries, 'id': id, 'is_active': isActive == null ? null @@ -123,8 +151,12 @@ class P2pAdvertUpdateRequest extends Request { ? 1 : 0, 'local_currency': localCurrency, + 'loginid': loginid, 'max_order_amount': maxOrderAmount, + 'min_completion_rate': minCompletionRate, + 'min_join_days': minJoinDays, 'min_order_amount': minOrderAmount, + 'min_rating': minRating, 'order_expiry_period': orderExpiryPeriod, 'p2p_advert_update': p2pAdvertUpdate == null ? null @@ -147,11 +179,16 @@ class P2pAdvertUpdateRequest extends Request { String? contactInfo, bool? delete, String? description, + List? eligibleCountries, String? id, bool? isActive, String? localCurrency, + String? loginid, num? maxOrderAmount, + num? minCompletionRate, + int? minJoinDays, num? minOrderAmount, + num? minRating, int? orderExpiryPeriod, bool? p2pAdvertUpdate, String? paymentInfo, @@ -167,11 +204,16 @@ class P2pAdvertUpdateRequest extends Request { contactInfo: contactInfo ?? this.contactInfo, delete: delete ?? this.delete, description: description ?? this.description, + eligibleCountries: eligibleCountries ?? this.eligibleCountries, id: id ?? this.id, isActive: isActive ?? this.isActive, localCurrency: localCurrency ?? this.localCurrency, + loginid: loginid ?? this.loginid, maxOrderAmount: maxOrderAmount ?? this.maxOrderAmount, + minCompletionRate: minCompletionRate ?? this.minCompletionRate, + minJoinDays: minJoinDays ?? this.minJoinDays, minOrderAmount: minOrderAmount ?? this.minOrderAmount, + minRating: minRating ?? this.minRating, orderExpiryPeriod: orderExpiryPeriod ?? this.orderExpiryPeriod, p2pAdvertUpdate: p2pAdvertUpdate ?? this.p2pAdvertUpdate, paymentInfo: paymentInfo ?? this.paymentInfo, diff --git a/lib/basic_api/generated/p2p_advertiser_adverts_receive.dart b/lib/basic_api/generated/p2p_advertiser_adverts_receive.dart index f78d3c7138..784a89b5b2 100644 --- a/lib/basic_api/generated/p2p_advertiser_adverts_receive.dart +++ b/lib/basic_api/generated/p2p_advertiser_adverts_receive.dart @@ -9,16 +9,11 @@ class P2pAdvertiserAdvertsReceive extends Response { /// Initialize P2pAdvertiserAdvertsReceive. const P2pAdvertiserAdvertsReceive({ this.p2pAdvertiserAdverts, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertiserAdvertsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/p2p_advertiser_adverts_send.dart b/lib/basic_api/generated/p2p_advertiser_adverts_send.dart index d55df8ce97..788e3ac197 100644 --- a/lib/basic_api/generated/p2p_advertiser_adverts_send.dart +++ b/lib/basic_api/generated/p2p_advertiser_adverts_send.dart @@ -9,20 +9,19 @@ class P2pAdvertiserAdvertsRequest extends Request { /// Initialize P2pAdvertiserAdvertsRequest. const P2pAdvertiserAdvertsRequest({ this.limit, + this.loginid, this.offset, this.p2pAdvertiserAdverts = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_advertiser_adverts', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_advertiser_adverts', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertiserAdvertsRequest.fromJson(Map json) => P2pAdvertiserAdvertsRequest( limit: json['limit'] as int?, + loginid: json['loginid'] as String?, offset: json['offset'] as int?, p2pAdvertiserAdverts: json['p2p_advertiser_adverts'] == null ? null @@ -34,6 +33,9 @@ class P2pAdvertiserAdvertsRequest extends Request { /// [Optional] Used for paging. This value will also apply to subsription responses. final int? limit; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] Used for paging. This value will also apply to subsription responses. final int? offset; @@ -44,6 +46,7 @@ class P2pAdvertiserAdvertsRequest extends Request { @override Map toJson() => { 'limit': limit, + 'loginid': loginid, 'offset': offset, 'p2p_advertiser_adverts': p2pAdvertiserAdverts == null ? null @@ -58,6 +61,7 @@ class P2pAdvertiserAdvertsRequest extends Request { @override P2pAdvertiserAdvertsRequest copyWith({ int? limit, + String? loginid, int? offset, bool? p2pAdvertiserAdverts, Map? passthrough, @@ -65,6 +69,7 @@ class P2pAdvertiserAdvertsRequest extends Request { }) => P2pAdvertiserAdvertsRequest( limit: limit ?? this.limit, + loginid: loginid ?? this.loginid, offset: offset ?? this.offset, p2pAdvertiserAdverts: p2pAdvertiserAdverts ?? this.p2pAdvertiserAdverts, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/p2p_advertiser_create_receive.dart b/lib/basic_api/generated/p2p_advertiser_create_receive.dart index 8385de5831..f7d4f9acc1 100644 --- a/lib/basic_api/generated/p2p_advertiser_create_receive.dart +++ b/lib/basic_api/generated/p2p_advertiser_create_receive.dart @@ -10,16 +10,11 @@ class P2pAdvertiserCreateReceive extends Response { const P2pAdvertiserCreateReceive({ this.p2pAdvertiserCreate, this.subscription, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertiserCreateReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/p2p_advertiser_create_send.dart b/lib/basic_api/generated/p2p_advertiser_create_send.dart index 85c5f11b49..7389a6dd25 100644 --- a/lib/basic_api/generated/p2p_advertiser_create_send.dart +++ b/lib/basic_api/generated/p2p_advertiser_create_send.dart @@ -10,23 +10,22 @@ class P2pAdvertiserCreateRequest extends Request { const P2pAdvertiserCreateRequest({ this.contactInfo, this.defaultAdvertDescription, + this.loginid, required this.name, this.p2pAdvertiserCreate = true, this.paymentInfo, this.subscribe, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_advertiser_create', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_advertiser_create', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertiserCreateRequest.fromJson(Map json) => P2pAdvertiserCreateRequest( contactInfo: json['contact_info'] as String?, defaultAdvertDescription: json['default_advert_description'] as String?, + loginid: json['loginid'] as String?, name: json['name'] as String?, p2pAdvertiserCreate: json['p2p_advertiser_create'] == null ? null @@ -43,6 +42,9 @@ class P2pAdvertiserCreateRequest extends Request { /// [Optional] Default description that can be used every time an advert is created. final String? defaultAdvertDescription; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// The advertiser's displayed name. final String? name; @@ -60,6 +62,7 @@ class P2pAdvertiserCreateRequest extends Request { Map toJson() => { 'contact_info': contactInfo, 'default_advert_description': defaultAdvertDescription, + 'loginid': loginid, 'name': name, 'p2p_advertiser_create': p2pAdvertiserCreate == null ? null @@ -81,6 +84,7 @@ class P2pAdvertiserCreateRequest extends Request { P2pAdvertiserCreateRequest copyWith({ String? contactInfo, String? defaultAdvertDescription, + String? loginid, String? name, bool? p2pAdvertiserCreate, String? paymentInfo, @@ -92,6 +96,7 @@ class P2pAdvertiserCreateRequest extends Request { contactInfo: contactInfo ?? this.contactInfo, defaultAdvertDescription: defaultAdvertDescription ?? this.defaultAdvertDescription, + loginid: loginid ?? this.loginid, name: name ?? this.name, p2pAdvertiserCreate: p2pAdvertiserCreate ?? this.p2pAdvertiserCreate, paymentInfo: paymentInfo ?? this.paymentInfo, diff --git a/lib/basic_api/generated/p2p_advertiser_info_receive.dart b/lib/basic_api/generated/p2p_advertiser_info_receive.dart index 639c9e7727..385dc71804 100644 --- a/lib/basic_api/generated/p2p_advertiser_info_receive.dart +++ b/lib/basic_api/generated/p2p_advertiser_info_receive.dart @@ -10,16 +10,11 @@ class P2pAdvertiserInfoReceive extends Response { const P2pAdvertiserInfoReceive({ this.p2pAdvertiserInfo, this.subscription, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertiserInfoReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/p2p_advertiser_info_send.dart b/lib/basic_api/generated/p2p_advertiser_info_send.dart index eb393a5104..c795ddd8ee 100644 --- a/lib/basic_api/generated/p2p_advertiser_info_send.dart +++ b/lib/basic_api/generated/p2p_advertiser_info_send.dart @@ -9,20 +9,19 @@ class P2pAdvertiserInfoRequest extends Request { /// Initialize P2pAdvertiserInfoRequest. const P2pAdvertiserInfoRequest({ this.id, + this.loginid, this.p2pAdvertiserInfo = true, this.subscribe, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_advertiser_info', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_advertiser_info', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertiserInfoRequest.fromJson(Map json) => P2pAdvertiserInfoRequest( id: json['id'] as String?, + loginid: json['loginid'] as String?, p2pAdvertiserInfo: json['p2p_advertiser_info'] == null ? null : json['p2p_advertiser_info'] == 1, @@ -34,6 +33,9 @@ class P2pAdvertiserInfoRequest extends Request { /// [Optional] The unique identifier for this advertiser. If not provided, returns advertiser information about the current account. final String? id; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? p2pAdvertiserInfo; @@ -44,6 +46,7 @@ class P2pAdvertiserInfoRequest extends Request { @override Map toJson() => { 'id': id, + 'loginid': loginid, 'p2p_advertiser_info': p2pAdvertiserInfo == null ? null : p2pAdvertiserInfo! @@ -62,6 +65,7 @@ class P2pAdvertiserInfoRequest extends Request { @override P2pAdvertiserInfoRequest copyWith({ String? id, + String? loginid, bool? p2pAdvertiserInfo, bool? subscribe, Map? passthrough, @@ -69,6 +73,7 @@ class P2pAdvertiserInfoRequest extends Request { }) => P2pAdvertiserInfoRequest( id: id ?? this.id, + loginid: loginid ?? this.loginid, p2pAdvertiserInfo: p2pAdvertiserInfo ?? this.p2pAdvertiserInfo, subscribe: subscribe ?? this.subscribe, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/p2p_advertiser_list_receive.dart b/lib/basic_api/generated/p2p_advertiser_list_receive.dart index abc573bbda..48152fcbee 100644 --- a/lib/basic_api/generated/p2p_advertiser_list_receive.dart +++ b/lib/basic_api/generated/p2p_advertiser_list_receive.dart @@ -9,16 +9,11 @@ class P2pAdvertiserListReceive extends Response { /// Initialize P2pAdvertiserListReceive. const P2pAdvertiserListReceive({ this.p2pAdvertiserList, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertiserListReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/p2p_advertiser_list_send.dart b/lib/basic_api/generated/p2p_advertiser_list_send.dart index dd7e383e7f..0de882a5bc 100644 --- a/lib/basic_api/generated/p2p_advertiser_list_send.dart +++ b/lib/basic_api/generated/p2p_advertiser_list_send.dart @@ -11,17 +11,15 @@ class P2pAdvertiserListRequest extends Request { this.advertiserName, this.isBlocked, this.limit, + this.loginid, this.offset, this.p2pAdvertiserList = true, this.sortBy, this.tradePartners, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_advertiser_list', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_advertiser_list', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertiserListRequest.fromJson(Map json) => @@ -29,6 +27,7 @@ class P2pAdvertiserListRequest extends Request { advertiserName: json['advertiser_name'] as String?, isBlocked: json['is_blocked'] == null ? null : json['is_blocked'] == 1, limit: json['limit'] as int?, + loginid: json['loginid'] as String?, offset: json['offset'] as int?, p2pAdvertiserList: json['p2p_advertiser_list'] == null ? null @@ -49,6 +48,9 @@ class P2pAdvertiserListRequest extends Request { /// [Optional] Used for paging. final int? limit; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] Used for paging. final int? offset; @@ -71,6 +73,7 @@ class P2pAdvertiserListRequest extends Request { ? 1 : 0, 'limit': limit, + 'loginid': loginid, 'offset': offset, 'p2p_advertiser_list': p2pAdvertiserList == null ? null @@ -93,6 +96,7 @@ class P2pAdvertiserListRequest extends Request { String? advertiserName, bool? isBlocked, int? limit, + String? loginid, int? offset, bool? p2pAdvertiserList, String? sortBy, @@ -104,6 +108,7 @@ class P2pAdvertiserListRequest extends Request { advertiserName: advertiserName ?? this.advertiserName, isBlocked: isBlocked ?? this.isBlocked, limit: limit ?? this.limit, + loginid: loginid ?? this.loginid, offset: offset ?? this.offset, p2pAdvertiserList: p2pAdvertiserList ?? this.p2pAdvertiserList, sortBy: sortBy ?? this.sortBy, diff --git a/lib/basic_api/generated/p2p_advertiser_payment_methods_receive.dart b/lib/basic_api/generated/p2p_advertiser_payment_methods_receive.dart index 7545994330..30f7ec6791 100644 --- a/lib/basic_api/generated/p2p_advertiser_payment_methods_receive.dart +++ b/lib/basic_api/generated/p2p_advertiser_payment_methods_receive.dart @@ -9,16 +9,11 @@ class P2pAdvertiserPaymentMethodsReceive extends Response { /// Initialize P2pAdvertiserPaymentMethodsReceive. const P2pAdvertiserPaymentMethodsReceive({ this.p2pAdvertiserPaymentMethods, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertiserPaymentMethodsReceive.fromJson( diff --git a/lib/basic_api/generated/p2p_advertiser_payment_methods_send.dart b/lib/basic_api/generated/p2p_advertiser_payment_methods_send.dart index bb28236a38..6cfda8248f 100644 --- a/lib/basic_api/generated/p2p_advertiser_payment_methods_send.dart +++ b/lib/basic_api/generated/p2p_advertiser_payment_methods_send.dart @@ -10,15 +10,13 @@ class P2pAdvertiserPaymentMethodsRequest extends Request { const P2pAdvertiserPaymentMethodsRequest({ required this.create, required this.delete, + this.loginid, this.p2pAdvertiserPaymentMethods = true, required this.update, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_advertiser_payment_methods', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_advertiser_payment_methods', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertiserPaymentMethodsRequest.fromJson( @@ -31,6 +29,7 @@ class P2pAdvertiserPaymentMethodsRequest extends Request { delete: (json['delete'] as List?) ?.map((dynamic item) => item as num) .toList(), + loginid: json['loginid'] as String?, p2pAdvertiserPaymentMethods: json['p2p_advertiser_payment_methods'] == null ? null @@ -46,6 +45,9 @@ class P2pAdvertiserPaymentMethodsRequest extends Request { /// Contains payment methods to delete. final List? delete; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? p2pAdvertiserPaymentMethods; @@ -57,6 +59,7 @@ class P2pAdvertiserPaymentMethodsRequest extends Request { Map toJson() => { 'create': create, 'delete': delete, + 'loginid': loginid, 'p2p_advertiser_payment_methods': p2pAdvertiserPaymentMethods == null ? null : p2pAdvertiserPaymentMethods! @@ -72,6 +75,7 @@ class P2pAdvertiserPaymentMethodsRequest extends Request { P2pAdvertiserPaymentMethodsRequest copyWith({ List>? create, List? delete, + String? loginid, bool? p2pAdvertiserPaymentMethods, Map? update, Map? passthrough, @@ -80,6 +84,7 @@ class P2pAdvertiserPaymentMethodsRequest extends Request { P2pAdvertiserPaymentMethodsRequest( create: create ?? this.create, delete: delete ?? this.delete, + loginid: loginid ?? this.loginid, p2pAdvertiserPaymentMethods: p2pAdvertiserPaymentMethods ?? this.p2pAdvertiserPaymentMethods, update: update ?? this.update, diff --git a/lib/basic_api/generated/p2p_advertiser_relations_receive.dart b/lib/basic_api/generated/p2p_advertiser_relations_receive.dart index 641012d900..ea3f29105f 100644 --- a/lib/basic_api/generated/p2p_advertiser_relations_receive.dart +++ b/lib/basic_api/generated/p2p_advertiser_relations_receive.dart @@ -9,16 +9,11 @@ class P2pAdvertiserRelationsReceive extends Response { /// Initialize P2pAdvertiserRelationsReceive. const P2pAdvertiserRelationsReceive({ this.p2pAdvertiserRelations, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertiserRelationsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/p2p_advertiser_relations_send.dart b/lib/basic_api/generated/p2p_advertiser_relations_send.dart index 6061bc15ac..440f1f57e3 100644 --- a/lib/basic_api/generated/p2p_advertiser_relations_send.dart +++ b/lib/basic_api/generated/p2p_advertiser_relations_send.dart @@ -10,16 +10,14 @@ class P2pAdvertiserRelationsRequest extends Request { const P2pAdvertiserRelationsRequest({ required this.addBlocked, required this.addFavourites, + this.loginid, this.p2pAdvertiserRelations = true, required this.removeBlocked, required this.removeFavourites, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_advertiser_relations', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_advertiser_relations', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertiserRelationsRequest.fromJson(Map json) => @@ -30,6 +28,7 @@ class P2pAdvertiserRelationsRequest extends Request { addFavourites: (json['add_favourites'] as List?) ?.map((dynamic item) => item as num) .toList(), + loginid: json['loginid'] as String?, p2pAdvertiserRelations: json['p2p_advertiser_relations'] == null ? null : json['p2p_advertiser_relations'] == 1, @@ -49,6 +48,9 @@ class P2pAdvertiserRelationsRequest extends Request { /// IDs of advertisers to add as favourites. final List? addFavourites; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? p2pAdvertiserRelations; @@ -63,6 +65,7 @@ class P2pAdvertiserRelationsRequest extends Request { Map toJson() => { 'add_blocked': addBlocked, 'add_favourites': addFavourites, + 'loginid': loginid, 'p2p_advertiser_relations': p2pAdvertiserRelations == null ? null : p2pAdvertiserRelations! @@ -79,6 +82,7 @@ class P2pAdvertiserRelationsRequest extends Request { P2pAdvertiserRelationsRequest copyWith({ List? addBlocked, List? addFavourites, + String? loginid, bool? p2pAdvertiserRelations, List? removeBlocked, List? removeFavourites, @@ -88,6 +92,7 @@ class P2pAdvertiserRelationsRequest extends Request { P2pAdvertiserRelationsRequest( addBlocked: addBlocked ?? this.addBlocked, addFavourites: addFavourites ?? this.addFavourites, + loginid: loginid ?? this.loginid, p2pAdvertiserRelations: p2pAdvertiserRelations ?? this.p2pAdvertiserRelations, removeBlocked: removeBlocked ?? this.removeBlocked, diff --git a/lib/basic_api/generated/p2p_advertiser_update_receive.dart b/lib/basic_api/generated/p2p_advertiser_update_receive.dart index b08d8559d6..3ebb6f71c6 100644 --- a/lib/basic_api/generated/p2p_advertiser_update_receive.dart +++ b/lib/basic_api/generated/p2p_advertiser_update_receive.dart @@ -9,16 +9,11 @@ class P2pAdvertiserUpdateReceive extends Response { /// Initialize P2pAdvertiserUpdateReceive. const P2pAdvertiserUpdateReceive({ this.p2pAdvertiserUpdate, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertiserUpdateReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/p2p_advertiser_update_send.dart b/lib/basic_api/generated/p2p_advertiser_update_send.dart index 91f04caf4d..c84ab19375 100644 --- a/lib/basic_api/generated/p2p_advertiser_update_send.dart +++ b/lib/basic_api/generated/p2p_advertiser_update_send.dart @@ -11,17 +11,15 @@ class P2pAdvertiserUpdateRequest extends Request { this.contactInfo, this.defaultAdvertDescription, this.isListed, + this.loginid, this.p2pAdvertiserUpdate = true, this.paymentInfo, this.showName, this.upgradeLimits, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_advertiser_update', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_advertiser_update', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pAdvertiserUpdateRequest.fromJson(Map json) => @@ -29,6 +27,7 @@ class P2pAdvertiserUpdateRequest extends Request { contactInfo: json['contact_info'] as String?, defaultAdvertDescription: json['default_advert_description'] as String?, isListed: json['is_listed'] == null ? null : json['is_listed'] == 1, + loginid: json['loginid'] as String?, p2pAdvertiserUpdate: json['p2p_advertiser_update'] == null ? null : json['p2p_advertiser_update'] == 1, @@ -48,6 +47,9 @@ class P2pAdvertiserUpdateRequest extends Request { /// [Optional] Used to set if the advertiser's adverts could be listed. When `false`, adverts won't be listed regardless of they are active or not. This doesn't change the `is_active` of each individual advert. final bool? isListed; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? p2pAdvertiserUpdate; @@ -57,7 +59,7 @@ class P2pAdvertiserUpdateRequest extends Request { /// [Optional] When `true`, the advertiser's real name will be displayed on to other users on adverts and orders. final bool? showName; - /// [Optional] Used to upgrade daily limits of advertiser if advertiser is eligible + /// [Optional] Used to upgrade daily limits of eligible advertiser. final int? upgradeLimits; /// Converts this instance to JSON @@ -70,6 +72,7 @@ class P2pAdvertiserUpdateRequest extends Request { : isListed! ? 1 : 0, + 'loginid': loginid, 'p2p_advertiser_update': p2pAdvertiserUpdate == null ? null : p2pAdvertiserUpdate! @@ -92,6 +95,7 @@ class P2pAdvertiserUpdateRequest extends Request { String? contactInfo, String? defaultAdvertDescription, bool? isListed, + String? loginid, bool? p2pAdvertiserUpdate, String? paymentInfo, bool? showName, @@ -104,6 +108,7 @@ class P2pAdvertiserUpdateRequest extends Request { defaultAdvertDescription: defaultAdvertDescription ?? this.defaultAdvertDescription, isListed: isListed ?? this.isListed, + loginid: loginid ?? this.loginid, p2pAdvertiserUpdate: p2pAdvertiserUpdate ?? this.p2pAdvertiserUpdate, paymentInfo: paymentInfo ?? this.paymentInfo, showName: showName ?? this.showName, diff --git a/lib/basic_api/generated/p2p_chat_create_receive.dart b/lib/basic_api/generated/p2p_chat_create_receive.dart index 5c730a05b1..e4211f1ab1 100644 --- a/lib/basic_api/generated/p2p_chat_create_receive.dart +++ b/lib/basic_api/generated/p2p_chat_create_receive.dart @@ -9,16 +9,11 @@ class P2pChatCreateReceive extends Response { /// Initialize P2pChatCreateReceive. const P2pChatCreateReceive({ this.p2pChatCreate, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory P2pChatCreateReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/p2p_chat_create_send.dart b/lib/basic_api/generated/p2p_chat_create_send.dart index e9737fc2cf..adc44f1102 100644 --- a/lib/basic_api/generated/p2p_chat_create_send.dart +++ b/lib/basic_api/generated/p2p_chat_create_send.dart @@ -8,19 +8,18 @@ import '../request.dart'; class P2pChatCreateRequest extends Request { /// Initialize P2pChatCreateRequest. const P2pChatCreateRequest({ + this.loginid, required this.orderId, this.p2pChatCreate = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_chat_create', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_chat_create', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pChatCreateRequest.fromJson(Map json) => P2pChatCreateRequest( + loginid: json['loginid'] as String?, orderId: json['order_id'] as String?, p2pChatCreate: json['p2p_chat_create'] == null ? null @@ -29,6 +28,9 @@ class P2pChatCreateRequest extends Request { reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// The unique identifier for the order to create the chat for. final String? orderId; @@ -38,6 +40,7 @@ class P2pChatCreateRequest extends Request { /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'order_id': orderId, 'p2p_chat_create': p2pChatCreate == null ? null @@ -51,12 +54,14 @@ class P2pChatCreateRequest extends Request { /// Creates a copy of instance with given parameters @override P2pChatCreateRequest copyWith({ + String? loginid, String? orderId, bool? p2pChatCreate, Map? passthrough, int? reqId, }) => P2pChatCreateRequest( + loginid: loginid ?? this.loginid, orderId: orderId ?? this.orderId, p2pChatCreate: p2pChatCreate ?? this.p2pChatCreate, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/p2p_order_cancel_receive.dart b/lib/basic_api/generated/p2p_order_cancel_receive.dart index fd3d4af758..2d240fbcea 100644 --- a/lib/basic_api/generated/p2p_order_cancel_receive.dart +++ b/lib/basic_api/generated/p2p_order_cancel_receive.dart @@ -9,16 +9,11 @@ class P2pOrderCancelReceive extends Response { /// Initialize P2pOrderCancelReceive. const P2pOrderCancelReceive({ this.p2pOrderCancel, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory P2pOrderCancelReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/p2p_order_cancel_send.dart b/lib/basic_api/generated/p2p_order_cancel_send.dart index c5912425cd..d8194ecaae 100644 --- a/lib/basic_api/generated/p2p_order_cancel_send.dart +++ b/lib/basic_api/generated/p2p_order_cancel_send.dart @@ -9,19 +9,18 @@ class P2pOrderCancelRequest extends Request { /// Initialize P2pOrderCancelRequest. const P2pOrderCancelRequest({ required this.id, + this.loginid, this.p2pOrderCancel = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_order_cancel', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_order_cancel', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pOrderCancelRequest.fromJson(Map json) => P2pOrderCancelRequest( id: json['id'] as String?, + loginid: json['loginid'] as String?, p2pOrderCancel: json['p2p_order_cancel'] == null ? null : json['p2p_order_cancel'] == 1, @@ -32,6 +31,9 @@ class P2pOrderCancelRequest extends Request { /// The unique identifier for this order. final String? id; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? p2pOrderCancel; @@ -39,6 +41,7 @@ class P2pOrderCancelRequest extends Request { @override Map toJson() => { 'id': id, + 'loginid': loginid, 'p2p_order_cancel': p2pOrderCancel == null ? null : p2pOrderCancel! @@ -52,12 +55,14 @@ class P2pOrderCancelRequest extends Request { @override P2pOrderCancelRequest copyWith({ String? id, + String? loginid, bool? p2pOrderCancel, Map? passthrough, int? reqId, }) => P2pOrderCancelRequest( id: id ?? this.id, + loginid: loginid ?? this.loginid, p2pOrderCancel: p2pOrderCancel ?? this.p2pOrderCancel, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/p2p_order_confirm_receive.dart b/lib/basic_api/generated/p2p_order_confirm_receive.dart index 40d4c97774..45cbc2cd61 100644 --- a/lib/basic_api/generated/p2p_order_confirm_receive.dart +++ b/lib/basic_api/generated/p2p_order_confirm_receive.dart @@ -9,16 +9,11 @@ class P2pOrderConfirmReceive extends Response { /// Initialize P2pOrderConfirmReceive. const P2pOrderConfirmReceive({ this.p2pOrderConfirm, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory P2pOrderConfirmReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/p2p_order_confirm_send.dart b/lib/basic_api/generated/p2p_order_confirm_send.dart index 742bd14234..e4aa64da89 100644 --- a/lib/basic_api/generated/p2p_order_confirm_send.dart +++ b/lib/basic_api/generated/p2p_order_confirm_send.dart @@ -10,21 +10,20 @@ class P2pOrderConfirmRequest extends Request { const P2pOrderConfirmRequest({ this.dryRun, required this.id, + this.loginid, this.p2pOrderConfirm = true, this.verificationCode, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_order_confirm', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_order_confirm', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pOrderConfirmRequest.fromJson(Map json) => P2pOrderConfirmRequest( dryRun: json['dry_run'] == null ? null : json['dry_run'] == 1, id: json['id'] as String?, + loginid: json['loginid'] as String?, p2pOrderConfirm: json['p2p_order_confirm'] == null ? null : json['p2p_order_confirm'] == 1, @@ -39,6 +38,9 @@ class P2pOrderConfirmRequest extends Request { /// The unique identifier for this order. final String? id; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? p2pOrderConfirm; @@ -54,6 +56,7 @@ class P2pOrderConfirmRequest extends Request { ? 1 : 0, 'id': id, + 'loginid': loginid, 'p2p_order_confirm': p2pOrderConfirm == null ? null : p2pOrderConfirm! @@ -69,6 +72,7 @@ class P2pOrderConfirmRequest extends Request { P2pOrderConfirmRequest copyWith({ bool? dryRun, String? id, + String? loginid, bool? p2pOrderConfirm, String? verificationCode, Map? passthrough, @@ -77,6 +81,7 @@ class P2pOrderConfirmRequest extends Request { P2pOrderConfirmRequest( dryRun: dryRun ?? this.dryRun, id: id ?? this.id, + loginid: loginid ?? this.loginid, p2pOrderConfirm: p2pOrderConfirm ?? this.p2pOrderConfirm, verificationCode: verificationCode ?? this.verificationCode, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/p2p_order_create_receive.dart b/lib/basic_api/generated/p2p_order_create_receive.dart index bb12c06527..99144c1382 100644 --- a/lib/basic_api/generated/p2p_order_create_receive.dart +++ b/lib/basic_api/generated/p2p_order_create_receive.dart @@ -10,16 +10,11 @@ class P2pOrderCreateReceive extends Response { const P2pOrderCreateReceive({ this.p2pOrderCreate, this.subscription, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory P2pOrderCreateReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/p2p_order_create_send.dart b/lib/basic_api/generated/p2p_order_create_send.dart index 080693f4d2..0b16304933 100644 --- a/lib/basic_api/generated/p2p_order_create_send.dart +++ b/lib/basic_api/generated/p2p_order_create_send.dart @@ -11,18 +11,16 @@ class P2pOrderCreateRequest extends Request { required this.advertId, required this.amount, this.contactInfo, + this.loginid, this.p2pOrderCreate = true, this.paymentInfo, required this.paymentMethodIds, this.rate, this.subscribe, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_order_create', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_order_create', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pOrderCreateRequest.fromJson(Map json) => @@ -30,6 +28,7 @@ class P2pOrderCreateRequest extends Request { advertId: json['advert_id'] as String?, amount: json['amount'] as num?, contactInfo: json['contact_info'] as String?, + loginid: json['loginid'] as String?, p2pOrderCreate: json['p2p_order_create'] == null ? null : json['p2p_order_create'] == 1, @@ -52,6 +51,9 @@ class P2pOrderCreateRequest extends Request { /// [Optional] Seller contact information. Only applicable for 'sell orders'. final String? contactInfo; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? p2pOrderCreate; @@ -73,6 +75,7 @@ class P2pOrderCreateRequest extends Request { 'advert_id': advertId, 'amount': amount, 'contact_info': contactInfo, + 'loginid': loginid, 'p2p_order_create': p2pOrderCreate == null ? null : p2pOrderCreate! @@ -96,6 +99,7 @@ class P2pOrderCreateRequest extends Request { String? advertId, num? amount, String? contactInfo, + String? loginid, bool? p2pOrderCreate, String? paymentInfo, List? paymentMethodIds, @@ -108,6 +112,7 @@ class P2pOrderCreateRequest extends Request { advertId: advertId ?? this.advertId, amount: amount ?? this.amount, contactInfo: contactInfo ?? this.contactInfo, + loginid: loginid ?? this.loginid, p2pOrderCreate: p2pOrderCreate ?? this.p2pOrderCreate, paymentInfo: paymentInfo ?? this.paymentInfo, paymentMethodIds: paymentMethodIds ?? this.paymentMethodIds, diff --git a/lib/basic_api/generated/p2p_order_dispute_receive.dart b/lib/basic_api/generated/p2p_order_dispute_receive.dart index 661341925c..a1cae5a9dd 100644 --- a/lib/basic_api/generated/p2p_order_dispute_receive.dart +++ b/lib/basic_api/generated/p2p_order_dispute_receive.dart @@ -9,16 +9,11 @@ class P2pOrderDisputeReceive extends Response { /// Initialize P2pOrderDisputeReceive. const P2pOrderDisputeReceive({ this.p2pOrderDispute, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory P2pOrderDisputeReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/p2p_order_dispute_send.dart b/lib/basic_api/generated/p2p_order_dispute_send.dart index 612067252b..41eba6d31f 100644 --- a/lib/basic_api/generated/p2p_order_dispute_send.dart +++ b/lib/basic_api/generated/p2p_order_dispute_send.dart @@ -10,20 +10,19 @@ class P2pOrderDisputeRequest extends Request { const P2pOrderDisputeRequest({ required this.disputeReason, required this.id, + this.loginid, this.p2pOrderDispute = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_order_dispute', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_order_dispute', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pOrderDisputeRequest.fromJson(Map json) => P2pOrderDisputeRequest( disputeReason: json['dispute_reason'] as String?, id: json['id'] as String?, + loginid: json['loginid'] as String?, p2pOrderDispute: json['p2p_order_dispute'] == null ? null : json['p2p_order_dispute'] == 1, @@ -37,6 +36,9 @@ class P2pOrderDisputeRequest extends Request { /// The unique identifier for this order. final String? id; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? p2pOrderDispute; @@ -45,6 +47,7 @@ class P2pOrderDisputeRequest extends Request { Map toJson() => { 'dispute_reason': disputeReason, 'id': id, + 'loginid': loginid, 'p2p_order_dispute': p2pOrderDispute == null ? null : p2pOrderDispute! @@ -59,6 +62,7 @@ class P2pOrderDisputeRequest extends Request { P2pOrderDisputeRequest copyWith({ String? disputeReason, String? id, + String? loginid, bool? p2pOrderDispute, Map? passthrough, int? reqId, @@ -66,6 +70,7 @@ class P2pOrderDisputeRequest extends Request { P2pOrderDisputeRequest( disputeReason: disputeReason ?? this.disputeReason, id: id ?? this.id, + loginid: loginid ?? this.loginid, p2pOrderDispute: p2pOrderDispute ?? this.p2pOrderDispute, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/p2p_order_info_receive.dart b/lib/basic_api/generated/p2p_order_info_receive.dart index 4e607eb38c..ad3ae3bedc 100644 --- a/lib/basic_api/generated/p2p_order_info_receive.dart +++ b/lib/basic_api/generated/p2p_order_info_receive.dart @@ -10,16 +10,11 @@ class P2pOrderInfoReceive extends Response { const P2pOrderInfoReceive({ this.p2pOrderInfo, this.subscription, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory P2pOrderInfoReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/p2p_order_info_send.dart b/lib/basic_api/generated/p2p_order_info_send.dart index 6506c29c58..2335acee4b 100644 --- a/lib/basic_api/generated/p2p_order_info_send.dart +++ b/lib/basic_api/generated/p2p_order_info_send.dart @@ -9,20 +9,19 @@ class P2pOrderInfoRequest extends Request { /// Initialize P2pOrderInfoRequest. const P2pOrderInfoRequest({ required this.id, + this.loginid, this.p2pOrderInfo = true, this.subscribe, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_order_info', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_order_info', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pOrderInfoRequest.fromJson(Map json) => P2pOrderInfoRequest( id: json['id'] as String?, + loginid: json['loginid'] as String?, p2pOrderInfo: json['p2p_order_info'] == null ? null : json['p2p_order_info'] == 1, subscribe: json['subscribe'] == null ? null : json['subscribe'] == 1, @@ -33,6 +32,9 @@ class P2pOrderInfoRequest extends Request { /// The unique identifier for the order. final String? id; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? p2pOrderInfo; @@ -43,6 +45,7 @@ class P2pOrderInfoRequest extends Request { @override Map toJson() => { 'id': id, + 'loginid': loginid, 'p2p_order_info': p2pOrderInfo == null ? null : p2pOrderInfo! @@ -61,6 +64,7 @@ class P2pOrderInfoRequest extends Request { @override P2pOrderInfoRequest copyWith({ String? id, + String? loginid, bool? p2pOrderInfo, bool? subscribe, Map? passthrough, @@ -68,6 +72,7 @@ class P2pOrderInfoRequest extends Request { }) => P2pOrderInfoRequest( id: id ?? this.id, + loginid: loginid ?? this.loginid, p2pOrderInfo: p2pOrderInfo ?? this.p2pOrderInfo, subscribe: subscribe ?? this.subscribe, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/p2p_order_list_receive.dart b/lib/basic_api/generated/p2p_order_list_receive.dart index 7abe647231..0264333186 100644 --- a/lib/basic_api/generated/p2p_order_list_receive.dart +++ b/lib/basic_api/generated/p2p_order_list_receive.dart @@ -10,16 +10,11 @@ class P2pOrderListReceive extends Response { const P2pOrderListReceive({ this.p2pOrderList, this.subscription, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory P2pOrderListReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/p2p_order_list_send.dart b/lib/basic_api/generated/p2p_order_list_send.dart index b340480493..c1749e9a94 100644 --- a/lib/basic_api/generated/p2p_order_list_send.dart +++ b/lib/basic_api/generated/p2p_order_list_send.dart @@ -13,6 +13,7 @@ class P2pOrderListRequest extends Request { this.dateFrom, this.dateTo, this.limit, + this.loginid, this.offset, this.p2pOrderList = true, this.subscribe, @@ -29,6 +30,7 @@ class P2pOrderListRequest extends Request { dateFrom: json['date_from'] as String?, dateTo: json['date_to'] as String?, limit: json['limit'] as int?, + loginid: json['loginid'] as String?, offset: json['offset'] as int?, p2pOrderList: json['p2p_order_list'] == null ? null : json['p2p_order_list'] == 1, @@ -52,6 +54,9 @@ class P2pOrderListRequest extends Request { /// [Optional] Used for paging. final int? limit; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] Used for paging. final int? offset; @@ -69,6 +74,7 @@ class P2pOrderListRequest extends Request { 'date_from': dateFrom, 'date_to': dateTo, 'limit': limit, + 'loginid': loginid, 'offset': offset, 'p2p_order_list': p2pOrderList == null ? null @@ -92,6 +98,7 @@ class P2pOrderListRequest extends Request { String? dateFrom, String? dateTo, int? limit, + String? loginid, int? offset, bool? p2pOrderList, bool? subscribe, @@ -104,6 +111,7 @@ class P2pOrderListRequest extends Request { dateFrom: dateFrom ?? this.dateFrom, dateTo: dateTo ?? this.dateTo, limit: limit ?? this.limit, + loginid: loginid ?? this.loginid, offset: offset ?? this.offset, p2pOrderList: p2pOrderList ?? this.p2pOrderList, subscribe: subscribe ?? this.subscribe, diff --git a/lib/basic_api/generated/p2p_order_review_receive.dart b/lib/basic_api/generated/p2p_order_review_receive.dart index 3e8ba92ba4..af32b061f7 100644 --- a/lib/basic_api/generated/p2p_order_review_receive.dart +++ b/lib/basic_api/generated/p2p_order_review_receive.dart @@ -9,16 +9,11 @@ class P2pOrderReviewReceive extends Response { /// Initialize P2pOrderReviewReceive. const P2pOrderReviewReceive({ this.p2pOrderReview, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory P2pOrderReviewReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/p2p_order_review_send.dart b/lib/basic_api/generated/p2p_order_review_send.dart index 0d327d53b2..d75c9486d3 100644 --- a/lib/basic_api/generated/p2p_order_review_send.dart +++ b/lib/basic_api/generated/p2p_order_review_send.dart @@ -8,21 +8,20 @@ import '../request.dart'; class P2pOrderReviewRequest extends Request { /// Initialize P2pOrderReviewRequest. const P2pOrderReviewRequest({ + this.loginid, required this.orderId, this.p2pOrderReview = true, required this.rating, this.recommended, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_order_review', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_order_review', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pOrderReviewRequest.fromJson(Map json) => P2pOrderReviewRequest( + loginid: json['loginid'] as String?, orderId: json['order_id'] as String?, p2pOrderReview: json['p2p_order_review'] == null ? null @@ -33,6 +32,9 @@ class P2pOrderReviewRequest extends Request { reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// The order identification number. final String? orderId; @@ -48,6 +50,7 @@ class P2pOrderReviewRequest extends Request { /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'order_id': orderId, 'p2p_order_review': p2pOrderReview == null ? null @@ -63,6 +66,7 @@ class P2pOrderReviewRequest extends Request { /// Creates a copy of instance with given parameters @override P2pOrderReviewRequest copyWith({ + String? loginid, String? orderId, bool? p2pOrderReview, int? rating, @@ -71,6 +75,7 @@ class P2pOrderReviewRequest extends Request { int? reqId, }) => P2pOrderReviewRequest( + loginid: loginid ?? this.loginid, orderId: orderId ?? this.orderId, p2pOrderReview: p2pOrderReview ?? this.p2pOrderReview, rating: rating ?? this.rating, diff --git a/lib/basic_api/generated/p2p_payment_methods_receive.dart b/lib/basic_api/generated/p2p_payment_methods_receive.dart index d51012f874..53cd1593cc 100644 --- a/lib/basic_api/generated/p2p_payment_methods_receive.dart +++ b/lib/basic_api/generated/p2p_payment_methods_receive.dart @@ -9,16 +9,11 @@ class P2pPaymentMethodsReceive extends Response { /// Initialize P2pPaymentMethodsReceive. const P2pPaymentMethodsReceive({ this.p2pPaymentMethods, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory P2pPaymentMethodsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/p2p_payment_methods_send.dart b/lib/basic_api/generated/p2p_payment_methods_send.dart index 6b147577ec..523d43ba07 100644 --- a/lib/basic_api/generated/p2p_payment_methods_send.dart +++ b/lib/basic_api/generated/p2p_payment_methods_send.dart @@ -8,18 +8,17 @@ import '../request.dart'; class P2pPaymentMethodsRequest extends Request { /// Initialize P2pPaymentMethodsRequest. const P2pPaymentMethodsRequest({ + this.loginid, this.p2pPaymentMethods = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_payment_methods', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_payment_methods', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pPaymentMethodsRequest.fromJson(Map json) => P2pPaymentMethodsRequest( + loginid: json['loginid'] as String?, p2pPaymentMethods: json['p2p_payment_methods'] == null ? null : json['p2p_payment_methods'] == 1, @@ -27,12 +26,16 @@ class P2pPaymentMethodsRequest extends Request { reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? p2pPaymentMethods; /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'p2p_payment_methods': p2pPaymentMethods == null ? null : p2pPaymentMethods! @@ -45,11 +48,13 @@ class P2pPaymentMethodsRequest extends Request { /// Creates a copy of instance with given parameters @override P2pPaymentMethodsRequest copyWith({ + String? loginid, bool? p2pPaymentMethods, Map? passthrough, int? reqId, }) => P2pPaymentMethodsRequest( + loginid: loginid ?? this.loginid, p2pPaymentMethods: p2pPaymentMethods ?? this.p2pPaymentMethods, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/p2p_ping_receive.dart b/lib/basic_api/generated/p2p_ping_receive.dart index 709e4f1afa..1f3f78aa50 100644 --- a/lib/basic_api/generated/p2p_ping_receive.dart +++ b/lib/basic_api/generated/p2p_ping_receive.dart @@ -9,16 +9,11 @@ class P2pPingReceive extends Response { /// Initialize P2pPingReceive. const P2pPingReceive({ this.p2pPing, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory P2pPingReceive.fromJson(Map json) => P2pPingReceive( diff --git a/lib/basic_api/generated/p2p_ping_send.dart b/lib/basic_api/generated/p2p_ping_send.dart index fa598adb1d..26cb592d41 100644 --- a/lib/basic_api/generated/p2p_ping_send.dart +++ b/lib/basic_api/generated/p2p_ping_send.dart @@ -8,28 +8,31 @@ import '../request.dart'; class P2pPingRequest extends Request { /// Initialize P2pPingRequest. const P2pPingRequest({ + this.loginid, this.p2pPing = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'p2p_ping', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'p2p_ping', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory P2pPingRequest.fromJson(Map json) => P2pPingRequest( + loginid: json['loginid'] as String?, p2pPing: json['p2p_ping'] == null ? null : json['p2p_ping'] == 1, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? p2pPing; /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'p2p_ping': p2pPing == null ? null : p2pPing! @@ -42,11 +45,13 @@ class P2pPingRequest extends Request { /// Creates a copy of instance with given parameters @override P2pPingRequest copyWith({ + String? loginid, bool? p2pPing, Map? passthrough, int? reqId, }) => P2pPingRequest( + loginid: loginid ?? this.loginid, p2pPing: p2pPing ?? this.p2pPing, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/passkeys_list_receive.dart b/lib/basic_api/generated/passkeys_list_receive.dart new file mode 100644 index 0000000000..1ecb985e89 --- /dev/null +++ b/lib/basic_api/generated/passkeys_list_receive.dart @@ -0,0 +1,64 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/passkeys_list_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Passkeys list receive class. +class PasskeysListReceive extends Response { + /// Initialize PasskeysListReceive. + const PasskeysListReceive({ + this.passkeysList, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory PasskeysListReceive.fromJson(Map json) => + PasskeysListReceive( + passkeysList: (json['passkeys_list'] as List?) + ?.map>( + (dynamic item) => item as Map) + .toList(), + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// The list of passkeys. + final List>? passkeysList; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'passkeys_list': passkeysList, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + PasskeysListReceive copyWith({ + List>? passkeysList, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + PasskeysListReceive( + passkeysList: passkeysList ?? this.passkeysList, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/passkeys_list_send.dart b/lib/basic_api/generated/passkeys_list_send.dart new file mode 100644 index 0000000000..73d428574b --- /dev/null +++ b/lib/basic_api/generated/passkeys_list_send.dart @@ -0,0 +1,65 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/passkeys_list_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Passkeys list request class. +class PasskeysListRequest extends Request { + /// Initialize PasskeysListRequest. + const PasskeysListRequest({ + this.loginid, + this.passkeysList = true, + super.msgType = 'passkeys_list', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory PasskeysListRequest.fromJson(Map json) => + PasskeysListRequest( + loginid: json['loginid'] as String?, + passkeysList: + json['passkeys_list'] == null ? null : json['passkeys_list'] == 1, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + + /// Must be `true` + final bool? passkeysList; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'loginid': loginid, + 'passkeys_list': passkeysList == null + ? null + : passkeysList! + ? 1 + : 0, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + PasskeysListRequest copyWith({ + String? loginid, + bool? passkeysList, + Map? passthrough, + int? reqId, + }) => + PasskeysListRequest( + loginid: loginid ?? this.loginid, + passkeysList: passkeysList ?? this.passkeysList, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/passkeys_login_receive.dart b/lib/basic_api/generated/passkeys_login_receive.dart new file mode 100644 index 0000000000..62b3858682 --- /dev/null +++ b/lib/basic_api/generated/passkeys_login_receive.dart @@ -0,0 +1,61 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/passkeys_login_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Passkeys login receive class. +class PasskeysLoginReceive extends Response { + /// Initialize PasskeysLoginReceive. + const PasskeysLoginReceive({ + this.passkeysLogin, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory PasskeysLoginReceive.fromJson(Map json) => + PasskeysLoginReceive( + passkeysLogin: json['passkeys_login'] as Map?, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// Wrapper of the response. + final Map? passkeysLogin; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'passkeys_login': passkeysLogin, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + PasskeysLoginReceive copyWith({ + Map? passkeysLogin, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + PasskeysLoginReceive( + passkeysLogin: passkeysLogin ?? this.passkeysLogin, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/passkeys_login_send.dart b/lib/basic_api/generated/passkeys_login_send.dart new file mode 100644 index 0000000000..10c236eb9f --- /dev/null +++ b/lib/basic_api/generated/passkeys_login_send.dart @@ -0,0 +1,74 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/passkeys_login_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Passkeys login request class. +class PasskeysLoginRequest extends Request { + /// Initialize PasskeysLoginRequest. + const PasskeysLoginRequest({ + this.loginid, + this.passkeysLogin = true, + required this.publicKeyCredential, + super.msgType = 'passkeys_login', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory PasskeysLoginRequest.fromJson(Map json) => + PasskeysLoginRequest( + loginid: json['loginid'] as String?, + passkeysLogin: + json['passkeys_login'] == null ? null : json['passkeys_login'] == 1, + publicKeyCredential: + json['publicKeyCredential'] as Map?, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + + /// Must be `true` + final bool? passkeysLogin; + + /// The public key credential returned from the authenticator. + final Map? publicKeyCredential; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'loginid': loginid, + 'passkeys_login': passkeysLogin == null + ? null + : passkeysLogin! + ? 1 + : 0, + 'publicKeyCredential': publicKeyCredential, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + PasskeysLoginRequest copyWith({ + String? loginid, + bool? passkeysLogin, + Map? publicKeyCredential, + Map? passthrough, + int? reqId, + }) => + PasskeysLoginRequest( + loginid: loginid ?? this.loginid, + passkeysLogin: passkeysLogin ?? this.passkeysLogin, + publicKeyCredential: publicKeyCredential ?? this.publicKeyCredential, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/passkeys_options_receive.dart b/lib/basic_api/generated/passkeys_options_receive.dart new file mode 100644 index 0000000000..95f1a7f15b --- /dev/null +++ b/lib/basic_api/generated/passkeys_options_receive.dart @@ -0,0 +1,61 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/passkeys_options_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Passkeys options receive class. +class PasskeysOptionsReceive extends Response { + /// Initialize PasskeysOptionsReceive. + const PasskeysOptionsReceive({ + this.passkeysOptions, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory PasskeysOptionsReceive.fromJson(Map json) => + PasskeysOptionsReceive( + passkeysOptions: json['passkeys_options'] as Map?, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// Wrapper of the response. + final Map? passkeysOptions; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'passkeys_options': passkeysOptions, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + PasskeysOptionsReceive copyWith({ + Map? passkeysOptions, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + PasskeysOptionsReceive( + passkeysOptions: passkeysOptions ?? this.passkeysOptions, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/passkeys_options_send.dart b/lib/basic_api/generated/passkeys_options_send.dart new file mode 100644 index 0000000000..56a06b413d --- /dev/null +++ b/lib/basic_api/generated/passkeys_options_send.dart @@ -0,0 +1,74 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/passkeys_options_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Passkeys options request class. +class PasskeysOptionsRequest extends Request { + /// Initialize PasskeysOptionsRequest. + const PasskeysOptionsRequest({ + this.loginid, + this.passkeyId, + this.passkeysOptions = true, + super.msgType = 'passkeys_options', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory PasskeysOptionsRequest.fromJson(Map json) => + PasskeysOptionsRequest( + loginid: json['loginid'] as String?, + passkeyId: json['passkey_id'] as String?, + passkeysOptions: json['passkeys_options'] == null + ? null + : json['passkeys_options'] == 1, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + + /// [Optional] The id of the passkey. If left unspecified, User can use any passkey to authorize. + final String? passkeyId; + + /// Must be `true` + final bool? passkeysOptions; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'loginid': loginid, + 'passkey_id': passkeyId, + 'passkeys_options': passkeysOptions == null + ? null + : passkeysOptions! + ? 1 + : 0, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + PasskeysOptionsRequest copyWith({ + String? loginid, + String? passkeyId, + bool? passkeysOptions, + Map? passthrough, + int? reqId, + }) => + PasskeysOptionsRequest( + loginid: loginid ?? this.loginid, + passkeyId: passkeyId ?? this.passkeyId, + passkeysOptions: passkeysOptions ?? this.passkeysOptions, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/passkeys_register_options_receive.dart b/lib/basic_api/generated/passkeys_register_options_receive.dart new file mode 100644 index 0000000000..9c1a6cc1d3 --- /dev/null +++ b/lib/basic_api/generated/passkeys_register_options_receive.dart @@ -0,0 +1,63 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/passkeys_register_options_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Passkeys register options receive class. +class PasskeysRegisterOptionsReceive extends Response { + /// Initialize PasskeysRegisterOptionsReceive. + const PasskeysRegisterOptionsReceive({ + this.passkeysRegisterOptions, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory PasskeysRegisterOptionsReceive.fromJson(Map json) => + PasskeysRegisterOptionsReceive( + passkeysRegisterOptions: + json['passkeys_register_options'] as Map?, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// Wrapper of the response. + final Map? passkeysRegisterOptions; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'passkeys_register_options': passkeysRegisterOptions, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + PasskeysRegisterOptionsReceive copyWith({ + Map? passkeysRegisterOptions, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + PasskeysRegisterOptionsReceive( + passkeysRegisterOptions: + passkeysRegisterOptions ?? this.passkeysRegisterOptions, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/passkeys_register_options_send.dart b/lib/basic_api/generated/passkeys_register_options_send.dart new file mode 100644 index 0000000000..2ddb9357fc --- /dev/null +++ b/lib/basic_api/generated/passkeys_register_options_send.dart @@ -0,0 +1,67 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/passkeys_register_options_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Passkeys register options request class. +class PasskeysRegisterOptionsRequest extends Request { + /// Initialize PasskeysRegisterOptionsRequest. + const PasskeysRegisterOptionsRequest({ + this.loginid, + this.passkeysRegisterOptions = true, + super.msgType = 'passkeys_register_options', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory PasskeysRegisterOptionsRequest.fromJson(Map json) => + PasskeysRegisterOptionsRequest( + loginid: json['loginid'] as String?, + passkeysRegisterOptions: json['passkeys_register_options'] == null + ? null + : json['passkeys_register_options'] == 1, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + + /// Must be `true` + final bool? passkeysRegisterOptions; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'loginid': loginid, + 'passkeys_register_options': passkeysRegisterOptions == null + ? null + : passkeysRegisterOptions! + ? 1 + : 0, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + PasskeysRegisterOptionsRequest copyWith({ + String? loginid, + bool? passkeysRegisterOptions, + Map? passthrough, + int? reqId, + }) => + PasskeysRegisterOptionsRequest( + loginid: loginid ?? this.loginid, + passkeysRegisterOptions: + passkeysRegisterOptions ?? this.passkeysRegisterOptions, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/passkeys_register_receive.dart b/lib/basic_api/generated/passkeys_register_receive.dart new file mode 100644 index 0000000000..59adf0d2d4 --- /dev/null +++ b/lib/basic_api/generated/passkeys_register_receive.dart @@ -0,0 +1,61 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/passkeys_register_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Passkeys register receive class. +class PasskeysRegisterReceive extends Response { + /// Initialize PasskeysRegisterReceive. + const PasskeysRegisterReceive({ + this.passkeysRegister, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory PasskeysRegisterReceive.fromJson(Map json) => + PasskeysRegisterReceive( + passkeysRegister: json['passkeys_register'] as Map?, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// Wrapper of the response. + final Map? passkeysRegister; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'passkeys_register': passkeysRegister, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + PasskeysRegisterReceive copyWith({ + Map? passkeysRegister, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + PasskeysRegisterReceive( + passkeysRegister: passkeysRegister ?? this.passkeysRegister, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/passkeys_register_send.dart b/lib/basic_api/generated/passkeys_register_send.dart new file mode 100644 index 0000000000..ec996a7b2b --- /dev/null +++ b/lib/basic_api/generated/passkeys_register_send.dart @@ -0,0 +1,83 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/passkeys_register_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Passkeys register request class. +class PasskeysRegisterRequest extends Request { + /// Initialize PasskeysRegisterRequest. + const PasskeysRegisterRequest({ + this.loginid, + required this.name, + this.passkeysRegister = true, + required this.publicKeyCredential, + super.msgType = 'passkeys_register', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory PasskeysRegisterRequest.fromJson(Map json) => + PasskeysRegisterRequest( + loginid: json['loginid'] as String?, + name: json['name'] as String?, + passkeysRegister: json['passkeys_register'] == null + ? null + : json['passkeys_register'] == 1, + publicKeyCredential: + json['publicKeyCredential'] as Map?, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + + /// The name of the passkey. + final String? name; + + /// Must be `true` + final bool? passkeysRegister; + + /// The public key credential returned from the authenticator. + final Map? publicKeyCredential; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'loginid': loginid, + 'name': name, + 'passkeys_register': passkeysRegister == null + ? null + : passkeysRegister! + ? 1 + : 0, + 'publicKeyCredential': publicKeyCredential, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + PasskeysRegisterRequest copyWith({ + String? loginid, + String? name, + bool? passkeysRegister, + Map? publicKeyCredential, + Map? passthrough, + int? reqId, + }) => + PasskeysRegisterRequest( + loginid: loginid ?? this.loginid, + name: name ?? this.name, + passkeysRegister: passkeysRegister ?? this.passkeysRegister, + publicKeyCredential: publicKeyCredential ?? this.publicKeyCredential, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/passkeys_rename_receive.dart b/lib/basic_api/generated/passkeys_rename_receive.dart new file mode 100644 index 0000000000..b17d4051f0 --- /dev/null +++ b/lib/basic_api/generated/passkeys_rename_receive.dart @@ -0,0 +1,61 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/passkeys_rename_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Passkeys rename receive class. +class PasskeysRenameReceive extends Response { + /// Initialize PasskeysRenameReceive. + const PasskeysRenameReceive({ + this.passkeysRename, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory PasskeysRenameReceive.fromJson(Map json) => + PasskeysRenameReceive( + passkeysRename: json['passkeys_rename'] as int?, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// 1 on success + final int? passkeysRename; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'passkeys_rename': passkeysRename, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + PasskeysRenameReceive copyWith({ + int? passkeysRename, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + PasskeysRenameReceive( + passkeysRename: passkeysRename ?? this.passkeysRename, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/passkeys_rename_send.dart b/lib/basic_api/generated/passkeys_rename_send.dart new file mode 100644 index 0000000000..e3e464203c --- /dev/null +++ b/lib/basic_api/generated/passkeys_rename_send.dart @@ -0,0 +1,82 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/passkeys_rename_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Passkeys rename request class. +class PasskeysRenameRequest extends Request { + /// Initialize PasskeysRenameRequest. + const PasskeysRenameRequest({ + required this.id, + this.loginid, + required this.name, + this.passkeysRename = true, + super.msgType = 'passkeys_rename', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory PasskeysRenameRequest.fromJson(Map json) => + PasskeysRenameRequest( + id: json['id'] as int?, + loginid: json['loginid'] as String?, + name: json['name'] as String?, + passkeysRename: json['passkeys_rename'] == null + ? null + : json['passkeys_rename'] == 1, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// The id of the passkey to rename. + final int? id; + + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + + /// The new name of the passkey. + final String? name; + + /// Must be `true` + final bool? passkeysRename; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'id': id, + 'loginid': loginid, + 'name': name, + 'passkeys_rename': passkeysRename == null + ? null + : passkeysRename! + ? 1 + : 0, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + PasskeysRenameRequest copyWith({ + int? id, + String? loginid, + String? name, + bool? passkeysRename, + Map? passthrough, + int? reqId, + }) => + PasskeysRenameRequest( + id: id ?? this.id, + loginid: loginid ?? this.loginid, + name: name ?? this.name, + passkeysRename: passkeysRename ?? this.passkeysRename, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/passkeys_revoke_receive.dart b/lib/basic_api/generated/passkeys_revoke_receive.dart new file mode 100644 index 0000000000..1b268a9654 --- /dev/null +++ b/lib/basic_api/generated/passkeys_revoke_receive.dart @@ -0,0 +1,61 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/passkeys_revoke_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Passkeys revoke receive class. +class PasskeysRevokeReceive extends Response { + /// Initialize PasskeysRevokeReceive. + const PasskeysRevokeReceive({ + this.passkeysRevoke, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory PasskeysRevokeReceive.fromJson(Map json) => + PasskeysRevokeReceive( + passkeysRevoke: json['passkeys_revoke'] as int?, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// 1 on success + final int? passkeysRevoke; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'passkeys_revoke': passkeysRevoke, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + PasskeysRevokeReceive copyWith({ + int? passkeysRevoke, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + PasskeysRevokeReceive( + passkeysRevoke: passkeysRevoke ?? this.passkeysRevoke, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/passkeys_revoke_send.dart b/lib/basic_api/generated/passkeys_revoke_send.dart new file mode 100644 index 0000000000..ebbac29e9b --- /dev/null +++ b/lib/basic_api/generated/passkeys_revoke_send.dart @@ -0,0 +1,83 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/passkeys_revoke_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Passkeys revoke request class. +class PasskeysRevokeRequest extends Request { + /// Initialize PasskeysRevokeRequest. + const PasskeysRevokeRequest({ + required this.id, + this.loginid, + this.passkeysRevoke = true, + required this.publicKeyCredential, + super.msgType = 'passkeys_revoke', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory PasskeysRevokeRequest.fromJson(Map json) => + PasskeysRevokeRequest( + id: json['id'] as int?, + loginid: json['loginid'] as String?, + passkeysRevoke: json['passkeys_revoke'] == null + ? null + : json['passkeys_revoke'] == 1, + publicKeyCredential: + json['publicKeyCredential'] as Map?, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// The system id of the passkey. + final int? id; + + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + + /// Must be `true` + final bool? passkeysRevoke; + + /// The public key credential returned from the authenticator. + final Map? publicKeyCredential; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'id': id, + 'loginid': loginid, + 'passkeys_revoke': passkeysRevoke == null + ? null + : passkeysRevoke! + ? 1 + : 0, + 'publicKeyCredential': publicKeyCredential, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + PasskeysRevokeRequest copyWith({ + int? id, + String? loginid, + bool? passkeysRevoke, + Map? publicKeyCredential, + Map? passthrough, + int? reqId, + }) => + PasskeysRevokeRequest( + id: id ?? this.id, + loginid: loginid ?? this.loginid, + passkeysRevoke: passkeysRevoke ?? this.passkeysRevoke, + publicKeyCredential: publicKeyCredential ?? this.publicKeyCredential, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/payment_methods_receive.dart b/lib/basic_api/generated/payment_methods_receive.dart index b00f27f05d..531de2039c 100644 --- a/lib/basic_api/generated/payment_methods_receive.dart +++ b/lib/basic_api/generated/payment_methods_receive.dart @@ -9,16 +9,11 @@ class PaymentMethodsReceive extends Response { /// Initialize PaymentMethodsReceive. const PaymentMethodsReceive({ this.paymentMethods, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory PaymentMethodsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/payment_methods_send.dart b/lib/basic_api/generated/payment_methods_send.dart index 70edd97847..565fb78fa4 100644 --- a/lib/basic_api/generated/payment_methods_send.dart +++ b/lib/basic_api/generated/payment_methods_send.dart @@ -9,19 +9,18 @@ class PaymentMethodsRequest extends Request { /// Initialize PaymentMethodsRequest. const PaymentMethodsRequest({ this.country, + this.loginid, this.paymentMethods = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'payment_methods', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'payment_methods', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory PaymentMethodsRequest.fromJson(Map json) => PaymentMethodsRequest( country: json['country'] as String?, + loginid: json['loginid'] as String?, paymentMethods: json['payment_methods'] == null ? null : json['payment_methods'] == 1, @@ -32,6 +31,9 @@ class PaymentMethodsRequest extends Request { /// [Optional] 2-letter country code (ISO standard). final String? country; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? paymentMethods; @@ -39,6 +41,7 @@ class PaymentMethodsRequest extends Request { @override Map toJson() => { 'country': country, + 'loginid': loginid, 'payment_methods': paymentMethods == null ? null : paymentMethods! @@ -52,12 +55,14 @@ class PaymentMethodsRequest extends Request { @override PaymentMethodsRequest copyWith({ String? country, + String? loginid, bool? paymentMethods, Map? passthrough, int? reqId, }) => PaymentMethodsRequest( country: country ?? this.country, + loginid: loginid ?? this.loginid, paymentMethods: paymentMethods ?? this.paymentMethods, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/paymentagent_create_receive.dart b/lib/basic_api/generated/paymentagent_create_receive.dart index 079ffae924..0a8ddc7c2a 100644 --- a/lib/basic_api/generated/paymentagent_create_receive.dart +++ b/lib/basic_api/generated/paymentagent_create_receive.dart @@ -8,16 +8,11 @@ import '../response.dart'; class PaymentagentCreateReceive extends Response { /// Initialize PaymentagentCreateReceive. const PaymentagentCreateReceive({ - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory PaymentagentCreateReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/paymentagent_create_send.dart b/lib/basic_api/generated/paymentagent_create_send.dart index 20f800f526..27fb89f29a 100644 --- a/lib/basic_api/generated/paymentagent_create_send.dart +++ b/lib/basic_api/generated/paymentagent_create_send.dart @@ -14,18 +14,16 @@ class PaymentagentCreateRequest extends Request { required this.commissionWithdrawal, required this.email, this.information, + this.loginid, required this.paymentAgentName, this.paymentagentCreate = true, required this.phoneNumbers, required this.supportedPaymentMethods, required this.urls, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'paymentagent_create', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'paymentagent_create', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory PaymentagentCreateRequest.fromJson(Map json) => @@ -36,6 +34,7 @@ class PaymentagentCreateRequest extends Request { commissionWithdrawal: json['commission_withdrawal'] as num?, email: json['email'] as String?, information: json['information'] as String?, + loginid: json['loginid'] as String?, paymentAgentName: json['payment_agent_name'] as String?, paymentagentCreate: json['paymentagent_create'] == null ? null @@ -75,6 +74,9 @@ class PaymentagentCreateRequest extends Request { /// [Optional] Information about payment agent and their proposed service. final String? information; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// The name with which the payment agent is going to be identified. final String? paymentAgentName; @@ -99,6 +101,7 @@ class PaymentagentCreateRequest extends Request { 'commission_withdrawal': commissionWithdrawal, 'email': email, 'information': information, + 'loginid': loginid, 'payment_agent_name': paymentAgentName, 'paymentagent_create': paymentagentCreate == null ? null @@ -121,6 +124,7 @@ class PaymentagentCreateRequest extends Request { num? commissionWithdrawal, String? email, String? information, + String? loginid, String? paymentAgentName, bool? paymentagentCreate, List>? phoneNumbers, @@ -137,6 +141,7 @@ class PaymentagentCreateRequest extends Request { commissionWithdrawal: commissionWithdrawal ?? this.commissionWithdrawal, email: email ?? this.email, information: information ?? this.information, + loginid: loginid ?? this.loginid, paymentAgentName: paymentAgentName ?? this.paymentAgentName, paymentagentCreate: paymentagentCreate ?? this.paymentagentCreate, phoneNumbers: phoneNumbers ?? this.phoneNumbers, diff --git a/lib/basic_api/generated/paymentagent_details_receive.dart b/lib/basic_api/generated/paymentagent_details_receive.dart index 9c3be18551..49f33f61b6 100644 --- a/lib/basic_api/generated/paymentagent_details_receive.dart +++ b/lib/basic_api/generated/paymentagent_details_receive.dart @@ -9,16 +9,11 @@ class PaymentagentDetailsReceive extends Response { /// Initialize PaymentagentDetailsReceive. const PaymentagentDetailsReceive({ this.paymentagentDetails, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory PaymentagentDetailsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/paymentagent_details_send.dart b/lib/basic_api/generated/paymentagent_details_send.dart index 81ea78053f..fb47af4d76 100644 --- a/lib/basic_api/generated/paymentagent_details_send.dart +++ b/lib/basic_api/generated/paymentagent_details_send.dart @@ -8,18 +8,17 @@ import '../request.dart'; class PaymentagentDetailsRequest extends Request { /// Initialize PaymentagentDetailsRequest. const PaymentagentDetailsRequest({ + this.loginid, this.paymentagentDetails = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'paymentagent_details', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'paymentagent_details', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory PaymentagentDetailsRequest.fromJson(Map json) => PaymentagentDetailsRequest( + loginid: json['loginid'] as String?, paymentagentDetails: json['paymentagent_details'] == null ? null : json['paymentagent_details'] == 1, @@ -27,12 +26,16 @@ class PaymentagentDetailsRequest extends Request { reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? paymentagentDetails; /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'paymentagent_details': paymentagentDetails == null ? null : paymentagentDetails! @@ -45,11 +48,13 @@ class PaymentagentDetailsRequest extends Request { /// Creates a copy of instance with given parameters @override PaymentagentDetailsRequest copyWith({ + String? loginid, bool? paymentagentDetails, Map? passthrough, int? reqId, }) => PaymentagentDetailsRequest( + loginid: loginid ?? this.loginid, paymentagentDetails: paymentagentDetails ?? this.paymentagentDetails, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/paymentagent_list_receive.dart b/lib/basic_api/generated/paymentagent_list_receive.dart index c074062663..968308a1b7 100644 --- a/lib/basic_api/generated/paymentagent_list_receive.dart +++ b/lib/basic_api/generated/paymentagent_list_receive.dart @@ -9,16 +9,11 @@ class PaymentagentListReceive extends Response { /// Initialize PaymentagentListReceive. const PaymentagentListReceive({ this.paymentagentList, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory PaymentagentListReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/paymentagent_list_send.dart b/lib/basic_api/generated/paymentagent_list_send.dart index 0088ac9959..db43dd8ce2 100644 --- a/lib/basic_api/generated/paymentagent_list_send.dart +++ b/lib/basic_api/generated/paymentagent_list_send.dart @@ -9,19 +9,18 @@ class PaymentagentListRequest extends Request { /// Initialize PaymentagentListRequest. const PaymentagentListRequest({ this.currency, + this.loginid, required this.paymentagentList, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'paymentagent_list', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'paymentagent_list', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory PaymentagentListRequest.fromJson(Map json) => PaymentagentListRequest( currency: json['currency'] as String?, + loginid: json['loginid'] as String?, paymentagentList: json['paymentagent_list'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, @@ -30,6 +29,9 @@ class PaymentagentListRequest extends Request { /// [Optional] If specified, only payment agents that supports that currency will be returned (obtained from `payout_currencies` call). final String? currency; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Client's 2-letter country code (obtained from `residence_list` call). final String? paymentagentList; @@ -37,6 +39,7 @@ class PaymentagentListRequest extends Request { @override Map toJson() => { 'currency': currency, + 'loginid': loginid, 'paymentagent_list': paymentagentList, 'passthrough': passthrough, 'req_id': reqId, @@ -46,12 +49,14 @@ class PaymentagentListRequest extends Request { @override PaymentagentListRequest copyWith({ String? currency, + String? loginid, String? paymentagentList, Map? passthrough, int? reqId, }) => PaymentagentListRequest( currency: currency ?? this.currency, + loginid: loginid ?? this.loginid, paymentagentList: paymentagentList ?? this.paymentagentList, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/paymentagent_transfer_receive.dart b/lib/basic_api/generated/paymentagent_transfer_receive.dart index e6f394846b..81bf9a7635 100644 --- a/lib/basic_api/generated/paymentagent_transfer_receive.dart +++ b/lib/basic_api/generated/paymentagent_transfer_receive.dart @@ -12,16 +12,11 @@ class PaymentagentTransferReceive extends Response { this.clientToLoginid, this.paymentagentTransfer, this.transactionId, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory PaymentagentTransferReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/paymentagent_transfer_send.dart b/lib/basic_api/generated/paymentagent_transfer_send.dart index 04968b63a2..6ccc61bd4d 100644 --- a/lib/basic_api/generated/paymentagent_transfer_send.dart +++ b/lib/basic_api/generated/paymentagent_transfer_send.dart @@ -12,15 +12,13 @@ class PaymentagentTransferRequest extends Request { required this.currency, this.description, this.dryRun, + this.loginid, this.paymentagentTransfer = true, required this.transferTo, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'paymentagent_transfer', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'paymentagent_transfer', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory PaymentagentTransferRequest.fromJson(Map json) => @@ -29,6 +27,7 @@ class PaymentagentTransferRequest extends Request { currency: json['currency'] as String?, description: json['description'] as String?, dryRun: json['dry_run'] == null ? null : json['dry_run'] == 1, + loginid: json['loginid'] as String?, paymentagentTransfer: json['paymentagent_transfer'] == null ? null : json['paymentagent_transfer'] == 1, @@ -49,6 +48,9 @@ class PaymentagentTransferRequest extends Request { /// [Optional] If set to `true`, just do validation. final bool? dryRun; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? paymentagentTransfer; @@ -66,6 +68,7 @@ class PaymentagentTransferRequest extends Request { : dryRun! ? 1 : 0, + 'loginid': loginid, 'paymentagent_transfer': paymentagentTransfer == null ? null : paymentagentTransfer! @@ -83,6 +86,7 @@ class PaymentagentTransferRequest extends Request { String? currency, String? description, bool? dryRun, + String? loginid, bool? paymentagentTransfer, String? transferTo, Map? passthrough, @@ -93,6 +97,7 @@ class PaymentagentTransferRequest extends Request { currency: currency ?? this.currency, description: description ?? this.description, dryRun: dryRun ?? this.dryRun, + loginid: loginid ?? this.loginid, paymentagentTransfer: paymentagentTransfer ?? this.paymentagentTransfer, transferTo: transferTo ?? this.transferTo, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/paymentagent_withdraw_justification_receive.dart b/lib/basic_api/generated/paymentagent_withdraw_justification_receive.dart new file mode 100644 index 0000000000..0cba45caff --- /dev/null +++ b/lib/basic_api/generated/paymentagent_withdraw_justification_receive.dart @@ -0,0 +1,65 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/paymentagent_withdraw_justification_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Paymentagent withdraw justification receive class. +class PaymentagentWithdrawJustificationReceive extends Response { + /// Initialize PaymentagentWithdrawJustificationReceive. + const PaymentagentWithdrawJustificationReceive({ + this.paymentagentWithdrawJustification, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory PaymentagentWithdrawJustificationReceive.fromJson( + Map json) => + PaymentagentWithdrawJustificationReceive( + paymentagentWithdrawJustification: + json['paymentagent_withdraw_justification'] as int?, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// 1 on success + final int? paymentagentWithdrawJustification; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'paymentagent_withdraw_justification': + paymentagentWithdrawJustification, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + PaymentagentWithdrawJustificationReceive copyWith({ + int? paymentagentWithdrawJustification, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + PaymentagentWithdrawJustificationReceive( + paymentagentWithdrawJustification: paymentagentWithdrawJustification ?? + this.paymentagentWithdrawJustification, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/paymentagent_withdraw_justification_send.dart b/lib/basic_api/generated/paymentagent_withdraw_justification_send.dart new file mode 100644 index 0000000000..e7a25e9441 --- /dev/null +++ b/lib/basic_api/generated/paymentagent_withdraw_justification_send.dart @@ -0,0 +1,78 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/paymentagent_withdraw_justification_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Paymentagent withdraw justification request class. +class PaymentagentWithdrawJustificationRequest extends Request { + /// Initialize PaymentagentWithdrawJustificationRequest. + const PaymentagentWithdrawJustificationRequest({ + this.loginid, + required this.message, + this.paymentagentWithdrawJustification = true, + super.msgType = 'paymentagent_withdraw_justification', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory PaymentagentWithdrawJustificationRequest.fromJson( + Map json) => + PaymentagentWithdrawJustificationRequest( + loginid: json['loginid'] as String?, + message: json['message'] as String?, + paymentagentWithdrawJustification: + json['paymentagent_withdraw_justification'] == null + ? null + : json['paymentagent_withdraw_justification'] == 1, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + + /// Reasons for needing to withdraw using a Payment Agent. + final String? message; + + /// Must be `true` + final bool? paymentagentWithdrawJustification; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'loginid': loginid, + 'message': message, + 'paymentagent_withdraw_justification': + paymentagentWithdrawJustification == null + ? null + : paymentagentWithdrawJustification! + ? 1 + : 0, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + PaymentagentWithdrawJustificationRequest copyWith({ + String? loginid, + String? message, + bool? paymentagentWithdrawJustification, + Map? passthrough, + int? reqId, + }) => + PaymentagentWithdrawJustificationRequest( + loginid: loginid ?? this.loginid, + message: message ?? this.message, + paymentagentWithdrawJustification: paymentagentWithdrawJustification ?? + this.paymentagentWithdrawJustification, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/paymentagent_withdraw_receive.dart b/lib/basic_api/generated/paymentagent_withdraw_receive.dart index 6a65638321..1c803c51dd 100644 --- a/lib/basic_api/generated/paymentagent_withdraw_receive.dart +++ b/lib/basic_api/generated/paymentagent_withdraw_receive.dart @@ -11,16 +11,11 @@ class PaymentagentWithdrawReceive extends Response { this.paymentagentName, this.paymentagentWithdraw, this.transactionId, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory PaymentagentWithdrawReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/paymentagent_withdraw_send.dart b/lib/basic_api/generated/paymentagent_withdraw_send.dart index ec74cf13d5..de77813f3d 100644 --- a/lib/basic_api/generated/paymentagent_withdraw_send.dart +++ b/lib/basic_api/generated/paymentagent_withdraw_send.dart @@ -12,16 +12,14 @@ class PaymentagentWithdrawRequest extends Request { required this.currency, this.description, this.dryRun, + this.loginid, required this.paymentagentLoginid, this.paymentagentWithdraw = true, required this.verificationCode, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'paymentagent_withdraw', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'paymentagent_withdraw', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory PaymentagentWithdrawRequest.fromJson(Map json) => @@ -30,6 +28,7 @@ class PaymentagentWithdrawRequest extends Request { currency: json['currency'] as String?, description: json['description'] as String?, dryRun: json['dry_run'] == null ? null : json['dry_run'] == 1, + loginid: json['loginid'] as String?, paymentagentLoginid: json['paymentagent_loginid'] as String?, paymentagentWithdraw: json['paymentagent_withdraw'] == null ? null @@ -51,6 +50,9 @@ class PaymentagentWithdrawRequest extends Request { /// [Optional] If set to `true`, just do validation. final bool? dryRun; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// The payment agent loginid received from the `paymentagent_list` call. final String? paymentagentLoginid; @@ -71,6 +73,7 @@ class PaymentagentWithdrawRequest extends Request { : dryRun! ? 1 : 0, + 'loginid': loginid, 'paymentagent_loginid': paymentagentLoginid, 'paymentagent_withdraw': paymentagentWithdraw == null ? null @@ -89,6 +92,7 @@ class PaymentagentWithdrawRequest extends Request { String? currency, String? description, bool? dryRun, + String? loginid, String? paymentagentLoginid, bool? paymentagentWithdraw, String? verificationCode, @@ -100,6 +104,7 @@ class PaymentagentWithdrawRequest extends Request { currency: currency ?? this.currency, description: description ?? this.description, dryRun: dryRun ?? this.dryRun, + loginid: loginid ?? this.loginid, paymentagentLoginid: paymentagentLoginid ?? this.paymentagentLoginid, paymentagentWithdraw: paymentagentWithdraw ?? this.paymentagentWithdraw, verificationCode: verificationCode ?? this.verificationCode, diff --git a/lib/basic_api/generated/payout_currencies_receive.dart b/lib/basic_api/generated/payout_currencies_receive.dart index bd6899f89f..0b81dd312f 100644 --- a/lib/basic_api/generated/payout_currencies_receive.dart +++ b/lib/basic_api/generated/payout_currencies_receive.dart @@ -9,16 +9,11 @@ class PayoutCurrenciesReceive extends Response { /// Initialize PayoutCurrenciesReceive. const PayoutCurrenciesReceive({ this.payoutCurrencies, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory PayoutCurrenciesReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/payout_currencies_send.dart b/lib/basic_api/generated/payout_currencies_send.dart index 6eb08416f3..d26ec8c965 100644 --- a/lib/basic_api/generated/payout_currencies_send.dart +++ b/lib/basic_api/generated/payout_currencies_send.dart @@ -8,18 +8,17 @@ import '../request.dart'; class PayoutCurrenciesRequest extends Request { /// Initialize PayoutCurrenciesRequest. const PayoutCurrenciesRequest({ + this.loginid, this.payoutCurrencies = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'payout_currencies', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'payout_currencies', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory PayoutCurrenciesRequest.fromJson(Map json) => PayoutCurrenciesRequest( + loginid: json['loginid'] as String?, payoutCurrencies: json['payout_currencies'] == null ? null : json['payout_currencies'] == 1, @@ -27,12 +26,16 @@ class PayoutCurrenciesRequest extends Request { reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? payoutCurrencies; /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'payout_currencies': payoutCurrencies == null ? null : payoutCurrencies! @@ -45,11 +48,13 @@ class PayoutCurrenciesRequest extends Request { /// Creates a copy of instance with given parameters @override PayoutCurrenciesRequest copyWith({ + String? loginid, bool? payoutCurrencies, Map? passthrough, int? reqId, }) => PayoutCurrenciesRequest( + loginid: loginid ?? this.loginid, payoutCurrencies: payoutCurrencies ?? this.payoutCurrencies, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/ping_receive.dart b/lib/basic_api/generated/ping_receive.dart index 7b40d5431c..72d255de96 100644 --- a/lib/basic_api/generated/ping_receive.dart +++ b/lib/basic_api/generated/ping_receive.dart @@ -9,16 +9,11 @@ class PingReceive extends Response { /// Initialize PingReceive. const PingReceive({ this.ping, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory PingReceive.fromJson(Map json) => PingReceive( diff --git a/lib/basic_api/generated/ping_send.dart b/lib/basic_api/generated/ping_send.dart index d4b32b17e0..53607d3ccc 100644 --- a/lib/basic_api/generated/ping_send.dart +++ b/lib/basic_api/generated/ping_send.dart @@ -9,13 +9,10 @@ class PingRequest extends Request { /// Initialize PingRequest. const PingRequest({ this.ping = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'ping', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'ping', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory PingRequest.fromJson(Map json) => PingRequest( diff --git a/lib/basic_api/generated/portfolio_receive.dart b/lib/basic_api/generated/portfolio_receive.dart index 61907634d8..67577f5ff7 100644 --- a/lib/basic_api/generated/portfolio_receive.dart +++ b/lib/basic_api/generated/portfolio_receive.dart @@ -9,16 +9,11 @@ class PortfolioReceive extends Response { /// Initialize PortfolioReceive. const PortfolioReceive({ this.portfolio, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory PortfolioReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/portfolio_send.dart b/lib/basic_api/generated/portfolio_send.dart index a182f23268..57e466c821 100644 --- a/lib/basic_api/generated/portfolio_send.dart +++ b/lib/basic_api/generated/portfolio_send.dart @@ -9,14 +9,12 @@ class PortfolioRequest extends Request { /// Initialize PortfolioRequest. const PortfolioRequest({ required this.contractType, + this.loginid, this.portfolio = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'portfolio', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'portfolio', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory PortfolioRequest.fromJson(Map json) => @@ -24,6 +22,7 @@ class PortfolioRequest extends Request { contractType: (json['contract_type'] as List?) ?.map((dynamic item) => item as String) .toList(), + loginid: json['loginid'] as String?, portfolio: json['portfolio'] == null ? null : json['portfolio'] == 1, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, @@ -32,6 +31,9 @@ class PortfolioRequest extends Request { /// Return only contracts of the specified types final List? contractType; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? portfolio; @@ -39,6 +41,7 @@ class PortfolioRequest extends Request { @override Map toJson() => { 'contract_type': contractType, + 'loginid': loginid, 'portfolio': portfolio == null ? null : portfolio! @@ -52,12 +55,14 @@ class PortfolioRequest extends Request { @override PortfolioRequest copyWith({ List? contractType, + String? loginid, bool? portfolio, Map? passthrough, int? reqId, }) => PortfolioRequest( contractType: contractType ?? this.contractType, + loginid: loginid ?? this.loginid, portfolio: portfolio ?? this.portfolio, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/profit_table_receive.dart b/lib/basic_api/generated/profit_table_receive.dart index 6ccc52e1f3..3fcd56dcfd 100644 --- a/lib/basic_api/generated/profit_table_receive.dart +++ b/lib/basic_api/generated/profit_table_receive.dart @@ -9,16 +9,11 @@ class ProfitTableReceive extends Response { /// Initialize ProfitTableReceive. const ProfitTableReceive({ this.profitTable, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory ProfitTableReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/profit_table_send.dart b/lib/basic_api/generated/profit_table_send.dart index 320c128fde..97f535b682 100644 --- a/lib/basic_api/generated/profit_table_send.dart +++ b/lib/basic_api/generated/profit_table_send.dart @@ -13,6 +13,7 @@ class ProfitTableRequest extends Request { this.dateTo, this.description, this.limit, + this.loginid, this.offset, this.profitTable = true, this.sort, @@ -32,6 +33,7 @@ class ProfitTableRequest extends Request { description: json['description'] == null ? null : json['description'] == 1, limit: json['limit'] as num?, + loginid: json['loginid'] as String?, offset: json['offset'] as int?, profitTable: json['profit_table'] == null ? null : json['profit_table'] == 1, @@ -55,6 +57,9 @@ class ProfitTableRequest extends Request { /// [Optional] Apply upper limit to count of transactions received. final num? limit; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] Number of transactions to skip. final int? offset; @@ -76,6 +81,7 @@ class ProfitTableRequest extends Request { ? 1 : 0, 'limit': limit, + 'loginid': loginid, 'offset': offset, 'profit_table': profitTable == null ? null @@ -95,6 +101,7 @@ class ProfitTableRequest extends Request { String? dateTo, bool? description, num? limit, + String? loginid, int? offset, bool? profitTable, String? sort, @@ -107,6 +114,7 @@ class ProfitTableRequest extends Request { dateTo: dateTo ?? this.dateTo, description: description ?? this.description, limit: limit ?? this.limit, + loginid: loginid ?? this.loginid, offset: offset ?? this.offset, profitTable: profitTable ?? this.profitTable, sort: sort ?? this.sort, diff --git a/lib/basic_api/generated/reality_check_receive.dart b/lib/basic_api/generated/reality_check_receive.dart index a428ac9cf8..eb401defcd 100644 --- a/lib/basic_api/generated/reality_check_receive.dart +++ b/lib/basic_api/generated/reality_check_receive.dart @@ -9,16 +9,11 @@ class RealityCheckReceive extends Response { /// Initialize RealityCheckReceive. const RealityCheckReceive({ this.realityCheck, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory RealityCheckReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/reality_check_send.dart b/lib/basic_api/generated/reality_check_send.dart index 6916a93e22..5e23347ed3 100644 --- a/lib/basic_api/generated/reality_check_send.dart +++ b/lib/basic_api/generated/reality_check_send.dart @@ -8,30 +8,33 @@ import '../request.dart'; class RealityCheckRequest extends Request { /// Initialize RealityCheckRequest. const RealityCheckRequest({ + this.loginid, this.realityCheck = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'reality_check', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'reality_check', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory RealityCheckRequest.fromJson(Map json) => RealityCheckRequest( + loginid: json['loginid'] as String?, realityCheck: json['reality_check'] == null ? null : json['reality_check'] == 1, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? realityCheck; /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'reality_check': realityCheck == null ? null : realityCheck! @@ -44,11 +47,13 @@ class RealityCheckRequest extends Request { /// Creates a copy of instance with given parameters @override RealityCheckRequest copyWith({ + String? loginid, bool? realityCheck, Map? passthrough, int? reqId, }) => RealityCheckRequest( + loginid: loginid ?? this.loginid, realityCheck: realityCheck ?? this.realityCheck, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/request_report_receive.dart b/lib/basic_api/generated/request_report_receive.dart index c4dae206e1..64e3ca0a14 100644 --- a/lib/basic_api/generated/request_report_receive.dart +++ b/lib/basic_api/generated/request_report_receive.dart @@ -9,16 +9,11 @@ class RequestReportReceive extends Response { /// Initialize RequestReportReceive. const RequestReportReceive({ this.requestReport, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory RequestReportReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/request_report_send.dart b/lib/basic_api/generated/request_report_send.dart index cd163a3793..3bae882d4b 100644 --- a/lib/basic_api/generated/request_report_send.dart +++ b/lib/basic_api/generated/request_report_send.dart @@ -10,21 +10,20 @@ class RequestReportRequest extends Request { const RequestReportRequest({ required this.dateFrom, required this.dateTo, + this.loginid, required this.reportType, this.requestReport = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'request_report', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'request_report', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory RequestReportRequest.fromJson(Map json) => RequestReportRequest( dateFrom: json['date_from'] as int?, dateTo: json['date_to'] as int?, + loginid: json['loginid'] as String?, reportType: json['report_type'] as String?, requestReport: json['request_report'] == null ? null : json['request_report'] == 1, @@ -38,6 +37,9 @@ class RequestReportRequest extends Request { /// End date of the report final int? dateTo; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Type of report to be sent to client's registered e-mail address final String? reportType; @@ -49,6 +51,7 @@ class RequestReportRequest extends Request { Map toJson() => { 'date_from': dateFrom, 'date_to': dateTo, + 'loginid': loginid, 'report_type': reportType, 'request_report': requestReport == null ? null @@ -64,6 +67,7 @@ class RequestReportRequest extends Request { RequestReportRequest copyWith({ int? dateFrom, int? dateTo, + String? loginid, String? reportType, bool? requestReport, Map? passthrough, @@ -72,6 +76,7 @@ class RequestReportRequest extends Request { RequestReportRequest( dateFrom: dateFrom ?? this.dateFrom, dateTo: dateTo ?? this.dateTo, + loginid: loginid ?? this.loginid, reportType: reportType ?? this.reportType, requestReport: requestReport ?? this.requestReport, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/reset_password_receive.dart b/lib/basic_api/generated/reset_password_receive.dart index 901b6da044..6cf6019246 100644 --- a/lib/basic_api/generated/reset_password_receive.dart +++ b/lib/basic_api/generated/reset_password_receive.dart @@ -9,16 +9,11 @@ class ResetPasswordReceive extends Response { /// Initialize ResetPasswordReceive. const ResetPasswordReceive({ this.resetPassword, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory ResetPasswordReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/reset_password_send.dart b/lib/basic_api/generated/reset_password_send.dart index 00f78fda0b..81a6fedc91 100644 --- a/lib/basic_api/generated/reset_password_send.dart +++ b/lib/basic_api/generated/reset_password_send.dart @@ -8,22 +8,17 @@ import '../request.dart'; class ResetPasswordRequest extends Request { /// Initialize ResetPasswordRequest. const ResetPasswordRequest({ - this.dateOfBirth, required this.newPassword, this.resetPassword = true, required this.verificationCode, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'reset_password', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'reset_password', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory ResetPasswordRequest.fromJson(Map json) => ResetPasswordRequest( - dateOfBirth: json['date_of_birth'] as String?, newPassword: json['new_password'] as String?, resetPassword: json['reset_password'] == null ? null : json['reset_password'] == 1, @@ -32,9 +27,6 @@ class ResetPasswordRequest extends Request { reqId: json['req_id'] as int?, ); - /// [Optional] Date of birth format: `yyyy-mm-dd`. Only required for clients with real-money accounts. - final String? dateOfBirth; - /// New password. For validation (Accepts any printable ASCII character. Must be within 8-25 characters, and include numbers, lowercase and uppercase letters. Must not be the same as the user's email address). final String? newPassword; @@ -47,7 +39,6 @@ class ResetPasswordRequest extends Request { /// Converts this instance to JSON @override Map toJson() => { - 'date_of_birth': dateOfBirth, 'new_password': newPassword, 'reset_password': resetPassword == null ? null @@ -62,7 +53,6 @@ class ResetPasswordRequest extends Request { /// Creates a copy of instance with given parameters @override ResetPasswordRequest copyWith({ - String? dateOfBirth, String? newPassword, bool? resetPassword, String? verificationCode, @@ -70,7 +60,6 @@ class ResetPasswordRequest extends Request { int? reqId, }) => ResetPasswordRequest( - dateOfBirth: dateOfBirth ?? this.dateOfBirth, newPassword: newPassword ?? this.newPassword, resetPassword: resetPassword ?? this.resetPassword, verificationCode: verificationCode ?? this.verificationCode, diff --git a/lib/basic_api/generated/residence_list_receive.dart b/lib/basic_api/generated/residence_list_receive.dart index 3ac828cf59..46bb4c2ef9 100644 --- a/lib/basic_api/generated/residence_list_receive.dart +++ b/lib/basic_api/generated/residence_list_receive.dart @@ -9,16 +9,11 @@ class ResidenceListReceive extends Response { /// Initialize ResidenceListReceive. const ResidenceListReceive({ this.residenceList, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory ResidenceListReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/residence_list_send.dart b/lib/basic_api/generated/residence_list_send.dart index aedaba44fa..95d3b05a96 100644 --- a/lib/basic_api/generated/residence_list_send.dart +++ b/lib/basic_api/generated/residence_list_send.dart @@ -9,13 +9,10 @@ class ResidenceListRequest extends Request { /// Initialize ResidenceListRequest. const ResidenceListRequest({ this.residenceList = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'residence_list', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'residence_list', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory ResidenceListRequest.fromJson(Map json) => diff --git a/lib/basic_api/generated/revoke_oauth_app_receive.dart b/lib/basic_api/generated/revoke_oauth_app_receive.dart index 1c851d2772..74048aaefc 100644 --- a/lib/basic_api/generated/revoke_oauth_app_receive.dart +++ b/lib/basic_api/generated/revoke_oauth_app_receive.dart @@ -9,16 +9,11 @@ class RevokeOauthAppReceive extends Response { /// Initialize RevokeOauthAppReceive. const RevokeOauthAppReceive({ this.revokeOauthApp, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory RevokeOauthAppReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/revoke_oauth_app_send.dart b/lib/basic_api/generated/revoke_oauth_app_send.dart index adf6d4f0ad..255244c533 100644 --- a/lib/basic_api/generated/revoke_oauth_app_send.dart +++ b/lib/basic_api/generated/revoke_oauth_app_send.dart @@ -8,29 +8,32 @@ import '../request.dart'; class RevokeOauthAppRequest extends Request { /// Initialize RevokeOauthAppRequest. const RevokeOauthAppRequest({ + this.loginid, required this.revokeOauthApp, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'revoke_oauth_app', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'revoke_oauth_app', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory RevokeOauthAppRequest.fromJson(Map json) => RevokeOauthAppRequest( + loginid: json['loginid'] as String?, revokeOauthApp: json['revoke_oauth_app'] as int?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// The application ID to revoke. final int? revokeOauthApp; /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'revoke_oauth_app': revokeOauthApp, 'passthrough': passthrough, 'req_id': reqId, @@ -39,11 +42,13 @@ class RevokeOauthAppRequest extends Request { /// Creates a copy of instance with given parameters @override RevokeOauthAppRequest copyWith({ + String? loginid, int? revokeOauthApp, Map? passthrough, int? reqId, }) => RevokeOauthAppRequest( + loginid: loginid ?? this.loginid, revokeOauthApp: revokeOauthApp ?? this.revokeOauthApp, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/sell_contract_for_multiple_accounts_receive.dart b/lib/basic_api/generated/sell_contract_for_multiple_accounts_receive.dart index 056c326f0e..bb62dbb4d8 100644 --- a/lib/basic_api/generated/sell_contract_for_multiple_accounts_receive.dart +++ b/lib/basic_api/generated/sell_contract_for_multiple_accounts_receive.dart @@ -9,16 +9,11 @@ class SellContractForMultipleAccountsReceive extends Response { /// Initialize SellContractForMultipleAccountsReceive. const SellContractForMultipleAccountsReceive({ this.sellContractForMultipleAccounts, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory SellContractForMultipleAccountsReceive.fromJson( diff --git a/lib/basic_api/generated/sell_contract_for_multiple_accounts_send.dart b/lib/basic_api/generated/sell_contract_for_multiple_accounts_send.dart index 1382c22841..6c7223b799 100644 --- a/lib/basic_api/generated/sell_contract_for_multiple_accounts_send.dart +++ b/lib/basic_api/generated/sell_contract_for_multiple_accounts_send.dart @@ -8,22 +8,21 @@ import '../request.dart'; class SellContractForMultipleAccountsRequest extends Request { /// Initialize SellContractForMultipleAccountsRequest. const SellContractForMultipleAccountsRequest({ + this.loginid, required this.price, this.sellContractForMultipleAccounts = true, required this.shortcode, required this.tokens, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'sell_contract_for_multiple_accounts', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'sell_contract_for_multiple_accounts', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory SellContractForMultipleAccountsRequest.fromJson( Map json) => SellContractForMultipleAccountsRequest( + loginid: json['loginid'] as String?, price: json['price'] as num?, sellContractForMultipleAccounts: json['sell_contract_for_multiple_accounts'] == null @@ -37,6 +36,9 @@ class SellContractForMultipleAccountsRequest extends Request { reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Minimum price at which to sell the contract, or `0` for 'sell at market'. final num? price; @@ -52,6 +54,7 @@ class SellContractForMultipleAccountsRequest extends Request { /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'price': price, 'sell_contract_for_multiple_accounts': sellContractForMultipleAccounts == null @@ -68,6 +71,7 @@ class SellContractForMultipleAccountsRequest extends Request { /// Creates a copy of instance with given parameters @override SellContractForMultipleAccountsRequest copyWith({ + String? loginid, num? price, bool? sellContractForMultipleAccounts, String? shortcode, @@ -76,6 +80,7 @@ class SellContractForMultipleAccountsRequest extends Request { int? reqId, }) => SellContractForMultipleAccountsRequest( + loginid: loginid ?? this.loginid, price: price ?? this.price, sellContractForMultipleAccounts: sellContractForMultipleAccounts ?? this.sellContractForMultipleAccounts, diff --git a/lib/basic_api/generated/sell_expired_receive.dart b/lib/basic_api/generated/sell_expired_receive.dart index 9347c6cc5a..d478535e99 100644 --- a/lib/basic_api/generated/sell_expired_receive.dart +++ b/lib/basic_api/generated/sell_expired_receive.dart @@ -9,16 +9,11 @@ class SellExpiredReceive extends Response { /// Initialize SellExpiredReceive. const SellExpiredReceive({ this.sellExpired, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory SellExpiredReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/sell_expired_send.dart b/lib/basic_api/generated/sell_expired_send.dart index c14d8e339a..80181ed2a3 100644 --- a/lib/basic_api/generated/sell_expired_send.dart +++ b/lib/basic_api/generated/sell_expired_send.dart @@ -8,30 +8,33 @@ import '../request.dart'; class SellExpiredRequest extends Request { /// Initialize SellExpiredRequest. const SellExpiredRequest({ + this.loginid, this.sellExpired = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'sell_expired', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'sell_expired', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory SellExpiredRequest.fromJson(Map json) => SellExpiredRequest( + loginid: json['loginid'] as String?, sellExpired: json['sell_expired'] == null ? null : json['sell_expired'] == 1, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? sellExpired; /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'sell_expired': sellExpired == null ? null : sellExpired! @@ -44,11 +47,13 @@ class SellExpiredRequest extends Request { /// Creates a copy of instance with given parameters @override SellExpiredRequest copyWith({ + String? loginid, bool? sellExpired, Map? passthrough, int? reqId, }) => SellExpiredRequest( + loginid: loginid ?? this.loginid, sellExpired: sellExpired ?? this.sellExpired, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/sell_receive.dart b/lib/basic_api/generated/sell_receive.dart index 515e8c8b99..dbbfbf59de 100644 --- a/lib/basic_api/generated/sell_receive.dart +++ b/lib/basic_api/generated/sell_receive.dart @@ -9,16 +9,11 @@ class SellReceive extends Response { /// Initialize SellReceive. const SellReceive({ this.sell, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory SellReceive.fromJson(Map json) => SellReceive( diff --git a/lib/basic_api/generated/sell_send.dart b/lib/basic_api/generated/sell_send.dart index dc5238a6b5..04f7aed6fa 100644 --- a/lib/basic_api/generated/sell_send.dart +++ b/lib/basic_api/generated/sell_send.dart @@ -8,24 +8,26 @@ import '../request.dart'; class SellRequest extends Request { /// Initialize SellRequest. const SellRequest({ + this.loginid, required this.price, required this.sell, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'sell', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'sell', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory SellRequest.fromJson(Map json) => SellRequest( + loginid: json['loginid'] as String?, price: json['price'] as num?, sell: json['sell'] as int?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Minimum price at which to sell the contract, or `0` for 'sell at market'. final num? price; @@ -35,6 +37,7 @@ class SellRequest extends Request { /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'price': price, 'sell': sell, 'passthrough': passthrough, @@ -44,12 +47,14 @@ class SellRequest extends Request { /// Creates a copy of instance with given parameters @override SellRequest copyWith({ + String? loginid, num? price, int? sell, Map? passthrough, int? reqId, }) => SellRequest( + loginid: loginid ?? this.loginid, price: price ?? this.price, sell: sell ?? this.sell, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/service_token_receive.dart b/lib/basic_api/generated/service_token_receive.dart index 5bfe359fc3..a89b1a3c6a 100644 --- a/lib/basic_api/generated/service_token_receive.dart +++ b/lib/basic_api/generated/service_token_receive.dart @@ -9,16 +9,11 @@ class ServiceTokenReceive extends Response { /// Initialize ServiceTokenReceive. const ServiceTokenReceive({ this.serviceToken, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory ServiceTokenReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/service_token_send.dart b/lib/basic_api/generated/service_token_send.dart index 5ac18e1e8e..3e7945c98b 100644 --- a/lib/basic_api/generated/service_token_send.dart +++ b/lib/basic_api/generated/service_token_send.dart @@ -9,22 +9,21 @@ class ServiceTokenRequest extends Request { /// Initialize ServiceTokenRequest. const ServiceTokenRequest({ this.country, + this.loginid, this.referrer, required this.server, this.service, this.serviceToken = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'service_token', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'service_token', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory ServiceTokenRequest.fromJson(Map json) => ServiceTokenRequest( country: json['country'] as String?, + loginid: json['loginid'] as String?, referrer: json['referrer'] as String?, server: json['server'] as String?, service: json['service'] as dynamic, @@ -37,6 +36,9 @@ class ServiceTokenRequest extends Request { /// [Optional] The 2-letter country code. final String? country; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] The URL of the web page where the Web SDK will be used. final String? referrer; @@ -53,6 +55,7 @@ class ServiceTokenRequest extends Request { @override Map toJson() => { 'country': country, + 'loginid': loginid, 'referrer': referrer, 'server': server, 'service': service, @@ -69,6 +72,7 @@ class ServiceTokenRequest extends Request { @override ServiceTokenRequest copyWith({ String? country, + String? loginid, String? referrer, String? server, dynamic service, @@ -78,6 +82,7 @@ class ServiceTokenRequest extends Request { }) => ServiceTokenRequest( country: country ?? this.country, + loginid: loginid ?? this.loginid, referrer: referrer ?? this.referrer, server: server ?? this.server, service: service ?? this.service, diff --git a/lib/basic_api/generated/set_account_currency_receive.dart b/lib/basic_api/generated/set_account_currency_receive.dart index 0fa1d345ad..a18b533ba6 100644 --- a/lib/basic_api/generated/set_account_currency_receive.dart +++ b/lib/basic_api/generated/set_account_currency_receive.dart @@ -9,16 +9,11 @@ class SetAccountCurrencyReceive extends Response { /// Initialize SetAccountCurrencyReceive. const SetAccountCurrencyReceive({ this.setAccountCurrency, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory SetAccountCurrencyReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/set_account_currency_send.dart b/lib/basic_api/generated/set_account_currency_send.dart index 8af82dd196..de08e67d4d 100644 --- a/lib/basic_api/generated/set_account_currency_send.dart +++ b/lib/basic_api/generated/set_account_currency_send.dart @@ -8,29 +8,32 @@ import '../request.dart'; class SetAccountCurrencyRequest extends Request { /// Initialize SetAccountCurrencyRequest. const SetAccountCurrencyRequest({ + this.loginid, required this.setAccountCurrency, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'set_account_currency', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'set_account_currency', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory SetAccountCurrencyRequest.fromJson(Map json) => SetAccountCurrencyRequest( + loginid: json['loginid'] as String?, setAccountCurrency: json['set_account_currency'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Currency of the account. List of supported currencies can be acquired with `payout_currencies` call. final String? setAccountCurrency; /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'set_account_currency': setAccountCurrency, 'passthrough': passthrough, 'req_id': reqId, @@ -39,11 +42,13 @@ class SetAccountCurrencyRequest extends Request { /// Creates a copy of instance with given parameters @override SetAccountCurrencyRequest copyWith({ + String? loginid, String? setAccountCurrency, Map? passthrough, int? reqId, }) => SetAccountCurrencyRequest( + loginid: loginid ?? this.loginid, setAccountCurrency: setAccountCurrency ?? this.setAccountCurrency, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/set_financial_assessment_receive.dart b/lib/basic_api/generated/set_financial_assessment_receive.dart index b2cdf2339b..67f299cb58 100644 --- a/lib/basic_api/generated/set_financial_assessment_receive.dart +++ b/lib/basic_api/generated/set_financial_assessment_receive.dart @@ -9,16 +9,11 @@ class SetFinancialAssessmentReceive extends Response { /// Initialize SetFinancialAssessmentReceive. const SetFinancialAssessmentReceive({ this.setFinancialAssessment, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory SetFinancialAssessmentReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/set_financial_assessment_send.dart b/lib/basic_api/generated/set_financial_assessment_send.dart index 8dbbb81d7e..4d2bdae329 100644 --- a/lib/basic_api/generated/set_financial_assessment_send.dart +++ b/lib/basic_api/generated/set_financial_assessment_send.dart @@ -13,26 +13,27 @@ class SetFinancialAssessmentRequest extends Request { this.binaryOptionsTradingFrequency, this.cfdTradingExperience, this.cfdTradingFrequency, - required this.educationLevel, - required this.employmentIndustry, + this.educationLevel, + this.employmentIndustry, this.employmentStatus, - required this.estimatedWorth, + this.estimatedWorth, + this.financialInformation, this.forexTradingExperience, this.forexTradingFrequency, - required this.incomeSource, - required this.netIncome, - required this.occupation, + this.incomeSource, + this.loginid, + this.netIncome, + this.occupation, this.otherInstrumentsTradingExperience, this.otherInstrumentsTradingFrequency, this.setFinancialAssessment = true, this.sourceOfWealth, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'set_financial_assessment', - passthrough: passthrough, - reqId: reqId, - ); + this.tradingExperience, + this.tradingExperienceRegulated, + super.msgType = 'set_financial_assessment', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory SetFinancialAssessmentRequest.fromJson(Map json) => @@ -48,9 +49,12 @@ class SetFinancialAssessmentRequest extends Request { employmentIndustry: json['employment_industry'] as String?, employmentStatus: json['employment_status'] as String?, estimatedWorth: json['estimated_worth'] as String?, + financialInformation: + json['financial_information'] as Map?, forexTradingExperience: json['forex_trading_experience'] as String?, forexTradingFrequency: json['forex_trading_frequency'] as String?, incomeSource: json['income_source'] as String?, + loginid: json['loginid'] as String?, netIncome: json['net_income'] as String?, occupation: json['occupation'] as String?, otherInstrumentsTradingExperience: @@ -61,6 +65,9 @@ class SetFinancialAssessmentRequest extends Request { ? null : json['set_financial_assessment'] == 1, sourceOfWealth: json['source_of_wealth'] as String?, + tradingExperience: json['trading_experience'] as Map?, + tradingExperienceRegulated: + json['trading_experience_regulated'] as Map?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); @@ -80,31 +87,37 @@ class SetFinancialAssessmentRequest extends Request { /// [Optional] CFDs trading frequency. final String? cfdTradingFrequency; - /// Level of Education. + /// [Optional] Level of Education. final String? educationLevel; - /// Industry of Employment. + /// [Optional] Industry of Employment. final String? employmentIndustry; /// [Optional] Employment Status. final String? employmentStatus; - /// Estimated Net Worth. + /// [Optional] Estimated Net Worth. final String? estimatedWorth; + /// [Optional] The financial information of a client + final Map? financialInformation; + /// [Optional] Forex trading experience. final String? forexTradingExperience; /// [Optional] Forex trading frequency. final String? forexTradingFrequency; - /// Income Source. + /// [Optional] Income Source. final String? incomeSource; - /// Net Annual Income. + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + + /// [Optional] Net Annual Income. final String? netIncome; - /// Occupation. + /// [Optional] Occupation. final String? occupation; /// [Optional] Trading experience in other financial instruments. @@ -119,6 +132,12 @@ class SetFinancialAssessmentRequest extends Request { /// [Optional] Source of wealth. final String? sourceOfWealth; + /// [Optional] The trading experience of a client + final Map? tradingExperience; + + /// [Optional] The trading experience of a `maltainvest` client + final Map? tradingExperienceRegulated; + /// Converts this instance to JSON @override Map toJson() => { @@ -131,9 +150,11 @@ class SetFinancialAssessmentRequest extends Request { 'employment_industry': employmentIndustry, 'employment_status': employmentStatus, 'estimated_worth': estimatedWorth, + 'financial_information': financialInformation, 'forex_trading_experience': forexTradingExperience, 'forex_trading_frequency': forexTradingFrequency, 'income_source': incomeSource, + 'loginid': loginid, 'net_income': netIncome, 'occupation': occupation, 'other_instruments_trading_experience': @@ -145,6 +166,8 @@ class SetFinancialAssessmentRequest extends Request { ? 1 : 0, 'source_of_wealth': sourceOfWealth, + 'trading_experience': tradingExperience, + 'trading_experience_regulated': tradingExperienceRegulated, 'passthrough': passthrough, 'req_id': reqId, }; @@ -161,15 +184,19 @@ class SetFinancialAssessmentRequest extends Request { String? employmentIndustry, String? employmentStatus, String? estimatedWorth, + Map? financialInformation, String? forexTradingExperience, String? forexTradingFrequency, String? incomeSource, + String? loginid, String? netIncome, String? occupation, String? otherInstrumentsTradingExperience, String? otherInstrumentsTradingFrequency, bool? setFinancialAssessment, String? sourceOfWealth, + Map? tradingExperience, + Map? tradingExperienceRegulated, Map? passthrough, int? reqId, }) => @@ -185,11 +212,13 @@ class SetFinancialAssessmentRequest extends Request { employmentIndustry: employmentIndustry ?? this.employmentIndustry, employmentStatus: employmentStatus ?? this.employmentStatus, estimatedWorth: estimatedWorth ?? this.estimatedWorth, + financialInformation: financialInformation ?? this.financialInformation, forexTradingExperience: forexTradingExperience ?? this.forexTradingExperience, forexTradingFrequency: forexTradingFrequency ?? this.forexTradingFrequency, incomeSource: incomeSource ?? this.incomeSource, + loginid: loginid ?? this.loginid, netIncome: netIncome ?? this.netIncome, occupation: occupation ?? this.occupation, otherInstrumentsTradingExperience: otherInstrumentsTradingExperience ?? @@ -199,6 +228,9 @@ class SetFinancialAssessmentRequest extends Request { setFinancialAssessment: setFinancialAssessment ?? this.setFinancialAssessment, sourceOfWealth: sourceOfWealth ?? this.sourceOfWealth, + tradingExperience: tradingExperience ?? this.tradingExperience, + tradingExperienceRegulated: + tradingExperienceRegulated ?? this.tradingExperienceRegulated, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, ); diff --git a/lib/basic_api/generated/set_self_exclusion_receive.dart b/lib/basic_api/generated/set_self_exclusion_receive.dart index 617a38758a..21edf7c4ef 100644 --- a/lib/basic_api/generated/set_self_exclusion_receive.dart +++ b/lib/basic_api/generated/set_self_exclusion_receive.dart @@ -9,16 +9,11 @@ class SetSelfExclusionReceive extends Response { /// Initialize SetSelfExclusionReceive. const SetSelfExclusionReceive({ this.setSelfExclusion, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory SetSelfExclusionReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/set_self_exclusion_send.dart b/lib/basic_api/generated/set_self_exclusion_send.dart index 3c27172936..991d896b41 100644 --- a/lib/basic_api/generated/set_self_exclusion_send.dart +++ b/lib/basic_api/generated/set_self_exclusion_send.dart @@ -9,6 +9,7 @@ class SetSelfExclusionRequest extends Request { /// Initialize SetSelfExclusionRequest. const SetSelfExclusionRequest({ this.excludeUntil, + this.loginid, this.max30dayDeposit, this.max30dayLosses, this.max30dayTurnover, @@ -23,18 +24,16 @@ class SetSelfExclusionRequest extends Request { this.sessionDurationLimit, this.setSelfExclusion = true, this.timeoutUntil, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'set_self_exclusion', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'set_self_exclusion', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory SetSelfExclusionRequest.fromJson(Map json) => SetSelfExclusionRequest( excludeUntil: json['exclude_until'] as String?, + loginid: json['loginid'] as String?, max30dayDeposit: json['max_30day_deposit'] as num?, max30dayLosses: json['max_30day_losses'] as num?, max30dayTurnover: json['max_30day_turnover'] as num?, @@ -58,6 +57,9 @@ class SetSelfExclusionRequest extends Request { /// [Optional] Exclude me from the website (for a minimum of 6 months, up to a maximum of 5 years). Note: uplifting this self-exclusion may require contacting the company. final String? excludeUntil; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] 7-day limit on deposits. final num? max30dayDeposit; @@ -104,6 +106,7 @@ class SetSelfExclusionRequest extends Request { @override Map toJson() => { 'exclude_until': excludeUntil, + 'loginid': loginid, 'max_30day_deposit': max30dayDeposit, 'max_30day_losses': max30dayLosses, 'max_30day_turnover': max30dayTurnover, @@ -130,6 +133,7 @@ class SetSelfExclusionRequest extends Request { @override SetSelfExclusionRequest copyWith({ String? excludeUntil, + String? loginid, num? max30dayDeposit, num? max30dayLosses, num? max30dayTurnover, @@ -149,6 +153,7 @@ class SetSelfExclusionRequest extends Request { }) => SetSelfExclusionRequest( excludeUntil: excludeUntil ?? this.excludeUntil, + loginid: loginid ?? this.loginid, max30dayDeposit: max30dayDeposit ?? this.max30dayDeposit, max30dayLosses: max30dayLosses ?? this.max30dayLosses, max30dayTurnover: max30dayTurnover ?? this.max30dayTurnover, diff --git a/lib/basic_api/generated/set_settings_send.dart b/lib/basic_api/generated/set_settings_send.dart index 80a8e2fad9..f6554a1df5 100644 --- a/lib/basic_api/generated/set_settings_send.dart +++ b/lib/basic_api/generated/set_settings_send.dart @@ -17,12 +17,13 @@ class SetSettingsRequest extends Request { this.allowCopiers, this.citizen, this.dateOfBirth, - this.dxtradeUserException, + required this.dxtradeUserException, this.emailConsent, this.employmentStatus, this.featureFlag, this.firstName, this.lastName, + this.loginid, this.nonPepDeclaration, this.phone, this.placeOfBirth, @@ -63,6 +64,7 @@ class SetSettingsRequest extends Request { featureFlag: json['feature_flag'] as Map?, firstName: json['first_name'] as String?, lastName: json['last_name'] as String?, + loginid: json['loginid'] as String?, nonPepDeclaration: json['non_pep_declaration'] as int?, phone: json['phone'] as String?, placeOfBirth: json['place_of_birth'] as String?, @@ -127,6 +129,9 @@ class SetSettingsRequest extends Request { /// [Optional] Within 2-50 characters, use only letters, spaces, hyphens, full-stops or apostrophes (can only be changed on unauthenticated svg accounts). final String? lastName; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] Indicates client's self-declaration of not being a PEP/RCA (Politically Exposed Person/Relatives and Close Associates). Effective for real accounts only. final int? nonPepDeclaration; @@ -196,6 +201,7 @@ class SetSettingsRequest extends Request { 'feature_flag': featureFlag, 'first_name': firstName, 'last_name': lastName, + 'loginid': loginid, 'non_pep_declaration': nonPepDeclaration, 'phone': phone, 'place_of_birth': placeOfBirth, @@ -239,6 +245,7 @@ class SetSettingsRequest extends Request { Map? featureFlag, String? firstName, String? lastName, + String? loginid, int? nonPepDeclaration, String? phone, String? placeOfBirth, @@ -271,6 +278,7 @@ class SetSettingsRequest extends Request { featureFlag: featureFlag ?? this.featureFlag, firstName: firstName ?? this.firstName, lastName: lastName ?? this.lastName, + loginid: loginid ?? this.loginid, nonPepDeclaration: nonPepDeclaration ?? this.nonPepDeclaration, phone: phone ?? this.phone, placeOfBirth: placeOfBirth ?? this.placeOfBirth, diff --git a/lib/basic_api/generated/statement_send.dart b/lib/basic_api/generated/statement_send.dart index 55b84bbef6..93d0e3655e 100644 --- a/lib/basic_api/generated/statement_send.dart +++ b/lib/basic_api/generated/statement_send.dart @@ -13,6 +13,7 @@ class StatementRequest extends Request { this.dateTo, this.description, this.limit, + this.loginid, this.offset, this.statement = true, super.msgType = 'statement', @@ -29,6 +30,7 @@ class StatementRequest extends Request { description: json['description'] == null ? null : json['description'] == 1, limit: json['limit'] as num?, + loginid: json['loginid'] as String?, offset: json['offset'] as int?, statement: json['statement'] == null ? null : json['statement'] == 1, passthrough: json['passthrough'] as Map?, @@ -50,6 +52,9 @@ class StatementRequest extends Request { /// [Optional] Maximum number of transactions to receive. final num? limit; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] Number of transactions to skip. final int? offset; @@ -68,6 +73,7 @@ class StatementRequest extends Request { ? 1 : 0, 'limit': limit, + 'loginid': loginid, 'offset': offset, 'statement': statement == null ? null @@ -86,6 +92,7 @@ class StatementRequest extends Request { int? dateTo, bool? description, num? limit, + String? loginid, int? offset, bool? statement, Map? passthrough, @@ -97,6 +104,7 @@ class StatementRequest extends Request { dateTo: dateTo ?? this.dateTo, description: description ?? this.description, limit: limit ?? this.limit, + loginid: loginid ?? this.loginid, offset: offset ?? this.offset, statement: statement ?? this.statement, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/states_list_receive.dart b/lib/basic_api/generated/states_list_receive.dart index 88f4a83a4b..98557811d5 100644 --- a/lib/basic_api/generated/states_list_receive.dart +++ b/lib/basic_api/generated/states_list_receive.dart @@ -9,16 +9,11 @@ class StatesListReceive extends Response { /// Initialize StatesListReceive. const StatesListReceive({ this.statesList, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory StatesListReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/states_list_send.dart b/lib/basic_api/generated/states_list_send.dart index 9745bc5223..cdecebde40 100644 --- a/lib/basic_api/generated/states_list_send.dart +++ b/lib/basic_api/generated/states_list_send.dart @@ -9,13 +9,10 @@ class StatesListRequest extends Request { /// Initialize StatesListRequest. const StatesListRequest({ required this.statesList, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'states_list', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'states_list', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory StatesListRequest.fromJson(Map json) => diff --git a/lib/basic_api/generated/ticks_history_receive.dart b/lib/basic_api/generated/ticks_history_receive.dart index c633d67b1b..6ec43ec4e9 100644 --- a/lib/basic_api/generated/ticks_history_receive.dart +++ b/lib/basic_api/generated/ticks_history_receive.dart @@ -12,16 +12,11 @@ class TicksHistoryReceive extends Response { this.history, this.pipSize, this.subscription, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TicksHistoryReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/ticks_history_send.dart b/lib/basic_api/generated/ticks_history_send.dart index 88922e5abf..d8ab9a8b34 100644 --- a/lib/basic_api/generated/ticks_history_send.dart +++ b/lib/basic_api/generated/ticks_history_send.dart @@ -16,13 +16,10 @@ class TicksHistoryRequest extends Request { this.style, this.subscribe, required this.ticksHistory, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'ticks_history', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'ticks_history', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TicksHistoryRequest.fromJson(Map json) => diff --git a/lib/basic_api/generated/ticks_receive.dart b/lib/basic_api/generated/ticks_receive.dart index 5090d495b2..fd1bc1577c 100644 --- a/lib/basic_api/generated/ticks_receive.dart +++ b/lib/basic_api/generated/ticks_receive.dart @@ -10,16 +10,11 @@ class TicksReceive extends Response { const TicksReceive({ this.subscription, this.tick, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TicksReceive.fromJson(Map json) => TicksReceive( diff --git a/lib/basic_api/generated/ticks_send.dart b/lib/basic_api/generated/ticks_send.dart index c08a630d95..0122d2f72e 100644 --- a/lib/basic_api/generated/ticks_send.dart +++ b/lib/basic_api/generated/ticks_send.dart @@ -10,13 +10,10 @@ class TicksRequest extends Request { const TicksRequest({ this.subscribe, this.ticks, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'ticks', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'ticks', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TicksRequest.fromJson(Map json) => TicksRequest( diff --git a/lib/basic_api/generated/time_receive.dart b/lib/basic_api/generated/time_receive.dart index beab6f0658..f750db59bb 100644 --- a/lib/basic_api/generated/time_receive.dart +++ b/lib/basic_api/generated/time_receive.dart @@ -9,16 +9,11 @@ class TimeReceive extends Response { /// Initialize TimeReceive. const TimeReceive({ this.time, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TimeReceive.fromJson(Map json) => TimeReceive( diff --git a/lib/basic_api/generated/time_send.dart b/lib/basic_api/generated/time_send.dart index 106894db86..c1649cb811 100644 --- a/lib/basic_api/generated/time_send.dart +++ b/lib/basic_api/generated/time_send.dart @@ -9,13 +9,10 @@ class TimeRequest extends Request { /// Initialize TimeRequest. const TimeRequest({ this.time = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'time', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'time', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TimeRequest.fromJson(Map json) => TimeRequest( diff --git a/lib/basic_api/generated/tnc_approval_receive.dart b/lib/basic_api/generated/tnc_approval_receive.dart index 24b32f38c7..dbea7777ba 100644 --- a/lib/basic_api/generated/tnc_approval_receive.dart +++ b/lib/basic_api/generated/tnc_approval_receive.dart @@ -9,16 +9,11 @@ class TncApprovalReceive extends Response { /// Initialize TncApprovalReceive. const TncApprovalReceive({ this.tncApproval, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TncApprovalReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/tnc_approval_send.dart b/lib/basic_api/generated/tnc_approval_send.dart index 265c8ef7fd..30379bd1c9 100644 --- a/lib/basic_api/generated/tnc_approval_send.dart +++ b/lib/basic_api/generated/tnc_approval_send.dart @@ -9,20 +9,19 @@ class TncApprovalRequest extends Request { /// Initialize TncApprovalRequest. const TncApprovalRequest({ this.affiliateCocAgreement, + this.loginid, this.tncApproval = true, this.ukgcFundsProtection, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'tnc_approval', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'tnc_approval', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TncApprovalRequest.fromJson(Map json) => TncApprovalRequest( affiliateCocAgreement: json['affiliate_coc_agreement'] as int?, + loginid: json['loginid'] as String?, tncApproval: json['tnc_approval'] == null ? null : json['tnc_approval'] == 1, ukgcFundsProtection: json['ukgc_funds_protection'] as int?, @@ -33,6 +32,9 @@ class TncApprovalRequest extends Request { /// [Optional] For Affiliate's Code of Conduct Agreement. final int? affiliateCocAgreement; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? tncApproval; @@ -43,6 +45,7 @@ class TncApprovalRequest extends Request { @override Map toJson() => { 'affiliate_coc_agreement': affiliateCocAgreement, + 'loginid': loginid, 'tnc_approval': tncApproval == null ? null : tncApproval! @@ -57,6 +60,7 @@ class TncApprovalRequest extends Request { @override TncApprovalRequest copyWith({ int? affiliateCocAgreement, + String? loginid, bool? tncApproval, int? ukgcFundsProtection, Map? passthrough, @@ -65,6 +69,7 @@ class TncApprovalRequest extends Request { TncApprovalRequest( affiliateCocAgreement: affiliateCocAgreement ?? this.affiliateCocAgreement, + loginid: loginid ?? this.loginid, tncApproval: tncApproval ?? this.tncApproval, ukgcFundsProtection: ukgcFundsProtection ?? this.ukgcFundsProtection, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/topup_virtual_receive.dart b/lib/basic_api/generated/topup_virtual_receive.dart index a82bd3ad4b..966c255191 100644 --- a/lib/basic_api/generated/topup_virtual_receive.dart +++ b/lib/basic_api/generated/topup_virtual_receive.dart @@ -9,16 +9,11 @@ class TopupVirtualReceive extends Response { /// Initialize TopupVirtualReceive. const TopupVirtualReceive({ this.topupVirtual, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TopupVirtualReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/topup_virtual_send.dart b/lib/basic_api/generated/topup_virtual_send.dart index ccf4edfa78..489e37c48c 100644 --- a/lib/basic_api/generated/topup_virtual_send.dart +++ b/lib/basic_api/generated/topup_virtual_send.dart @@ -8,30 +8,33 @@ import '../request.dart'; class TopupVirtualRequest extends Request { /// Initialize TopupVirtualRequest. const TopupVirtualRequest({ + this.loginid, this.topupVirtual = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'topup_virtual', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'topup_virtual', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TopupVirtualRequest.fromJson(Map json) => TopupVirtualRequest( + loginid: json['loginid'] as String?, topupVirtual: json['topup_virtual'] == null ? null : json['topup_virtual'] == 1, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? topupVirtual; /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'topup_virtual': topupVirtual == null ? null : topupVirtual! @@ -44,11 +47,13 @@ class TopupVirtualRequest extends Request { /// Creates a copy of instance with given parameters @override TopupVirtualRequest copyWith({ + String? loginid, bool? topupVirtual, Map? passthrough, int? reqId, }) => TopupVirtualRequest( + loginid: loginid ?? this.loginid, topupVirtual: topupVirtual ?? this.topupVirtual, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/trading_durations_send.dart b/lib/basic_api/generated/trading_durations_send.dart index 2d6fe41186..1fda7dc560 100644 --- a/lib/basic_api/generated/trading_durations_send.dart +++ b/lib/basic_api/generated/trading_durations_send.dart @@ -10,6 +10,7 @@ class TradingDurationsRequest extends Request { const TradingDurationsRequest({ required this.landingCompany, this.landingCompanyShort, + this.loginid, this.tradingDurations = true, super.msgType = 'trading_durations', super.passthrough, @@ -21,6 +22,7 @@ class TradingDurationsRequest extends Request { TradingDurationsRequest( landingCompany: json['landing_company'] as String?, landingCompanyShort: json['landing_company_short'] as String?, + loginid: json['loginid'] as String?, tradingDurations: json['trading_durations'] == null ? null : json['trading_durations'] == 1, @@ -34,6 +36,9 @@ class TradingDurationsRequest extends Request { /// [Optional] If specified, will return only the underlyings for the specified landing company. final String? landingCompanyShort; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Must be `true` final bool? tradingDurations; @@ -42,6 +47,7 @@ class TradingDurationsRequest extends Request { Map toJson() => { 'landing_company': landingCompany, 'landing_company_short': landingCompanyShort, + 'loginid': loginid, 'trading_durations': tradingDurations == null ? null : tradingDurations! @@ -56,6 +62,7 @@ class TradingDurationsRequest extends Request { TradingDurationsRequest copyWith({ String? landingCompany, String? landingCompanyShort, + String? loginid, bool? tradingDurations, Map? passthrough, int? reqId, @@ -63,6 +70,7 @@ class TradingDurationsRequest extends Request { TradingDurationsRequest( landingCompany: landingCompany ?? this.landingCompany, landingCompanyShort: landingCompanyShort ?? this.landingCompanyShort, + loginid: loginid ?? this.loginid, tradingDurations: tradingDurations ?? this.tradingDurations, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/trading_platform_accounts_receive.dart b/lib/basic_api/generated/trading_platform_accounts_receive.dart index 6db5f4fcb1..1664bf5373 100644 --- a/lib/basic_api/generated/trading_platform_accounts_receive.dart +++ b/lib/basic_api/generated/trading_platform_accounts_receive.dart @@ -9,16 +9,11 @@ class TradingPlatformAccountsReceive extends Response { /// Initialize TradingPlatformAccountsReceive. const TradingPlatformAccountsReceive({ this.tradingPlatformAccounts, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformAccountsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/trading_platform_accounts_send.dart b/lib/basic_api/generated/trading_platform_accounts_send.dart index c31ea81910..78b3330b9d 100644 --- a/lib/basic_api/generated/trading_platform_accounts_send.dart +++ b/lib/basic_api/generated/trading_platform_accounts_send.dart @@ -8,19 +8,18 @@ import '../request.dart'; class TradingPlatformAccountsRequest extends Request { /// Initialize TradingPlatformAccountsRequest. const TradingPlatformAccountsRequest({ + this.loginid, required this.platform, this.tradingPlatformAccounts = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'trading_platform_accounts', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'trading_platform_accounts', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformAccountsRequest.fromJson(Map json) => TradingPlatformAccountsRequest( + loginid: json['loginid'] as String?, platform: json['platform'] as String?, tradingPlatformAccounts: json['trading_platform_accounts'] == null ? null @@ -29,6 +28,9 @@ class TradingPlatformAccountsRequest extends Request { reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Trading platform name final String? platform; @@ -38,6 +40,7 @@ class TradingPlatformAccountsRequest extends Request { /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'platform': platform, 'trading_platform_accounts': tradingPlatformAccounts == null ? null @@ -51,12 +54,14 @@ class TradingPlatformAccountsRequest extends Request { /// Creates a copy of instance with given parameters @override TradingPlatformAccountsRequest copyWith({ + String? loginid, String? platform, bool? tradingPlatformAccounts, Map? passthrough, int? reqId, }) => TradingPlatformAccountsRequest( + loginid: loginid ?? this.loginid, platform: platform ?? this.platform, tradingPlatformAccounts: tradingPlatformAccounts ?? this.tradingPlatformAccounts, diff --git a/lib/basic_api/generated/trading_platform_asset_listing_send.dart b/lib/basic_api/generated/trading_platform_asset_listing_send.dart index 36d781b2b8..f28d410188 100644 --- a/lib/basic_api/generated/trading_platform_asset_listing_send.dart +++ b/lib/basic_api/generated/trading_platform_asset_listing_send.dart @@ -8,6 +8,7 @@ import '../request.dart'; class TradingPlatformAssetListingRequest extends Request { /// Initialize TradingPlatformAssetListingRequest. const TradingPlatformAssetListingRequest({ + this.loginid, required this.platform, required this.region, this.subscribe, @@ -22,6 +23,7 @@ class TradingPlatformAssetListingRequest extends Request { factory TradingPlatformAssetListingRequest.fromJson( Map json) => TradingPlatformAssetListingRequest( + loginid: json['loginid'] as String?, platform: json['platform'] as String?, region: json['region'] as String?, subscribe: json['subscribe'] == null ? null : json['subscribe'] == 1, @@ -34,6 +36,9 @@ class TradingPlatformAssetListingRequest extends Request { reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Trading platform name final String? platform; @@ -52,6 +57,7 @@ class TradingPlatformAssetListingRequest extends Request { /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'platform': platform, 'region': region, 'subscribe': subscribe == null @@ -72,6 +78,7 @@ class TradingPlatformAssetListingRequest extends Request { /// Creates a copy of instance with given parameters @override TradingPlatformAssetListingRequest copyWith({ + String? loginid, String? platform, String? region, bool? subscribe, @@ -81,6 +88,7 @@ class TradingPlatformAssetListingRequest extends Request { int? reqId, }) => TradingPlatformAssetListingRequest( + loginid: loginid ?? this.loginid, platform: platform ?? this.platform, region: region ?? this.region, subscribe: subscribe ?? this.subscribe, diff --git a/lib/basic_api/generated/trading_platform_available_accounts_receive.dart b/lib/basic_api/generated/trading_platform_available_accounts_receive.dart index c1d3394cc6..e4f8379dd7 100644 --- a/lib/basic_api/generated/trading_platform_available_accounts_receive.dart +++ b/lib/basic_api/generated/trading_platform_available_accounts_receive.dart @@ -9,16 +9,11 @@ class TradingPlatformAvailableAccountsReceive extends Response { /// Initialize TradingPlatformAvailableAccountsReceive. const TradingPlatformAvailableAccountsReceive({ this.tradingPlatformAvailableAccounts, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformAvailableAccountsReceive.fromJson( diff --git a/lib/basic_api/generated/trading_platform_available_accounts_send.dart b/lib/basic_api/generated/trading_platform_available_accounts_send.dart index 677f23babc..82bfa6ef9d 100644 --- a/lib/basic_api/generated/trading_platform_available_accounts_send.dart +++ b/lib/basic_api/generated/trading_platform_available_accounts_send.dart @@ -8,20 +8,19 @@ import '../request.dart'; class TradingPlatformAvailableAccountsRequest extends Request { /// Initialize TradingPlatformAvailableAccountsRequest. const TradingPlatformAvailableAccountsRequest({ + this.loginid, required this.platform, this.tradingPlatformAvailableAccounts = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'trading_platform_available_accounts', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'trading_platform_available_accounts', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformAvailableAccountsRequest.fromJson( Map json) => TradingPlatformAvailableAccountsRequest( + loginid: json['loginid'] as String?, platform: json['platform'] as String?, tradingPlatformAvailableAccounts: json['trading_platform_available_accounts'] == null @@ -31,6 +30,9 @@ class TradingPlatformAvailableAccountsRequest extends Request { reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Name of trading platform. final String? platform; @@ -40,6 +42,7 @@ class TradingPlatformAvailableAccountsRequest extends Request { /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'platform': platform, 'trading_platform_available_accounts': tradingPlatformAvailableAccounts == null @@ -54,12 +57,14 @@ class TradingPlatformAvailableAccountsRequest extends Request { /// Creates a copy of instance with given parameters @override TradingPlatformAvailableAccountsRequest copyWith({ + String? loginid, String? platform, bool? tradingPlatformAvailableAccounts, Map? passthrough, int? reqId, }) => TradingPlatformAvailableAccountsRequest( + loginid: loginid ?? this.loginid, platform: platform ?? this.platform, tradingPlatformAvailableAccounts: tradingPlatformAvailableAccounts ?? this.tradingPlatformAvailableAccounts, diff --git a/lib/basic_api/generated/trading_platform_deposit_receive.dart b/lib/basic_api/generated/trading_platform_deposit_receive.dart index 8b6e875f27..4b7449b43b 100644 --- a/lib/basic_api/generated/trading_platform_deposit_receive.dart +++ b/lib/basic_api/generated/trading_platform_deposit_receive.dart @@ -9,16 +9,11 @@ class TradingPlatformDepositReceive extends Response { /// Initialize TradingPlatformDepositReceive. const TradingPlatformDepositReceive({ this.tradingPlatformDeposit, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformDepositReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/trading_platform_deposit_send.dart b/lib/basic_api/generated/trading_platform_deposit_send.dart index f45fa7819b..b71eae71b8 100644 --- a/lib/basic_api/generated/trading_platform_deposit_send.dart +++ b/lib/basic_api/generated/trading_platform_deposit_send.dart @@ -10,22 +10,21 @@ class TradingPlatformDepositRequest extends Request { const TradingPlatformDepositRequest({ required this.amount, required this.fromAccount, + this.loginid, required this.platform, required this.toAccount, this.tradingPlatformDeposit = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'trading_platform_deposit', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'trading_platform_deposit', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformDepositRequest.fromJson(Map json) => TradingPlatformDepositRequest( amount: json['amount'] as num?, fromAccount: json['from_account'] as String?, + loginid: json['loginid'] as String?, platform: json['platform'] as String?, toAccount: json['to_account'] as String?, tradingPlatformDeposit: json['trading_platform_deposit'] == null @@ -41,6 +40,9 @@ class TradingPlatformDepositRequest extends Request { /// Wallet account to transfer money from. final String? fromAccount; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Name of trading platform. final String? platform; @@ -55,6 +57,7 @@ class TradingPlatformDepositRequest extends Request { Map toJson() => { 'amount': amount, 'from_account': fromAccount, + 'loginid': loginid, 'platform': platform, 'to_account': toAccount, 'trading_platform_deposit': tradingPlatformDeposit == null @@ -71,6 +74,7 @@ class TradingPlatformDepositRequest extends Request { TradingPlatformDepositRequest copyWith({ num? amount, String? fromAccount, + String? loginid, String? platform, String? toAccount, bool? tradingPlatformDeposit, @@ -80,6 +84,7 @@ class TradingPlatformDepositRequest extends Request { TradingPlatformDepositRequest( amount: amount ?? this.amount, fromAccount: fromAccount ?? this.fromAccount, + loginid: loginid ?? this.loginid, platform: platform ?? this.platform, toAccount: toAccount ?? this.toAccount, tradingPlatformDeposit: diff --git a/lib/basic_api/generated/trading_platform_investor_password_change_receive.dart b/lib/basic_api/generated/trading_platform_investor_password_change_receive.dart index 59ef6bb1d0..373d839147 100644 --- a/lib/basic_api/generated/trading_platform_investor_password_change_receive.dart +++ b/lib/basic_api/generated/trading_platform_investor_password_change_receive.dart @@ -9,16 +9,11 @@ class TradingPlatformInvestorPasswordChangeReceive extends Response { /// Initialize TradingPlatformInvestorPasswordChangeReceive. const TradingPlatformInvestorPasswordChangeReceive({ this.tradingPlatformPasswordChange, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformInvestorPasswordChangeReceive.fromJson( diff --git a/lib/basic_api/generated/trading_platform_investor_password_change_send.dart b/lib/basic_api/generated/trading_platform_investor_password_change_send.dart index 758f7349ab..09f598e194 100644 --- a/lib/basic_api/generated/trading_platform_investor_password_change_send.dart +++ b/lib/basic_api/generated/trading_platform_investor_password_change_send.dart @@ -9,6 +9,7 @@ class TradingPlatformInvestorPasswordChangeRequest extends Request { /// Initialize TradingPlatformInvestorPasswordChangeRequest. const TradingPlatformInvestorPasswordChangeRequest({ required this.accountId, + this.loginid, required this.newPassword, required this.oldPassword, required this.platform, @@ -23,6 +24,7 @@ class TradingPlatformInvestorPasswordChangeRequest extends Request { Map json) => TradingPlatformInvestorPasswordChangeRequest( accountId: json['account_id'] as String?, + loginid: json['loginid'] as String?, newPassword: json['new_password'] as String?, oldPassword: json['old_password'] as String?, platform: json['platform'] as String?, @@ -37,6 +39,9 @@ class TradingPlatformInvestorPasswordChangeRequest extends Request { /// Trading account ID. final String? accountId; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// New investor password. Accepts any printable ASCII character. Must be within 8-25 characters, and include numbers, lowercase and uppercase letters. Must not be the same as the user's email address. final String? newPassword; @@ -53,6 +58,7 @@ class TradingPlatformInvestorPasswordChangeRequest extends Request { @override Map toJson() => { 'account_id': accountId, + 'loginid': loginid, 'new_password': newPassword, 'old_password': oldPassword, 'platform': platform, @@ -70,6 +76,7 @@ class TradingPlatformInvestorPasswordChangeRequest extends Request { @override TradingPlatformInvestorPasswordChangeRequest copyWith({ String? accountId, + String? loginid, String? newPassword, String? oldPassword, String? platform, @@ -79,6 +86,7 @@ class TradingPlatformInvestorPasswordChangeRequest extends Request { }) => TradingPlatformInvestorPasswordChangeRequest( accountId: accountId ?? this.accountId, + loginid: loginid ?? this.loginid, newPassword: newPassword ?? this.newPassword, oldPassword: oldPassword ?? this.oldPassword, platform: platform ?? this.platform, diff --git a/lib/basic_api/generated/trading_platform_investor_password_reset_receive.dart b/lib/basic_api/generated/trading_platform_investor_password_reset_receive.dart index 91258987e1..dcb3b59e80 100644 --- a/lib/basic_api/generated/trading_platform_investor_password_reset_receive.dart +++ b/lib/basic_api/generated/trading_platform_investor_password_reset_receive.dart @@ -9,16 +9,11 @@ class TradingPlatformInvestorPasswordResetReceive extends Response { /// Initialize TradingPlatformInvestorPasswordResetReceive. const TradingPlatformInvestorPasswordResetReceive({ this.tradingPlatformPasswordReset, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformInvestorPasswordResetReceive.fromJson( diff --git a/lib/basic_api/generated/trading_platform_investor_password_reset_send.dart b/lib/basic_api/generated/trading_platform_investor_password_reset_send.dart index a531757b00..b23f90a44b 100644 --- a/lib/basic_api/generated/trading_platform_investor_password_reset_send.dart +++ b/lib/basic_api/generated/trading_platform_investor_password_reset_send.dart @@ -9,23 +9,22 @@ class TradingPlatformInvestorPasswordResetRequest extends Request { /// Initialize TradingPlatformInvestorPasswordResetRequest. const TradingPlatformInvestorPasswordResetRequest({ required this.accountId, + this.loginid, required this.newPassword, required this.platform, this.tradingPlatformInvestorPasswordReset = true, required this.verificationCode, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'trading_platform_investor_password_reset', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'trading_platform_investor_password_reset', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformInvestorPasswordResetRequest.fromJson( Map json) => TradingPlatformInvestorPasswordResetRequest( accountId: json['account_id'] as String?, + loginid: json['loginid'] as String?, newPassword: json['new_password'] as String?, platform: json['platform'] as String?, tradingPlatformInvestorPasswordReset: @@ -40,6 +39,9 @@ class TradingPlatformInvestorPasswordResetRequest extends Request { /// Trading account ID. final String? accountId; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// New password of the account. For validation (Accepts any printable ASCII character. Must be within 8-25 characters, and include numbers, lowercase and uppercase letters. Must not be the same as the user's email address). final String? newPassword; @@ -56,6 +58,7 @@ class TradingPlatformInvestorPasswordResetRequest extends Request { @override Map toJson() => { 'account_id': accountId, + 'loginid': loginid, 'new_password': newPassword, 'platform': platform, 'trading_platform_investor_password_reset': @@ -73,6 +76,7 @@ class TradingPlatformInvestorPasswordResetRequest extends Request { @override TradingPlatformInvestorPasswordResetRequest copyWith({ String? accountId, + String? loginid, String? newPassword, String? platform, bool? tradingPlatformInvestorPasswordReset, @@ -82,6 +86,7 @@ class TradingPlatformInvestorPasswordResetRequest extends Request { }) => TradingPlatformInvestorPasswordResetRequest( accountId: accountId ?? this.accountId, + loginid: loginid ?? this.loginid, newPassword: newPassword ?? this.newPassword, platform: platform ?? this.platform, tradingPlatformInvestorPasswordReset: diff --git a/lib/basic_api/generated/trading_platform_leverage_receive.dart b/lib/basic_api/generated/trading_platform_leverage_receive.dart new file mode 100644 index 0000000000..db6da79bb2 --- /dev/null +++ b/lib/basic_api/generated/trading_platform_leverage_receive.dart @@ -0,0 +1,63 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/trading_platform_leverage_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Trading platform leverage receive class. +class TradingPlatformLeverageReceive extends Response { + /// Initialize TradingPlatformLeverageReceive. + const TradingPlatformLeverageReceive({ + this.tradingPlatformLeverage, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory TradingPlatformLeverageReceive.fromJson(Map json) => + TradingPlatformLeverageReceive( + tradingPlatformLeverage: + json['trading_platform_leverage'] as Map?, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// Information for dynamic leverage for the requested trading platform + final Map? tradingPlatformLeverage; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'trading_platform_leverage': tradingPlatformLeverage, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + TradingPlatformLeverageReceive copyWith({ + Map? tradingPlatformLeverage, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + TradingPlatformLeverageReceive( + tradingPlatformLeverage: + tradingPlatformLeverage ?? this.tradingPlatformLeverage, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/trading_platform_leverage_send.dart b/lib/basic_api/generated/trading_platform_leverage_send.dart new file mode 100644 index 0000000000..f08c2b2695 --- /dev/null +++ b/lib/basic_api/generated/trading_platform_leverage_send.dart @@ -0,0 +1,67 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/trading_platform_leverage_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Trading platform leverage request class. +class TradingPlatformLeverageRequest extends Request { + /// Initialize TradingPlatformLeverageRequest. + const TradingPlatformLeverageRequest({ + required this.platform, + this.tradingPlatformLeverage = true, + super.msgType = 'trading_platform_leverage', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory TradingPlatformLeverageRequest.fromJson(Map json) => + TradingPlatformLeverageRequest( + platform: json['platform'] as String?, + tradingPlatformLeverage: json['trading_platform_leverage'] == null + ? null + : json['trading_platform_leverage'] == 1, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// Name of trading platform. + final String? platform; + + /// Must be `true` + final bool? tradingPlatformLeverage; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'platform': platform, + 'trading_platform_leverage': tradingPlatformLeverage == null + ? null + : tradingPlatformLeverage! + ? 1 + : 0, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + TradingPlatformLeverageRequest copyWith({ + String? platform, + bool? tradingPlatformLeverage, + Map? passthrough, + int? reqId, + }) => + TradingPlatformLeverageRequest( + platform: platform ?? this.platform, + tradingPlatformLeverage: + tradingPlatformLeverage ?? this.tradingPlatformLeverage, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/trading_platform_new_account_send.dart b/lib/basic_api/generated/trading_platform_new_account_send.dart index bdd7904c45..ea58baee37 100644 --- a/lib/basic_api/generated/trading_platform_new_account_send.dart +++ b/lib/basic_api/generated/trading_platform_new_account_send.dart @@ -12,8 +12,9 @@ class TradingPlatformNewAccountRequest extends Request { this.company, this.currency, this.dryRun, + this.loginid, required this.marketType, - this.password, + required this.password, required this.platform, this.subAccountType, this.tradingPlatformNewAccount = true, @@ -30,6 +31,7 @@ class TradingPlatformNewAccountRequest extends Request { company: json['company'] as String?, currency: json['currency'] as String?, dryRun: json['dry_run'] == null ? null : json['dry_run'] == 1, + loginid: json['loginid'] as String?, marketType: json['market_type'] as String?, password: json['password'] as String?, platform: json['platform'] as String?, @@ -53,6 +55,9 @@ class TradingPlatformNewAccountRequest extends Request { /// [Optional] If set to `true`, only validation is performed. final bool? dryRun; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Market type final String? marketType; @@ -79,6 +84,7 @@ class TradingPlatformNewAccountRequest extends Request { : dryRun! ? 1 : 0, + 'loginid': loginid, 'market_type': marketType, 'password': password, 'platform': platform, @@ -99,6 +105,7 @@ class TradingPlatformNewAccountRequest extends Request { String? company, String? currency, bool? dryRun, + String? loginid, String? marketType, String? password, String? platform, @@ -112,6 +119,7 @@ class TradingPlatformNewAccountRequest extends Request { company: company ?? this.company, currency: currency ?? this.currency, dryRun: dryRun ?? this.dryRun, + loginid: loginid ?? this.loginid, marketType: marketType ?? this.marketType, password: password ?? this.password, platform: platform ?? this.platform, diff --git a/lib/basic_api/generated/trading_platform_password_change_receive.dart b/lib/basic_api/generated/trading_platform_password_change_receive.dart index e9da250af7..b4e6c3b54b 100644 --- a/lib/basic_api/generated/trading_platform_password_change_receive.dart +++ b/lib/basic_api/generated/trading_platform_password_change_receive.dart @@ -9,16 +9,11 @@ class TradingPlatformPasswordChangeReceive extends Response { /// Initialize TradingPlatformPasswordChangeReceive. const TradingPlatformPasswordChangeReceive({ this.tradingPlatformPasswordChange, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformPasswordChangeReceive.fromJson( diff --git a/lib/basic_api/generated/trading_platform_password_change_send.dart b/lib/basic_api/generated/trading_platform_password_change_send.dart index 29a00e7b8c..03ce516295 100644 --- a/lib/basic_api/generated/trading_platform_password_change_send.dart +++ b/lib/basic_api/generated/trading_platform_password_change_send.dart @@ -8,22 +8,21 @@ import '../request.dart'; class TradingPlatformPasswordChangeRequest extends Request { /// Initialize TradingPlatformPasswordChangeRequest. const TradingPlatformPasswordChangeRequest({ + this.loginid, required this.newPassword, required this.oldPassword, required this.platform, this.tradingPlatformPasswordChange = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'trading_platform_password_change', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'trading_platform_password_change', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformPasswordChangeRequest.fromJson( Map json) => TradingPlatformPasswordChangeRequest( + loginid: json['loginid'] as String?, newPassword: json['new_password'] as String?, oldPassword: json['old_password'] as String?, platform: json['platform'] as String?, @@ -35,6 +34,9 @@ class TradingPlatformPasswordChangeRequest extends Request { reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// New trading password. Accepts any printable ASCII character. Must be within 8-25 characters, and include numbers, lowercase and uppercase letters. Must not be the same as the user's email address. final String? newPassword; @@ -50,6 +52,7 @@ class TradingPlatformPasswordChangeRequest extends Request { /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'new_password': newPassword, 'old_password': oldPassword, 'platform': platform, @@ -66,6 +69,7 @@ class TradingPlatformPasswordChangeRequest extends Request { /// Creates a copy of instance with given parameters @override TradingPlatformPasswordChangeRequest copyWith({ + String? loginid, String? newPassword, String? oldPassword, String? platform, @@ -74,6 +78,7 @@ class TradingPlatformPasswordChangeRequest extends Request { int? reqId, }) => TradingPlatformPasswordChangeRequest( + loginid: loginid ?? this.loginid, newPassword: newPassword ?? this.newPassword, oldPassword: oldPassword ?? this.oldPassword, platform: platform ?? this.platform, diff --git a/lib/basic_api/generated/trading_platform_password_reset_receive.dart b/lib/basic_api/generated/trading_platform_password_reset_receive.dart index d823d92859..a588f7a888 100644 --- a/lib/basic_api/generated/trading_platform_password_reset_receive.dart +++ b/lib/basic_api/generated/trading_platform_password_reset_receive.dart @@ -9,16 +9,11 @@ class TradingPlatformPasswordResetReceive extends Response { /// Initialize TradingPlatformPasswordResetReceive. const TradingPlatformPasswordResetReceive({ this.tradingPlatformPasswordReset, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformPasswordResetReceive.fromJson( diff --git a/lib/basic_api/generated/trading_platform_password_reset_send.dart b/lib/basic_api/generated/trading_platform_password_reset_send.dart index c0f6409703..ff7680f679 100644 --- a/lib/basic_api/generated/trading_platform_password_reset_send.dart +++ b/lib/basic_api/generated/trading_platform_password_reset_send.dart @@ -8,22 +8,21 @@ import '../request.dart'; class TradingPlatformPasswordResetRequest extends Request { /// Initialize TradingPlatformPasswordResetRequest. const TradingPlatformPasswordResetRequest({ + this.loginid, required this.newPassword, required this.platform, this.tradingPlatformPasswordReset = true, required this.verificationCode, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'trading_platform_password_reset', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'trading_platform_password_reset', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformPasswordResetRequest.fromJson( Map json) => TradingPlatformPasswordResetRequest( + loginid: json['loginid'] as String?, newPassword: json['new_password'] as String?, platform: json['platform'] as String?, tradingPlatformPasswordReset: @@ -35,6 +34,9 @@ class TradingPlatformPasswordResetRequest extends Request { reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// New password of the account. For validation (Accepts any printable ASCII character. Must be within 8-25 characters, and include numbers, lowercase and uppercase letters. Must not be the same as the user's email address). final String? newPassword; @@ -50,6 +52,7 @@ class TradingPlatformPasswordResetRequest extends Request { /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'new_password': newPassword, 'platform': platform, 'trading_platform_password_reset': tradingPlatformPasswordReset == null @@ -65,6 +68,7 @@ class TradingPlatformPasswordResetRequest extends Request { /// Creates a copy of instance with given parameters @override TradingPlatformPasswordResetRequest copyWith({ + String? loginid, String? newPassword, String? platform, bool? tradingPlatformPasswordReset, @@ -73,6 +77,7 @@ class TradingPlatformPasswordResetRequest extends Request { int? reqId, }) => TradingPlatformPasswordResetRequest( + loginid: loginid ?? this.loginid, newPassword: newPassword ?? this.newPassword, platform: platform ?? this.platform, tradingPlatformPasswordReset: diff --git a/lib/basic_api/generated/trading_platform_product_listing_receive.dart b/lib/basic_api/generated/trading_platform_product_listing_receive.dart index c7aef84618..2a48a8763d 100644 --- a/lib/basic_api/generated/trading_platform_product_listing_receive.dart +++ b/lib/basic_api/generated/trading_platform_product_listing_receive.dart @@ -9,16 +9,11 @@ class TradingPlatformProductListingReceive extends Response { /// Initialize TradingPlatformProductListingReceive. const TradingPlatformProductListingReceive({ this.tradingPlatformProductListing, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformProductListingReceive.fromJson( diff --git a/lib/basic_api/generated/trading_platform_product_listing_send.dart b/lib/basic_api/generated/trading_platform_product_listing_send.dart index 53a58d61fb..af69a29333 100644 --- a/lib/basic_api/generated/trading_platform_product_listing_send.dart +++ b/lib/basic_api/generated/trading_platform_product_listing_send.dart @@ -11,13 +11,10 @@ class TradingPlatformProductListingRequest extends Request { this.appId, required this.countryCode, this.tradingPlatformProductListing = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'trading_platform_product_listing', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'trading_platform_product_listing', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformProductListingRequest.fromJson( diff --git a/lib/basic_api/generated/trading_platform_withdrawal_receive.dart b/lib/basic_api/generated/trading_platform_withdrawal_receive.dart index 5c1865a2dc..0664a7d59b 100644 --- a/lib/basic_api/generated/trading_platform_withdrawal_receive.dart +++ b/lib/basic_api/generated/trading_platform_withdrawal_receive.dart @@ -9,16 +9,11 @@ class TradingPlatformWithdrawalReceive extends Response { /// Initialize TradingPlatformWithdrawalReceive. const TradingPlatformWithdrawalReceive({ this.tradingPlatformWithdrawal, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformWithdrawalReceive.fromJson( diff --git a/lib/basic_api/generated/trading_platform_withdrawal_send.dart b/lib/basic_api/generated/trading_platform_withdrawal_send.dart index 1af0d3a14d..4e1770751c 100644 --- a/lib/basic_api/generated/trading_platform_withdrawal_send.dart +++ b/lib/basic_api/generated/trading_platform_withdrawal_send.dart @@ -10,16 +10,14 @@ class TradingPlatformWithdrawalRequest extends Request { const TradingPlatformWithdrawalRequest({ required this.amount, required this.fromAccount, + this.loginid, required this.platform, required this.toAccount, this.tradingPlatformWithdrawal = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'trading_platform_withdrawal', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'trading_platform_withdrawal', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TradingPlatformWithdrawalRequest.fromJson( @@ -27,6 +25,7 @@ class TradingPlatformWithdrawalRequest extends Request { TradingPlatformWithdrawalRequest( amount: json['amount'] as num?, fromAccount: json['from_account'] as String?, + loginid: json['loginid'] as String?, platform: json['platform'] as String?, toAccount: json['to_account'] as String?, tradingPlatformWithdrawal: json['trading_platform_withdrawal'] == null @@ -42,6 +41,9 @@ class TradingPlatformWithdrawalRequest extends Request { /// Trading account login to withdraw money from. final String? fromAccount; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Name of trading platform. final String? platform; @@ -56,6 +58,7 @@ class TradingPlatformWithdrawalRequest extends Request { Map toJson() => { 'amount': amount, 'from_account': fromAccount, + 'loginid': loginid, 'platform': platform, 'to_account': toAccount, 'trading_platform_withdrawal': tradingPlatformWithdrawal == null @@ -72,6 +75,7 @@ class TradingPlatformWithdrawalRequest extends Request { TradingPlatformWithdrawalRequest copyWith({ num? amount, String? fromAccount, + String? loginid, String? platform, String? toAccount, bool? tradingPlatformWithdrawal, @@ -81,6 +85,7 @@ class TradingPlatformWithdrawalRequest extends Request { TradingPlatformWithdrawalRequest( amount: amount ?? this.amount, fromAccount: fromAccount ?? this.fromAccount, + loginid: loginid ?? this.loginid, platform: platform ?? this.platform, toAccount: toAccount ?? this.toAccount, tradingPlatformWithdrawal: diff --git a/lib/basic_api/generated/trading_servers_receive.dart b/lib/basic_api/generated/trading_servers_receive.dart index 6a9056e8c9..c6bd965b1b 100644 --- a/lib/basic_api/generated/trading_servers_receive.dart +++ b/lib/basic_api/generated/trading_servers_receive.dart @@ -9,16 +9,11 @@ class TradingServersReceive extends Response { /// Initialize TradingServersReceive. const TradingServersReceive({ this.tradingServers, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TradingServersReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/trading_servers_send.dart b/lib/basic_api/generated/trading_servers_send.dart index a914d1621b..c0f4f1ffbd 100644 --- a/lib/basic_api/generated/trading_servers_send.dart +++ b/lib/basic_api/generated/trading_servers_send.dart @@ -10,22 +10,21 @@ class TradingServersRequest extends Request { const TradingServersRequest({ this.accountType, this.environment, + this.loginid, this.marketType, this.platform, this.tradingServers = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'trading_servers', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'trading_servers', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TradingServersRequest.fromJson(Map json) => TradingServersRequest( accountType: json['account_type'] as String?, environment: json['environment'] as String?, + loginid: json['loginid'] as String?, marketType: json['market_type'] as String?, platform: json['platform'] as String?, tradingServers: json['trading_servers'] == null @@ -41,6 +40,9 @@ class TradingServersRequest extends Request { /// [Optional] Pass the environment (installation) instance. Currently, there are one demo and two real environments. Defaults to 'all'. final String? environment; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// [Optional] Market type. final String? marketType; @@ -55,6 +57,7 @@ class TradingServersRequest extends Request { Map toJson() => { 'account_type': accountType, 'environment': environment, + 'loginid': loginid, 'market_type': marketType, 'platform': platform, 'trading_servers': tradingServers == null @@ -71,6 +74,7 @@ class TradingServersRequest extends Request { TradingServersRequest copyWith({ String? accountType, String? environment, + String? loginid, String? marketType, String? platform, bool? tradingServers, @@ -80,6 +84,7 @@ class TradingServersRequest extends Request { TradingServersRequest( accountType: accountType ?? this.accountType, environment: environment ?? this.environment, + loginid: loginid ?? this.loginid, marketType: marketType ?? this.marketType, platform: platform ?? this.platform, tradingServers: tradingServers ?? this.tradingServers, diff --git a/lib/basic_api/generated/trading_times_receive.dart b/lib/basic_api/generated/trading_times_receive.dart index f25f046697..f10112f9ad 100644 --- a/lib/basic_api/generated/trading_times_receive.dart +++ b/lib/basic_api/generated/trading_times_receive.dart @@ -9,16 +9,11 @@ class TradingTimesReceive extends Response { /// Initialize TradingTimesReceive. const TradingTimesReceive({ this.tradingTimes, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TradingTimesReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/trading_times_send.dart b/lib/basic_api/generated/trading_times_send.dart index 7981d3669d..e2e12e6055 100644 --- a/lib/basic_api/generated/trading_times_send.dart +++ b/lib/basic_api/generated/trading_times_send.dart @@ -9,13 +9,10 @@ class TradingTimesRequest extends Request { /// Initialize TradingTimesRequest. const TradingTimesRequest({ required this.tradingTimes, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'trading_times', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'trading_times', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TradingTimesRequest.fromJson(Map json) => diff --git a/lib/basic_api/generated/transaction_receive.dart b/lib/basic_api/generated/transaction_receive.dart index 9d38a86c2a..c783fb8f76 100644 --- a/lib/basic_api/generated/transaction_receive.dart +++ b/lib/basic_api/generated/transaction_receive.dart @@ -10,16 +10,11 @@ class TransactionReceive extends Response { const TransactionReceive({ this.subscription, this.transaction, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TransactionReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/transaction_send.dart b/lib/basic_api/generated/transaction_send.dart index 76789b939c..30fd3d64a5 100644 --- a/lib/basic_api/generated/transaction_send.dart +++ b/lib/basic_api/generated/transaction_send.dart @@ -8,19 +8,18 @@ import '../request.dart'; class TransactionRequest extends Request { /// Initialize TransactionRequest. const TransactionRequest({ + this.loginid, this.subscribe, this.transaction = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'transaction', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'transaction', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TransactionRequest.fromJson(Map json) => TransactionRequest( + loginid: json['loginid'] as String?, subscribe: json['subscribe'] == null ? null : json['subscribe'] == 1, transaction: json['transaction'] == null ? null : json['transaction'] == 1, @@ -28,6 +27,9 @@ class TransactionRequest extends Request { reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// If set to `true`, will send updates whenever there is an update to transactions. If not to `true` then it will not return any records. final bool? subscribe; @@ -37,6 +39,7 @@ class TransactionRequest extends Request { /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'subscribe': subscribe == null ? null : subscribe! @@ -54,12 +57,14 @@ class TransactionRequest extends Request { /// Creates a copy of instance with given parameters @override TransactionRequest copyWith({ + String? loginid, bool? subscribe, bool? transaction, Map? passthrough, int? reqId, }) => TransactionRequest( + loginid: loginid ?? this.loginid, subscribe: subscribe ?? this.subscribe, transaction: transaction ?? this.transaction, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/transfer_between_accounts_receive.dart b/lib/basic_api/generated/transfer_between_accounts_receive.dart index c3484dcf9c..33f7f2319c 100644 --- a/lib/basic_api/generated/transfer_between_accounts_receive.dart +++ b/lib/basic_api/generated/transfer_between_accounts_receive.dart @@ -13,16 +13,11 @@ class TransferBetweenAccountsReceive extends Response { this.clientToLoginid, this.transactionId, this.transferBetweenAccounts, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory TransferBetweenAccountsReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/transfer_between_accounts_send.dart b/lib/basic_api/generated/transfer_between_accounts_send.dart index 9e0b85e352..e060702856 100644 --- a/lib/basic_api/generated/transfer_between_accounts_send.dart +++ b/lib/basic_api/generated/transfer_between_accounts_send.dart @@ -13,14 +13,12 @@ class TransferBetweenAccountsRequest extends Request { this.accounts, this.amount, this.currency, + this.loginid, required this.transferBetweenAccounts, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'transfer_between_accounts', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'transfer_between_accounts', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory TransferBetweenAccountsRequest.fromJson(Map json) => @@ -30,6 +28,7 @@ class TransferBetweenAccountsRequest extends Request { accounts: json['accounts'] as String?, amount: json['amount'] as num?, currency: json['currency'] as String?, + loginid: json['loginid'] as String?, transferBetweenAccounts: json['transfer_between_accounts'] as int?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, @@ -50,6 +49,9 @@ class TransferBetweenAccountsRequest extends Request { /// [Optional] Currency code. final String? currency; + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// If `account_from` or `account_to` is not provided, it just returns the available accounts. final int? transferBetweenAccounts; @@ -61,6 +63,7 @@ class TransferBetweenAccountsRequest extends Request { 'accounts': accounts, 'amount': amount, 'currency': currency, + 'loginid': loginid, 'transfer_between_accounts': transferBetweenAccounts, 'passthrough': passthrough, 'req_id': reqId, @@ -74,6 +77,7 @@ class TransferBetweenAccountsRequest extends Request { String? accounts, num? amount, String? currency, + String? loginid, int? transferBetweenAccounts, Map? passthrough, int? reqId, @@ -84,6 +88,7 @@ class TransferBetweenAccountsRequest extends Request { accounts: accounts ?? this.accounts, amount: amount ?? this.amount, currency: currency ?? this.currency, + loginid: loginid ?? this.loginid, transferBetweenAccounts: transferBetweenAccounts ?? this.transferBetweenAccounts, passthrough: passthrough ?? this.passthrough, diff --git a/lib/basic_api/generated/unsubscribe_email_receive.dart b/lib/basic_api/generated/unsubscribe_email_receive.dart index b1f23ab820..78a6b41428 100644 --- a/lib/basic_api/generated/unsubscribe_email_receive.dart +++ b/lib/basic_api/generated/unsubscribe_email_receive.dart @@ -10,16 +10,11 @@ class UnsubscribeEmailReceive extends Response { const UnsubscribeEmailReceive({ this.binaryUserId, this.emailUnsubscribeStatus, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory UnsubscribeEmailReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/unsubscribe_email_send.dart b/lib/basic_api/generated/unsubscribe_email_send.dart index 22b136867d..de51923cd4 100644 --- a/lib/basic_api/generated/unsubscribe_email_send.dart +++ b/lib/basic_api/generated/unsubscribe_email_send.dart @@ -11,13 +11,10 @@ class UnsubscribeEmailRequest extends Request { required this.binaryUserId, required this.checksum, this.unsubscribeEmail = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'unsubscribe_email', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'unsubscribe_email', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory UnsubscribeEmailRequest.fromJson(Map json) => diff --git a/lib/basic_api/generated/verify_email_cellxpert_receive.dart b/lib/basic_api/generated/verify_email_cellxpert_receive.dart index 7641eeb45e..fdc5f583fd 100644 --- a/lib/basic_api/generated/verify_email_cellxpert_receive.dart +++ b/lib/basic_api/generated/verify_email_cellxpert_receive.dart @@ -9,16 +9,11 @@ class VerifyEmailCellxpertReceive extends Response { /// Initialize VerifyEmailCellxpertReceive. const VerifyEmailCellxpertReceive({ this.verifyEmailCellxpert, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory VerifyEmailCellxpertReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/verify_email_cellxpert_send.dart b/lib/basic_api/generated/verify_email_cellxpert_send.dart index f1eeb5d151..c92b524c7a 100644 --- a/lib/basic_api/generated/verify_email_cellxpert_send.dart +++ b/lib/basic_api/generated/verify_email_cellxpert_send.dart @@ -8,20 +8,19 @@ import '../request.dart'; class VerifyEmailCellxpertRequest extends Request { /// Initialize VerifyEmailCellxpertRequest. const VerifyEmailCellxpertRequest({ + this.loginid, required this.type, this.urlParameters, required this.verifyEmailCellxpert, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'verify_email_cellxpert', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'verify_email_cellxpert', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory VerifyEmailCellxpertRequest.fromJson(Map json) => VerifyEmailCellxpertRequest( + loginid: json['loginid'] as String?, type: json['type'] as String?, urlParameters: json['url_parameters'] as Map?, verifyEmailCellxpert: json['verify_email_cellxpert'] as String?, @@ -29,6 +28,9 @@ class VerifyEmailCellxpertRequest extends Request { reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Purpose of the email verification call. final String? type; @@ -41,6 +43,7 @@ class VerifyEmailCellxpertRequest extends Request { /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'type': type, 'url_parameters': urlParameters, 'verify_email_cellxpert': verifyEmailCellxpert, @@ -51,6 +54,7 @@ class VerifyEmailCellxpertRequest extends Request { /// Creates a copy of instance with given parameters @override VerifyEmailCellxpertRequest copyWith({ + String? loginid, String? type, Map? urlParameters, String? verifyEmailCellxpert, @@ -58,6 +62,7 @@ class VerifyEmailCellxpertRequest extends Request { int? reqId, }) => VerifyEmailCellxpertRequest( + loginid: loginid ?? this.loginid, type: type ?? this.type, urlParameters: urlParameters ?? this.urlParameters, verifyEmailCellxpert: verifyEmailCellxpert ?? this.verifyEmailCellxpert, diff --git a/lib/basic_api/generated/verify_email_receive.dart b/lib/basic_api/generated/verify_email_receive.dart index c9bbe75482..57736502d4 100644 --- a/lib/basic_api/generated/verify_email_receive.dart +++ b/lib/basic_api/generated/verify_email_receive.dart @@ -9,16 +9,11 @@ class VerifyEmailReceive extends Response { /// Initialize VerifyEmailReceive. const VerifyEmailReceive({ this.verifyEmail, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory VerifyEmailReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/verify_email_send.dart b/lib/basic_api/generated/verify_email_send.dart index 2cfc756e2c..111422d8ca 100644 --- a/lib/basic_api/generated/verify_email_send.dart +++ b/lib/basic_api/generated/verify_email_send.dart @@ -8,20 +8,19 @@ import '../request.dart'; class VerifyEmailRequest extends Request { /// Initialize VerifyEmailRequest. const VerifyEmailRequest({ + this.loginid, required this.type, this.urlParameters, required this.verifyEmail, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'verify_email', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'verify_email', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory VerifyEmailRequest.fromJson(Map json) => VerifyEmailRequest( + loginid: json['loginid'] as String?, type: json['type'] as String?, urlParameters: json['url_parameters'] as Map?, verifyEmail: json['verify_email'] as String?, @@ -29,7 +28,10 @@ class VerifyEmailRequest extends Request { reqId: json['req_id'] as int?, ); - /// Purpose of the email verification call. + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + + /// Purpose of email verification, request_email and reset_password are the only two types restricted from all unoffical apps final String? type; /// [Optional] Extra parameters that can be attached to the verify email link URL. @@ -41,6 +43,7 @@ class VerifyEmailRequest extends Request { /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'type': type, 'url_parameters': urlParameters, 'verify_email': verifyEmail, @@ -51,6 +54,7 @@ class VerifyEmailRequest extends Request { /// Creates a copy of instance with given parameters @override VerifyEmailRequest copyWith({ + String? loginid, String? type, Map? urlParameters, String? verifyEmail, @@ -58,6 +62,7 @@ class VerifyEmailRequest extends Request { int? reqId, }) => VerifyEmailRequest( + loginid: loginid ?? this.loginid, type: type ?? this.type, urlParameters: urlParameters ?? this.urlParameters, verifyEmail: verifyEmail ?? this.verifyEmail, diff --git a/lib/basic_api/generated/wallet_migration_send.dart b/lib/basic_api/generated/wallet_migration_send.dart index 4216d2b22f..6ae3f6197c 100644 --- a/lib/basic_api/generated/wallet_migration_send.dart +++ b/lib/basic_api/generated/wallet_migration_send.dart @@ -8,6 +8,7 @@ import '../request.dart'; class WalletMigrationRequest extends Request { /// Initialize WalletMigrationRequest. const WalletMigrationRequest({ + this.loginid, required this.walletMigration, super.msgType = 'wallet_migration', super.passthrough, @@ -17,17 +18,22 @@ class WalletMigrationRequest extends Request { /// Creates an instance from JSON. factory WalletMigrationRequest.fromJson(Map json) => WalletMigrationRequest( + loginid: json['loginid'] as String?, walletMigration: json['wallet_migration'] as String?, passthrough: json['passthrough'] as Map?, reqId: json['req_id'] as int?, ); + /// [Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id. + final String? loginid; + /// Wallet migration action. final String? walletMigration; /// Converts this instance to JSON @override Map toJson() => { + 'loginid': loginid, 'wallet_migration': walletMigration, 'passthrough': passthrough, 'req_id': reqId, @@ -36,11 +42,13 @@ class WalletMigrationRequest extends Request { /// Creates a copy of instance with given parameters @override WalletMigrationRequest copyWith({ + String? loginid, String? walletMigration, Map? passthrough, int? reqId, }) => WalletMigrationRequest( + loginid: loginid ?? this.loginid, walletMigration: walletMigration ?? this.walletMigration, passthrough: passthrough ?? this.passthrough, reqId: reqId ?? this.reqId, diff --git a/lib/basic_api/generated/website_config_receive.dart b/lib/basic_api/generated/website_config_receive.dart new file mode 100644 index 0000000000..f9d168665b --- /dev/null +++ b/lib/basic_api/generated/website_config_receive.dart @@ -0,0 +1,69 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/website_config_receive.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../response.dart'; + +/// Website config receive class. +class WebsiteConfigReceive extends Response { + /// Initialize WebsiteConfigReceive. + const WebsiteConfigReceive({ + this.subscription, + this.websiteConfig, + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); + + /// Creates an instance from JSON. + factory WebsiteConfigReceive.fromJson(Map json) => + WebsiteConfigReceive( + subscription: json['subscription'] as Map?, + websiteConfig: json['website_config'] as Map?, + echoReq: json['echo_req'] as Map?, + error: json['error'] as Map?, + msgType: json['msg_type'] as String?, + reqId: json['req_id'] as int?, + ); + + /// For subscription requests only. + final Map? subscription; + + /// Server status and other information regarding general settings + final Map? websiteConfig; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'subscription': subscription, + 'website_config': websiteConfig, + 'echo_req': echoReq, + 'error': error, + 'msg_type': msgType, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + WebsiteConfigReceive copyWith({ + Map? subscription, + Map? websiteConfig, + Map? echoReq, + Map? error, + String? msgType, + int? reqId, + }) => + WebsiteConfigReceive( + subscription: subscription ?? this.subscription, + websiteConfig: websiteConfig ?? this.websiteConfig, + echoReq: echoReq ?? this.echoReq, + error: error ?? this.error, + msgType: msgType ?? this.msgType, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/website_config_send.dart b/lib/basic_api/generated/website_config_send.dart new file mode 100644 index 0000000000..40124c7488 --- /dev/null +++ b/lib/basic_api/generated/website_config_send.dart @@ -0,0 +1,57 @@ +/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/website_config_send.json. + +// ignore_for_file: always_put_required_named_parameters_first + +import '../request.dart'; + +/// Website config request class. +class WebsiteConfigRequest extends Request { + /// Initialize WebsiteConfigRequest. + const WebsiteConfigRequest({ + this.websiteConfig = true, + super.msgType = 'website_config', + super.passthrough, + super.reqId, + }); + + /// Creates an instance from JSON. + factory WebsiteConfigRequest.fromJson(Map json) => + WebsiteConfigRequest( + websiteConfig: + json['website_config'] == null ? null : json['website_config'] == 1, + passthrough: json['passthrough'] as Map?, + reqId: json['req_id'] as int?, + ); + + /// Must be `true` + final bool? websiteConfig; + + /// Converts this instance to JSON + @override + Map toJson() => { + 'website_config': websiteConfig == null + ? null + : websiteConfig! + ? 1 + : 0, + 'passthrough': passthrough, + 'req_id': reqId, + }; + + /// Creates a copy of instance with given parameters + @override + WebsiteConfigRequest copyWith({ + bool? websiteConfig, + Map? passthrough, + int? reqId, + }) => + WebsiteConfigRequest( + websiteConfig: websiteConfig ?? this.websiteConfig, + passthrough: passthrough ?? this.passthrough, + reqId: reqId ?? this.reqId, + ); + + /// Override equatable class. + @override + List get props => []; +} diff --git a/lib/basic_api/generated/website_status_receive.dart b/lib/basic_api/generated/website_status_receive.dart index 2c0f9f78cb..7f448b1743 100644 --- a/lib/basic_api/generated/website_status_receive.dart +++ b/lib/basic_api/generated/website_status_receive.dart @@ -10,16 +10,11 @@ class WebsiteStatusReceive extends Response { const WebsiteStatusReceive({ this.subscription, this.websiteStatus, - Map? echoReq, - Map? error, - String? msgType, - int? reqId, - }) : super( - echoReq: echoReq, - error: error, - msgType: msgType, - reqId: reqId, - ); + super.echoReq, + super.error, + super.msgType, + super.reqId, + }); /// Creates an instance from JSON. factory WebsiteStatusReceive.fromJson(Map json) => diff --git a/lib/basic_api/generated/website_status_send.dart b/lib/basic_api/generated/website_status_send.dart index 1d6681599a..5222fd5b58 100644 --- a/lib/basic_api/generated/website_status_send.dart +++ b/lib/basic_api/generated/website_status_send.dart @@ -10,13 +10,10 @@ class WebsiteStatusRequest extends Request { const WebsiteStatusRequest({ this.subscribe, this.websiteStatus = true, - Map? passthrough, - int? reqId, - }) : super( - msgType: 'website_status', - passthrough: passthrough, - reqId: reqId, - ); + super.msgType = 'website_status', + super.passthrough, + super.reqId, + }); /// Creates an instance from JSON. factory WebsiteStatusRequest.fromJson(Map json) => diff --git a/lib/basic_api/helper/response_mapper.helper.dart b/lib/basic_api/helper/response_mapper.helper.dart index 73bd465b4f..4eca3804e2 100644 --- a/lib/basic_api/helper/response_mapper.helper.dart +++ b/lib/basic_api/helper/response_mapper.helper.dart @@ -4,9 +4,13 @@ // function that maps the `msg_type`s to equivalent Response objects import '../generated/account_closure_receive.dart'; +import '../generated/account_list_receive.dart'; import '../generated/account_security_receive.dart'; import '../generated/account_statistics_receive.dart'; import '../generated/active_symbols_receive.dart'; +import '../generated/affiliate_add_company_receive.dart'; +import '../generated/affiliate_add_person_receive.dart'; +import '../generated/affiliate_register_person_receive.dart'; import '../generated/api_token_receive.dart'; import '../generated/app_delete_receive.dart'; import '../generated/app_get_receive.dart'; @@ -27,6 +31,7 @@ import '../generated/cashier_receive.dart'; import '../generated/cashier_withdrawal_cancel_receive.dart'; import '../generated/change_email_receive.dart'; import '../generated/change_password_receive.dart'; +import '../generated/confirm_email_receive.dart'; import '../generated/contract_update_history_receive.dart'; import '../generated/contract_update_receive.dart'; import '../generated/contracts_for_receive.dart'; @@ -35,6 +40,7 @@ import '../generated/copy_stop_receive.dart'; import '../generated/copytrading_list_receive.dart'; import '../generated/copytrading_statistics_receive.dart'; import '../generated/crypto_config_receive.dart'; +import '../generated/crypto_estimations_receive.dart'; import '../generated/document_upload_receive.dart'; import '../generated/economic_calendar_receive.dart'; import '../generated/exchange_rates_receive.dart'; @@ -47,6 +53,8 @@ import '../generated/get_limits_receive.dart'; import '../generated/get_self_exclusion_receive.dart'; import '../generated/get_settings_receive.dart'; import '../generated/identity_verification_document_add_receive.dart'; +import '../generated/jtoken_create_receive.dart'; +import '../generated/kyc_auth_status_receive.dart'; import '../generated/landing_company_details_receive.dart'; import '../generated/landing_company_receive.dart'; import '../generated/link_wallet_receive.dart'; @@ -88,11 +96,19 @@ import '../generated/p2p_order_review_receive.dart'; import '../generated/p2p_payment_methods_receive.dart'; import '../generated/p2p_ping_receive.dart'; import '../generated/p2p_settings_receive.dart'; +import '../generated/passkeys_list_receive.dart'; +import '../generated/passkeys_login_receive.dart'; +import '../generated/passkeys_options_receive.dart'; +import '../generated/passkeys_register_options_receive.dart'; +import '../generated/passkeys_register_receive.dart'; +import '../generated/passkeys_rename_receive.dart'; +import '../generated/passkeys_revoke_receive.dart'; import '../generated/payment_methods_receive.dart'; import '../generated/paymentagent_create_receive.dart'; import '../generated/paymentagent_details_receive.dart'; import '../generated/paymentagent_list_receive.dart'; import '../generated/paymentagent_transfer_receive.dart'; +import '../generated/paymentagent_withdraw_justification_receive.dart'; import '../generated/paymentagent_withdraw_receive.dart'; import '../generated/payout_currencies_receive.dart'; import '../generated/ping_receive.dart'; @@ -127,6 +143,7 @@ import '../generated/trading_platform_available_accounts_receive.dart'; import '../generated/trading_platform_deposit_receive.dart'; import '../generated/trading_platform_investor_password_change_receive.dart'; import '../generated/trading_platform_investor_password_reset_receive.dart'; +import '../generated/trading_platform_leverage_receive.dart'; import '../generated/trading_platform_new_account_receive.dart'; import '../generated/trading_platform_password_change_receive.dart'; import '../generated/trading_platform_password_reset_receive.dart'; @@ -140,6 +157,7 @@ import '../generated/unsubscribe_email_receive.dart'; import '../generated/verify_email_cellxpert_receive.dart'; import '../generated/verify_email_receive.dart'; import '../generated/wallet_migration_receive.dart'; +import '../generated/website_config_receive.dart'; import '../generated/website_status_receive.dart'; import '../response.dart'; @@ -149,12 +167,20 @@ Response getGeneratedResponse(Map responseMap) { switch (responseMap['msg_type']) { case 'account_closure': return AccountClosureReceive.fromJson(responseMap); + case 'account_list': + return AccountListReceive.fromJson(responseMap); case 'account_security': return AccountSecurityReceive.fromJson(responseMap); case 'account_statistics': return AccountStatisticsReceive.fromJson(responseMap); case 'active_symbols': return ActiveSymbolsReceive.fromJson(responseMap); + case 'affiliate_add_company': + return AffiliateAddCompanyReceive.fromJson(responseMap); + case 'affiliate_add_person': + return AffiliateAddPersonReceive.fromJson(responseMap); + case 'affiliate_register_person': + return AffiliateRegisterPersonReceive.fromJson(responseMap); case 'api_token': return ApiTokenReceive.fromJson(responseMap); case 'app_delete': @@ -195,6 +221,8 @@ Response getGeneratedResponse(Map responseMap) { return ChangeEmailReceive.fromJson(responseMap); case 'change_password': return ChangePasswordReceive.fromJson(responseMap); + case 'confirm_email': + return ConfirmEmailReceive.fromJson(responseMap); case 'contract_update_history': return ContractUpdateHistoryReceive.fromJson(responseMap); case 'contract_update': @@ -211,6 +239,8 @@ Response getGeneratedResponse(Map responseMap) { return CopytradingStatisticsReceive.fromJson(responseMap); case 'crypto_config': return CryptoConfigReceive.fromJson(responseMap); + case 'crypto_estimations': + return CryptoEstimationsReceive.fromJson(responseMap); case 'document_upload': return DocumentUploadReceive.fromJson(responseMap); case 'economic_calendar': @@ -235,6 +265,10 @@ Response getGeneratedResponse(Map responseMap) { return GetSettingsReceive.fromJson(responseMap); case 'identity_verification_document_add': return IdentityVerificationDocumentAddReceive.fromJson(responseMap); + case 'jtoken_create': + return JtokenCreateReceive.fromJson(responseMap); + case 'kyc_auth_status': + return KycAuthStatusReceive.fromJson(responseMap); case 'landing_company_details': return LandingCompanyDetailsReceive.fromJson(responseMap); case 'landing_company': @@ -317,6 +351,20 @@ Response getGeneratedResponse(Map responseMap) { return P2pPingReceive.fromJson(responseMap); case 'p2p_settings': return P2pSettingsReceive.fromJson(responseMap); + case 'passkeys_list': + return PasskeysListReceive.fromJson(responseMap); + case 'passkeys_login': + return PasskeysLoginReceive.fromJson(responseMap); + case 'passkeys_options': + return PasskeysOptionsReceive.fromJson(responseMap); + case 'passkeys_register_options': + return PasskeysRegisterOptionsReceive.fromJson(responseMap); + case 'passkeys_register': + return PasskeysRegisterReceive.fromJson(responseMap); + case 'passkeys_rename': + return PasskeysRenameReceive.fromJson(responseMap); + case 'passkeys_revoke': + return PasskeysRevokeReceive.fromJson(responseMap); case 'payment_methods': return PaymentMethodsReceive.fromJson(responseMap); case 'paymentagent_create': @@ -327,6 +375,8 @@ Response getGeneratedResponse(Map responseMap) { return PaymentagentListReceive.fromJson(responseMap); case 'paymentagent_transfer': return PaymentagentTransferReceive.fromJson(responseMap); + case 'paymentagent_withdraw_justification': + return PaymentagentWithdrawJustificationReceive.fromJson(responseMap); case 'paymentagent_withdraw': return PaymentagentWithdrawReceive.fromJson(responseMap); case 'payout_currencies': @@ -395,6 +445,8 @@ Response getGeneratedResponse(Map responseMap) { return TradingPlatformInvestorPasswordChangeReceive.fromJson(responseMap); case 'trading_platform_investor_password_reset': return TradingPlatformInvestorPasswordResetReceive.fromJson(responseMap); + case 'trading_platform_leverage': + return TradingPlatformLeverageReceive.fromJson(responseMap); case 'trading_platform_new_account': return TradingPlatformNewAccountReceive.fromJson(responseMap); case 'trading_platform_password_change': @@ -421,6 +473,8 @@ Response getGeneratedResponse(Map responseMap) { return VerifyEmailReceive.fromJson(responseMap); case 'wallet_migration': return WalletMigrationReceive.fromJson(responseMap); + case 'website_config': + return WebsiteConfigReceive.fromJson(responseMap); case 'website_status': return WebsiteStatusReceive.fromJson(responseMap); From 3c393f4cafd4fbdb897e31b85a6a18ceb77c5dd0 Mon Sep 17 00:00:00 2001 From: WAQAS YOUNAS Date: Mon, 5 Feb 2024 15:01:59 +0800 Subject: [PATCH 60/64] fix errors on models --- .../response/get_settings_response_result.dart | 3 +++ lib/api/response/p2p_ping_response_result.dart | 16 ++++++++-------- lib/api/response/time_response_result.dart | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/api/response/get_settings_response_result.dart b/lib/api/response/get_settings_response_result.dart index b126471624..999ca3b740 100644 --- a/lib/api/response/get_settings_response_result.dart +++ b/lib/api/response/get_settings_response_result.dart @@ -143,6 +143,7 @@ class GetSettingsResponse extends GetSettingsResponseModel { secretQuestion: secretQuestion, taxIdentificationNumber: getSettings?.taxIdentificationNumber, taxResidence: getSettings?.taxResidence, + dxtradeUserException: getSettings?.dxtradeUserException, ), ); @@ -182,6 +183,7 @@ enum EmploymentStatusEnum { /// Unemployed. unemployed, } + /// Get settings model class. abstract class GetSettingsModel { /// Initializes Get settings model class . @@ -547,6 +549,7 @@ class GetSettings extends GetSettingsModel { userHash: userHash ?? this.userHash, ); } + /// Feature flag model class. abstract class FeatureFlagModel { /// Initializes Feature flag model class . diff --git a/lib/api/response/p2p_ping_response_result.dart b/lib/api/response/p2p_ping_response_result.dart index 0dfd2c91cd..f4e069e732 100644 --- a/lib/api/response/p2p_ping_response_result.dart +++ b/lib/api/response/p2p_ping_response_result.dart @@ -2,13 +2,13 @@ import 'package:equatable/equatable.dart'; -import 'package:deriv_dependency_injector/dependency_injector.dart'; -import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; -import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; -import 'package:flutter_deriv_api/basic_api/generated/p2p_ping_receive.dart'; -import 'package:flutter_deriv_api/basic_api/generated/p2p_ping_send.dart'; - -import 'package:flutter_deriv_api/helpers/helpers.dart'; +import 'package:deriv_dependency_injector/dependency_injector.dart'; +import 'package:flutter_deriv_api/api/exceptions/exceptions.dart'; +import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; +import 'package:flutter_deriv_api/basic_api/generated/p2p_ping_receive.dart'; +import 'package:flutter_deriv_api/basic_api/generated/p2p_ping_send.dart'; + +import 'package:flutter_deriv_api/helpers/helpers.dart'; import 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart'; /// P2p ping response model class. @@ -65,7 +65,7 @@ class P2pPingResponse extends P2pPingResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - APIBaseException(baseExceptionModel: baseExceptionModel), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; diff --git a/lib/api/response/time_response_result.dart b/lib/api/response/time_response_result.dart index a65add00d4..e7e7203111 100644 --- a/lib/api/response/time_response_result.dart +++ b/lib/api/response/time_response_result.dart @@ -59,7 +59,7 @@ class TimeResponse extends TimeResponseModel { checkException( response: response, exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => - ServerTimeException(), + BaseAPIException(baseExceptionModel: baseExceptionModel), ); return response; From 0244d08e6831cec1b6af93f87916f7ee86078bf9 Mon Sep 17 00:00:00 2001 From: WAQAS YOUNAS Date: Mon, 5 Feb 2024 15:06:55 +0800 Subject: [PATCH 61/64] remove unwanted files --- lib/basic_api/generated/api.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/basic_api/generated/api.dart b/lib/basic_api/generated/api.dart index 031f3b5c7c..04851a39cc 100644 --- a/lib/basic_api/generated/api.dart +++ b/lib/basic_api/generated/api.dart @@ -90,8 +90,6 @@ export "get_account_status_receive.dart"; export "get_account_status_send.dart"; export "get_account_types_receive.dart"; export "get_account_types_send.dart"; -export "get_available_accounts_to_transfer_receive.dart"; -export "get_available_accounts_to_transfer_send.dart"; export "get_financial_assessment_receive.dart"; export "get_financial_assessment_send.dart"; export "get_limits_receive.dart"; From f277e8010fc07e2a3b2956d9995cd5fa21faf9b1 Mon Sep 17 00:00:00 2001 From: ramin-deriv <55975218+ramin-deriv@users.noreply.github.com> Date: Thu, 29 Feb 2024 09:38:18 +0800 Subject: [PATCH 62/64] Ramin/test proxy aware ws connection (#307) --- .../connection/api_manager/binary_api.dart | 17 +++++++++++------ lib/state/connection/connection_cubit.dart | 6 +++++- pubspec.yaml | 5 ++++- test/state/connection/connection_bloc_test.dart | 3 ++- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/lib/services/connection/api_manager/binary_api.dart b/lib/services/connection/api_manager/binary_api.dart index 896583b8f6..784e1d4f54 100644 --- a/lib/services/connection/api_manager/binary_api.dart +++ b/lib/services/connection/api_manager/binary_api.dart @@ -4,6 +4,7 @@ import 'dart:developer' as dev; import 'dart:io'; import 'package:flutter/widgets.dart'; +import 'package:flutter_system_proxy/flutter_system_proxy.dart'; import 'package:web_socket_channel/io.dart'; import 'package:flutter_deriv_api/api/models/enums.dart'; @@ -23,8 +24,10 @@ import 'package:flutter_deriv_api/services/connection/call_manager/subscription_ /// This class is for handling Binary API connection and calling Binary APIs. class BinaryAPI extends BaseAPI { /// Initializes [BinaryAPI] instance. - BinaryAPI({String? key, bool enableDebug = false}) - : super(key: key ?? '${UniqueKey()}', enableDebug: enableDebug); + BinaryAPI({ + String? key, + bool enableDebug = false, + }) : super(key: key ?? '${UniqueKey()}', enableDebug: enableDebug); static const Duration _disconnectTimeOut = Duration(seconds: 5); static const Duration _websocketConnectTimeOut = Duration(seconds: 10); @@ -74,12 +77,14 @@ class BinaryAPI extends BaseAPI { _logDebugInfo('connecting to $uri.'); await _setUserAgent(); + final String proxy = await FlutterSystemProxy.findProxyFromEnvironment( + uri.toString().replaceAll('wss', 'https')); + + final HttpClient client = HttpClient()..findProxy = (Uri uri) => proxy; // Initialize connection to websocket server. - _webSocketChannel = IOWebSocketChannel.connect( - '$uri', - pingInterval: _websocketConnectTimeOut, - ); + _webSocketChannel = IOWebSocketChannel.connect('$uri', + pingInterval: _websocketConnectTimeOut, customClient: client); _webSocketListener = _webSocketChannel?.stream .map?>((Object? result) => jsonDecode('$result')) diff --git a/lib/state/connection/connection_cubit.dart b/lib/state/connection/connection_cubit.dart index cc8b8d9949..f8e43800da 100644 --- a/lib/state/connection/connection_cubit.dart +++ b/lib/state/connection/connection_cubit.dart @@ -25,7 +25,11 @@ class ConnectionCubit extends Cubit { this.printResponse = false, }) : super(const ConnectionInitialState()) { APIInitializer().initialize( - api: api ?? BinaryAPI(key: _key, enableDebug: enableDebug), + api: api ?? + BinaryAPI( + key: _key, + enableDebug: enableDebug, + ), ); _api = Injector()(); diff --git a/pubspec.yaml b/pubspec.yaml index 30a16e33b2..ae7f7c169a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -28,8 +28,11 @@ dependencies: meta: ^1.8.0 recase: ^4.0.0 rxdart: ^0.27.7 - web_socket_channel: ^2.3.0 device_info_plus: ^8.1.0 + flutter_system_proxy: + git: + url: git@github.com:BrowserStackCE/flutter_system_proxy.git + ref: main package_info_plus: ^4.2.0 connectivity_plus: ^5.0.2 diff --git a/test/state/connection/connection_bloc_test.dart b/test/state/connection/connection_bloc_test.dart index d4147817a8..396b3841a2 100644 --- a/test/state/connection/connection_bloc_test.dart +++ b/test/state/connection/connection_bloc_test.dart @@ -10,7 +10,8 @@ void main() { setUpAll( () { connectionCubit = ConnectionCubit( - ConnectionInformation(appId: '', brand: '', endpoint: '',authEndpoint: ''), + ConnectionInformation( + appId: '', brand: '', endpoint: '', authEndpoint: ''), api: MockAPI(), ); }, From f337d60c652a2bfddf6c90009e6d71c51e7b8cbf Mon Sep 17 00:00:00 2001 From: emad-deriv <134991873+emad-deriv@users.noreply.github.com> Date: Fri, 8 Mar 2024 17:48:05 +0800 Subject: [PATCH 63/64] fix TradingPlatformDepositResponseModel for deriv x top up issue (#305) --- .../response/trading_platform_deposit_response_result.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/api/response/trading_platform_deposit_response_result.dart b/lib/api/response/trading_platform_deposit_response_result.dart index 685817be5c..2a683e0db6 100644 --- a/lib/api/response/trading_platform_deposit_response_result.dart +++ b/lib/api/response/trading_platform_deposit_response_result.dart @@ -16,7 +16,7 @@ abstract class TradingPlatformDepositResponseModel { }); /// Information about deposit transaction, or status of demo account top up. - final Map? tradingPlatformDeposit; + final dynamic tradingPlatformDeposit; } /// Trading platform deposit response class. @@ -70,7 +70,7 @@ class TradingPlatformDepositResponse /// Creates a copy of instance with given parameters. TradingPlatformDepositResponse copyWith({ - Map? tradingPlatformDeposit, + dynamic tradingPlatformDeposit, }) => TradingPlatformDepositResponse( tradingPlatformDeposit: From 9c4c80f77ec4907ea65ee267990eb9ac5bbce08f Mon Sep 17 00:00:00 2001 From: ramin-deriv <55975218+ramin-deriv@users.noreply.github.com> Date: Tue, 12 Mar 2024 15:36:49 +0800 Subject: [PATCH 64/64] ramin/make_proxy_aware_connection_configurable (#310) * test HttpOverrides to pass the connection through the proxy server * get system proxy and add it to HttpOverride * add onProxy found callback * create custom HttpClient for the websocket connection * use flutter-system proxy dep * make onProxyFound optional * code cleanup * revert unnessary changes * remove debugging code * remove debugging code * use proxyAwareConnection flag in BinaryAPI --- .../connection/api_manager/binary_api.dart | 15 ++++++++++++--- lib/state/connection/connection_cubit.dart | 6 ++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/services/connection/api_manager/binary_api.dart b/lib/services/connection/api_manager/binary_api.dart index 784e1d4f54..43b58c060c 100644 --- a/lib/services/connection/api_manager/binary_api.dart +++ b/lib/services/connection/api_manager/binary_api.dart @@ -27,11 +27,15 @@ class BinaryAPI extends BaseAPI { BinaryAPI({ String? key, bool enableDebug = false, + this.proxyAwareConnection = false, }) : super(key: key ?? '${UniqueKey()}', enableDebug: enableDebug); static const Duration _disconnectTimeOut = Duration(seconds: 5); static const Duration _websocketConnectTimeOut = Duration(seconds: 10); + /// A flag to indicate if the connection is proxy aware. + final bool proxyAwareConnection; + /// Represents the active websocket connection. /// /// This is used to send and receive data from the websocket server. @@ -77,10 +81,15 @@ class BinaryAPI extends BaseAPI { _logDebugInfo('connecting to $uri.'); await _setUserAgent(); - final String proxy = await FlutterSystemProxy.findProxyFromEnvironment( - uri.toString().replaceAll('wss', 'https')); - final HttpClient client = HttpClient()..findProxy = (Uri uri) => proxy; + HttpClient? client; + + if (proxyAwareConnection) { + final String proxy = await FlutterSystemProxy.findProxyFromEnvironment( + uri.toString().replaceAll('wss', 'https')); + + client = HttpClient()..findProxy = (Uri uri) => proxy; + } // Initialize connection to websocket server. _webSocketChannel = IOWebSocketChannel.connect('$uri', diff --git a/lib/state/connection/connection_cubit.dart b/lib/state/connection/connection_cubit.dart index f8e43800da..4659014740 100644 --- a/lib/state/connection/connection_cubit.dart +++ b/lib/state/connection/connection_cubit.dart @@ -22,12 +22,15 @@ class ConnectionCubit extends Cubit { ConnectionInformation connectionInformation, { BaseAPI? api, this.enableDebug = false, + // TODO(NA): Refactor to only get BinaryAPI instance. and printResponse and proxyAwareConnection can be part of BinaryAPI only. this.printResponse = false, + this.proxyAwareConnection = false, }) : super(const ConnectionInitialState()) { APIInitializer().initialize( api: api ?? BinaryAPI( key: _key, + proxyAwareConnection: proxyAwareConnection, enableDebug: enableDebug, ), ); @@ -55,6 +58,9 @@ class ConnectionCubit extends Cubit { /// Default value is `false`. final bool printResponse; + /// A flag to indicate if the connection is proxy aware. + final bool proxyAwareConnection; + // In some devices like Samsung J6 or Huawei Y7, the call manager doesn't response to the ping call less than 5 sec. final Duration _pingTimeout = const Duration(seconds: 5);