forked from deriv-com/flutter-deriv-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrading_platform_deposit_response_result.dart
More file actions
79 lines (65 loc) · 2.63 KB
/
trading_platform_deposit_response_result.dart
File metadata and controls
79 lines (65 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// 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/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';
/// Trading platform deposit response model class.
abstract class TradingPlatformDepositResponseModel {
/// Initializes Trading platform deposit response model class .
const TradingPlatformDepositResponseModel({
this.tradingPlatformDeposit,
});
/// Information about deposit transaction, or status of demo account top up.
final dynamic tradingPlatformDeposit;
}
/// Trading platform deposit response class.
class TradingPlatformDepositResponse
extends TradingPlatformDepositResponseModel {
/// Initializes Trading platform deposit response class.
const TradingPlatformDepositResponse({
super.tradingPlatformDeposit,
});
/// Creates an instance from JSON.
factory TradingPlatformDepositResponse.fromJson(
dynamic tradingPlatformDepositJson,
) =>
TradingPlatformDepositResponse(
tradingPlatformDeposit: tradingPlatformDepositJson,
);
/// Converts an instance to JSON.
Map<String, dynamic> toJson() {
final Map<String, dynamic> resultMap = <String, dynamic>{};
resultMap['trading_platform_deposit'] = tradingPlatformDeposit;
return resultMap;
}
static final BaseAPI _api = Injector()<BaseAPI>();
/// Trading Platform: Deposit.
///
/// Information about deposit transaction, or status of demo account top up.
/// For parameters information refer to [TradingPlatformDepositRequest].
/// Throws a [BaseAPIException] if API response contains an error.
static Future<TradingPlatformDepositResponse> deposit(
TradingPlatformDepositRequest request,
) async {
final TradingPlatformDepositReceive response =
await _api.call(request: request);
checkException(
response: response,
exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) =>
BaseAPIException(baseExceptionModel: baseExceptionModel),
);
return TradingPlatformDepositResponse.fromJson(
response.tradingPlatformDeposit,
);
}
/// Creates a copy of instance with given parameters.
TradingPlatformDepositResponse copyWith({
dynamic tradingPlatformDeposit,
}) =>
TradingPlatformDepositResponse(
tradingPlatformDeposit:
tradingPlatformDeposit ?? this.tradingPlatformDeposit,
);
}