encode<V> static method
Implementation
static V encode<V>(
IssuingCardholder instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
IssuingCardholderAddress.encode(
instance.billing,
container.nestedSingleValueContainer('billing').encoder,
);
if (instance.company != null) {
IssuingCardholderCompany.encode(
instance.company!,
container.nestedSingleValueContainer('company').encoder,
);
}
container.encodeDateTime(
'created',
instance.created,
);
if (instance.email != null) {
container.encodeString(
'email',
instance.email!,
);
}
container.encodeString(
'id',
instance.id,
);
if (instance.individual != null) {
IssuingCardholderIndividual.encode(
instance.individual!,
container.nestedSingleValueContainer('individual').encoder,
);
}
container.encodeBool(
'livemode',
instance.livemode,
);
container.encodeMap(
'metadata',
(container) => instance.metadata.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
container.encodeString(
'name',
instance.name,
);
container.encodeString(
'object',
'issuing.cardholder',
);
if (instance.phoneNumber != null) {
container.encodeString(
'phone_number',
instance.phoneNumber!,
);
}
if (instance.preferredLocales != null) {
container.encodeList(
'preferred_locales',
(container) => instance.preferredLocales!
.forEach((el) => container.encodeString(el)),
);
}
IssuingCardholderRequirements.encode(
instance.requirements,
container.nestedSingleValueContainer('requirements').encoder,
);
if (instance.spendingControls != null) {
IssuingCardholderSpendingControls.encode(
instance.spendingControls!,
container.nestedSingleValueContainer('spending_controls').encoder,
);
}
container.encodeString(
'status',
instance.status,
);
container.encodeString(
'type',
instance.type,
);
return container.value;
}