encode<V> static method
Implementation
static V encode<V>(
SubscriptionItemCreateOptions instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.billingThresholds != null) {
UpcomingSubscriptionItemsItemBillingThresholds.encode(
instance.billingThresholds!,
container.nestedSingleValueContainer('billing_thresholds').encoder,
);
}
if (instance.expand != null) {
container.encodeList(
'expand',
(container) =>
instance.expand!.forEach((el) => container.encodeString(el)),
);
}
if (instance.metadata != null) {
container.encodeMap(
'metadata',
(container) => instance.metadata!.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
}
if (instance.paymentBehavior != null) {
container.encodeString(
'payment_behavior',
instance.paymentBehavior!,
);
}
if (instance.plan != null) {
container.encodeString(
'plan',
instance.plan!,
);
}
if (instance.price != null) {
container.encodeString(
'price',
instance.price!,
);
}
if (instance.priceData != null) {
UpcomingSubscriptionItemsItemPriceData.encode(
instance.priceData!,
container.nestedSingleValueContainer('price_data').encoder,
);
}
if (instance.prorationBehavior != null) {
PortalSubscriptionCancelProrationBehavior.encode(
instance.prorationBehavior!,
container.nestedSingleValueContainer('proration_behavior').encoder,
);
}
if (instance.prorationDate != null) {
container.encodeDateTime(
'proration_date',
instance.prorationDate!,
);
}
if (instance.quantity != null) {
container.encodeInt(
'quantity',
instance.quantity!,
);
}
container.encodeString(
'subscription',
instance.subscription,
);
if (instance.taxRates != null) {
container.encodeList(
'tax_rates',
(container) =>
instance.taxRates!.forEach((el) => container.encodeString(el)),
);
}
return container.value;
}