forked from deriv-com/flutter-deriv-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmt5_new_account_send.dart
254 lines (222 loc) · 8.53 KB
/
mt5_new_account_send.dart
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
/// Generated automatically from flutter_deriv_api|lib/basic_api/generated/mt5_new_account_send.json.
// ignore_for_file: always_put_required_named_parameters_first
import '../request.dart';
/// Mt5 new account request class.
class Mt5NewAccountRequest extends Request {
/// Initialize Mt5NewAccountRequest.
const Mt5NewAccountRequest({
required this.accountType,
this.address,
this.city,
this.company,
this.country,
this.currency,
this.dryRun,
required this.email,
this.investPassword,
required this.leverage,
this.loginid,
required this.mainPassword,
this.migrate,
this.mt5AccountCategory,
this.mt5AccountType,
this.mt5NewAccount = true,
required this.name,
this.phone,
this.phonePassword,
required this.product,
this.server,
this.state,
this.subAccountCategory,
this.subAccountType,
this.zipCode,
super.msgType = 'mt5_new_account',
super.passthrough,
super.reqId,
});
/// Creates an instance from JSON.
factory Mt5NewAccountRequest.fromJson(Map<String, dynamic> json) =>
Mt5NewAccountRequest(
accountType: json['account_type'] as String?,
address: json['address'] as String?,
city: json['city'] as String?,
company: json['company'] as String?,
country: json['country'] as String?,
currency: json['currency'] as String?,
dryRun: json['dry_run'] == null ? null : json['dry_run'] == 1,
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
? null
: json['mt5_new_account'] == 1,
name: json['name'] as String?,
phone: json['phone'] as String?,
phonePassword: json['phonePassword'] as String?,
product: json['product'] as String?,
server: json['server'] as String?,
state: json['state'] as String?,
subAccountCategory: json['sub_account_category'] as String?,
subAccountType: json['sub_account_type'] as String?,
zipCode: json['zipCode'] as String?,
passthrough: json['passthrough'] as Map<String, dynamic>?,
reqId: json['req_id'] as int?,
);
/// Account type. If set to 'financial', setting 'mt5_account_type' is also required.
final String? accountType;
/// [Optional] The address of the user. The maximum length of this address field is 128 characters.
final String? address;
/// [Optional] User's city of residence.
final String? city;
/// [Optional] Name of the client's company. The maximum length of the company name is 64 characters.
final String? company;
/// [Optional] 2-letter country code (value received from `residence_list` call).
final String? country;
/// [Optional] MT5 account currency, the default value will be the qualified account currency.
final String? currency;
/// [Optional] If set to `true`, only validation is performed.
final bool? dryRun;
/// Email address
final String? email;
/// [Optional] The investor 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? investPassword;
/// Client leverage (from 1 to 1000).
final num? leverage;
/// [Optional] The login id of the user. Mandatory when multiple tokens were provided during authorize.
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;
/// [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.
final String? mt5AccountType;
/// Must be `true`
final bool? mt5NewAccount;
/// Client's name. The maximum length here is 101 characters.
final String? name;
/// [Optional] User's phone number.
final String? phone;
/// [Optional] The user's phone password.
final String? phonePassword;
/// Product name that Deriv offer
final String? product;
/// [Optional] Trade server.
final String? server;
/// [Optional] User's state (region) of residence.
final String? state;
/// [Optional] Indicate the additional risk management for each account
final String? subAccountCategory;
/// [Optional] Indicate the different offerings for mt5 account
final String? subAccountType;
/// [Optional] User's zip code.
final String? zipCode;
/// Converts this instance to JSON
@override
Map<String, dynamic> toJson() => <String, dynamic>{
'account_type': accountType,
'address': address,
'city': city,
'company': company,
'country': country,
'currency': currency,
'dry_run': dryRun == null
? null
: dryRun!
? 1
: 0,
'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
? null
: mt5NewAccount!
? 1
: 0,
'name': name,
'phone': phone,
'phonePassword': phonePassword,
'product': product,
'server': server,
'state': state,
'sub_account_category': subAccountCategory,
'sub_account_type': subAccountType,
'zipCode': zipCode,
'passthrough': passthrough,
'req_id': reqId,
};
/// Creates a copy of instance with given parameters
@override
Mt5NewAccountRequest copyWith({
String? accountType,
String? address,
String? city,
String? company,
String? country,
String? currency,
bool? dryRun,
String? email,
String? investPassword,
num? leverage,
String? loginid,
String? mainPassword,
dynamic migrate,
String? mt5AccountCategory,
String? mt5AccountType,
bool? mt5NewAccount,
String? name,
String? phone,
String? phonePassword,
String? product,
String? server,
String? state,
String? subAccountCategory,
String? subAccountType,
String? zipCode,
Map<String, dynamic>? passthrough,
int? reqId,
}) =>
Mt5NewAccountRequest(
accountType: accountType ?? this.accountType,
address: address ?? this.address,
city: city ?? this.city,
company: company ?? this.company,
country: country ?? this.country,
currency: currency ?? this.currency,
dryRun: dryRun ?? this.dryRun,
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,
name: name ?? this.name,
phone: phone ?? this.phone,
phonePassword: phonePassword ?? this.phonePassword,
product: product ?? this.product,
server: server ?? this.server,
state: state ?? this.state,
subAccountCategory: subAccountCategory ?? this.subAccountCategory,
subAccountType: subAccountType ?? this.subAccountType,
zipCode: zipCode ?? this.zipCode,
passthrough: passthrough ?? this.passthrough,
reqId: reqId ?? this.reqId,
);
/// Override equatable class.
@override
List<Object?> get props => <Object?>[];
}