encode<V> static method
Implementation
static V encode<V>(
DeletedDiscount instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.checkoutSession != null) {
container.encodeString(
'checkout_session',
instance.checkoutSession!,
);
}
Coupon.encode(
instance.coupon,
container.nestedSingleValueContainer('coupon').encoder,
);
if (instance.customer != null) {
BankAccountCustomerOrId.encode(
instance.customer!,
container.nestedSingleValueContainer('customer').encoder,
);
}
container.encodeBool(
'deleted',
true,
);
container.encodeString(
'id',
instance.id,
);
if (instance.invoice != null) {
container.encodeString(
'invoice',
instance.invoice!,
);
}
if (instance.invoiceItem != null) {
container.encodeString(
'invoice_item',
instance.invoiceItem!,
);
}
container.encodeString(
'object',
'discount',
);
if (instance.promotionCode != null) {
PromotionCodeOrId.encode(
instance.promotionCode!,
container.nestedSingleValueContainer('promotion_code').encoder,
);
}
container.encodeDateTime(
'start',
instance.start,
);
if (instance.subscription != null) {
container.encodeString(
'subscription',
instance.subscription!,
);
}
return container.value;
}