encode<V> static method

V encode<V>(
  1. PortalSubscriptionUpdate instance,
  2. Encoder<V> encoder
)

Implementation

static V encode<V>(
  PortalSubscriptionUpdate instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeList(
    'default_allowed_updates',
    (container) => instance.defaultAllowedUpdates
        .forEach((el) => container.encodeString(el)),
  );
  container.encodeBool(
    'enabled',
    instance.enabled,
  );
  if (instance.products != null) {
    container.encodeList(
      'products',
      (container) => instance.products!
          .forEach((el) => PortalSubscriptionUpdateProduct.encode(
                el,
                container.nestedSingleValueContainer().encoder,
              )),
    );
  }
  PortalSubscriptionCancelProrationBehavior.encode(
    instance.prorationBehavior,
    container.nestedSingleValueContainer('proration_behavior').encoder,
  );
  return container.value;
}