encode<V> static method
Implementation
static V encode<V>(
PaymentLinkSubscriptionData instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.description != null) {
container.encodeString(
'description',
instance.description!,
);
}
PaymentLinksResourceSubscriptionDataInvoiceSettings.encode(
instance.invoiceSettings,
container.nestedSingleValueContainer('invoice_settings').encoder,
);
container.encodeMap(
'metadata',
(container) => instance.metadata.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
if (instance.trialPeriodDays != null) {
container.encodeInt(
'trial_period_days',
instance.trialPeriodDays!,
);
}
if (instance.trialSettings != null) {
PaymentLinkSubscriptionDataTrialSettings.encode(
instance.trialSettings!,
container.nestedSingleValueContainer('trial_settings').encoder,
);
}
return container.value;
}