encode<V> static method
Implementation
static V encode<V>(
TreasuryFinancialAccount instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.activeFeatures != null) {
container.encodeList(
'active_features',
(container) => instance.activeFeatures!
.forEach((el) => container.encodeString(el)),
);
}
TreasuryFinancialAccountsResourceBalance.encode(
instance.balance,
container.nestedSingleValueContainer('balance').encoder,
);
container.encodeString(
'country',
instance.country,
);
container.encodeDateTime(
'created',
instance.created,
);
if (instance.features != null) {
TreasuryFinancialAccountFeatures.encode(
instance.features!,
container.nestedSingleValueContainer('features').encoder,
);
}
container.encodeList(
'financial_addresses',
(container) => instance.financialAddresses.forEach(
(el) => TreasuryFinancialAccountsResourceFinancialAddress.encode(
el,
container.nestedSingleValueContainer().encoder,
)),
);
container.encodeString(
'id',
instance.id,
);
container.encodeBool(
'livemode',
instance.livemode,
);
if (instance.metadata != null) {
container.encodeMap(
'metadata',
(container) => instance.metadata!.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
}
container.encodeString(
'object',
'treasury.financial_account',
);
if (instance.pendingFeatures != null) {
container.encodeList(
'pending_features',
(container) => instance.pendingFeatures!
.forEach((el) => TreasuryFinancialAccountActiveFeaturesItem.encode(
el,
container.nestedSingleValueContainer().encoder,
)),
);
}
if (instance.platformRestrictions != null) {
TreasuryFinancialAccountPlatformRestrictions.encode(
instance.platformRestrictions!,
container.nestedSingleValueContainer('platform_restrictions').encoder,
);
}
if (instance.restrictedFeatures != null) {
container.encodeList(
'restricted_features',
(container) => instance.restrictedFeatures!
.forEach((el) => TreasuryFinancialAccountActiveFeaturesItem.encode(
el,
container.nestedSingleValueContainer().encoder,
)),
);
}
container.encodeString(
'status',
instance.status,
);
TreasuryFinancialAccountsResourceStatusDetails.encode(
instance.statusDetails,
container.nestedSingleValueContainer('status_details').encoder,
);
container.encodeList(
'supported_currencies',
(container) => instance.supportedCurrencies
.forEach((el) => container.encodeString(el)),
);
return container.value;
}