encode<V> static method
Implementation
static V encode<V>(
PromotionCodesResourceRestrictions instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.currencyOptions != null) {
container.encodeMap(
'currency_options',
(container) => instance.currencyOptions!.forEach((
key,
value,
) =>
PromotionCodeCurrencyOption.encode(
value,
container.nestedSingleValueContainer(key).encoder,
)),
);
}
container.encodeBool(
'first_time_transaction',
instance.firstTimeTransaction,
);
if (instance.minimumAmount != null) {
container.encodeInt(
'minimum_amount',
instance.minimumAmount!,
);
}
if (instance.minimumAmountCurrency != null) {
container.encodeString(
'minimum_amount_currency',
instance.minimumAmountCurrency!,
);
}
return container.value;
}