encode<V> static method
Implementation
static V encode<V>(
SubscriptionScheduleCreateOptions instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.customer != null) {
container.encodeString(
'customer',
instance.customer!,
);
}
if (instance.defaultSettings != null) {
SubscriptionScheduleDefaultSettings.encode(
instance.defaultSettings!,
container.nestedSingleValueContainer('default_settings').encoder,
);
}
if (instance.endBehavior != null) {
SubscriptionScheduleEndBehavior.encode(
instance.endBehavior!,
container.nestedSingleValueContainer('end_behavior').encoder,
);
}
if (instance.expand != null) {
container.encodeList(
'expand',
(container) =>
instance.expand!.forEach((el) => container.encodeString(el)),
);
}
if (instance.fromSubscription != null) {
container.encodeString(
'from_subscription',
instance.fromSubscription!,
);
}
if (instance.metadata != null) {
container.encodeMap(
'metadata',
(container) => instance.metadata!.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
}
if (instance.phases != null) {
container.encodeList(
'phases',
(container) => instance.phases!
.forEach((el) => SubscriptionSchedulePhasesItem.encode(
el,
container.nestedSingleValueContainer().encoder,
)),
);
}
if (instance.startDate != null) {
container.encodePrimitive(
'start_date',
instance.startDate!,
);
}
return container.value;
}