encode<V> static method
Implementation
static V encode<V>(
AccountCreateOptions instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.accountToken != null) {
container.encodeString(
'account_token',
instance.accountToken!,
);
}
if (instance.businessProfile != null) {
AccountCreateOptionsBusinessProfile.encode(
instance.businessProfile!,
container.nestedSingleValueContainer('business_profile').encoder,
);
}
if (instance.businessType != null) {
container.encodeString(
'business_type',
instance.businessType!,
);
}
if (instance.capabilities != null) {
AccountCapabilities.encode(
instance.capabilities!,
container.nestedSingleValueContainer('capabilities').encoder,
);
}
if (instance.company != null) {
AccountCompany.encode(
instance.company!,
container.nestedSingleValueContainer('company').encoder,
);
}
if (instance.country != null) {
container.encodeString(
'country',
instance.country!,
);
}
if (instance.defaultCurrency != null) {
container.encodeString(
'default_currency',
instance.defaultCurrency!,
);
}
if (instance.documents != null) {
AccountDocuments.encode(
instance.documents!,
container.nestedSingleValueContainer('documents').encoder,
);
}
if (instance.email != null) {
container.encodeString(
'email',
instance.email!,
);
}
if (instance.expand != null) {
container.encodeList(
'expand',
(container) =>
instance.expand!.forEach((el) => container.encodeString(el)),
);
}
if (instance.externalAccount != null) {
container.encodeString(
'external_account',
instance.externalAccount!,
);
}
if (instance.individual != null) {
AccountIndividual.encode(
instance.individual!,
container.nestedSingleValueContainer('individual').encoder,
);
}
if (instance.metadata != null) {
container.encodeMap(
'metadata',
(container) => instance.metadata!.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
}
if (instance.settings != null) {
AccountCreateOptionsSettings.encode(
instance.settings!,
container.nestedSingleValueContainer('settings').encoder,
);
}
if (instance.tosAcceptance != null) {
AccountCreateOptionsTosAcceptance.encode(
instance.tosAcceptance!,
container.nestedSingleValueContainer('tos_acceptance').encoder,
);
}
if (instance.type != null) {
AccountType.encode(
instance.type!,
container.nestedSingleValueContainer('type').encoder,
);
}
return container.value;
}